Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 2, 2023
1 parent 239f108 commit 18f52ee
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions integration_tests/test_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
import json
import urllib.parse
from collections import Counter, defaultdict
from functools import lru_cache, partial
from functools import lru_cache
from pathlib import Path
from pprint import pformat
from referencing import Registry, Resource
from typing import Dict, Generator, Iterable, List, Optional, Union
from urllib.parse import urlsplit
from urllib.request import urlopen
Expand All @@ -20,6 +19,7 @@
from flask import Response
from flask.testing import FlaskClient
from jsonschema import SchemaError
from referencing import Registry, Resource
from shapely.geometry import shape as shapely_shape
from shapely.validation import explain_validity

Expand Down Expand Up @@ -189,11 +189,13 @@ def load_schema_doc(
jsonschema.Draft7Validator.check_schema(schema)
except SchemaError as e:
raise RuntimeError(f"Invalid schema {location}") from e

def retrieve(uri: str):
parsed = urlsplit(uri)
if parsed.scheme == "https" or parsed.scheme == "http":
return Resource.from_contents(_web_reference(uri))
return Resource.from_contents(_local_reference(location, uri))

return jsonschema.Draft7Validator(schema, registry=Registry(retrieve=retrieve))


Expand Down

0 comments on commit 18f52ee

Please sign in to comment.