From 4088b0d4876b7046a4b36e8fb8c91be767445345 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:31:58 -0800 Subject: [PATCH] Remove unused resolve_remote overload I renamed $defs.tree to something else in schema-export-v2.json, expecting this to error to be raised. Instead, I got an "Unresolvable JSON pointer" error (tested on jsonschema v3.0.0 and v3.2.0). I'm not sure what could trigger this exception, but it doesn't seem to be used for its intended purpose. Removing it in advance of supporting jsonschema v4.18.0, where this is no longer applicable since schema_validator.resolver uses the deprecated RefResolver. --- augur/validate.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/augur/validate.py b/augur/validate.py index 364a5d785..5c3defb47 100644 --- a/augur/validate.py +++ b/augur/validate.py @@ -53,17 +53,6 @@ def load_json_schema(path, refs=None): else: schema_validator = Validator(schema) - # By default $ref URLs which we don't define in a schema_store are fetched - # by jsonschema. This often indicates a typo (the $ref doesn't match the key - # of the schema_store) or we forgot to add a local mapping for a new $ref. - # Either way, Augur should not be accessing the network. - def resolve_remote(url): - # The exception type is not important as jsonschema will catch & re-raise as a RefResolutionError - raise Exception(f"The schema used for validation attempted to fetch the remote URL {url!r}. " + - "Augur should resolve schema references to local files, please check the schema used " + - "and update the appropriate schema_store as needed." ) - schema_validator.resolver.resolve_remote = resolve_remote - return schema_validator