Skip to content

Commit

Permalink
mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhealy1 committed Jan 10, 2025
1 parent 15c8714 commit 2b1afe2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 5 additions & 6 deletions stac_validator/utilities.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import functools
import json
import ssl
from typing import Dict
from typing import Optional
from typing import Dict, Optional
from urllib.parse import urlparse
from urllib.request import Request, urlopen

Expand All @@ -11,8 +10,8 @@
from jsonschema import Draft202012Validator
from referencing import Registry, Resource
from referencing.jsonschema import DRAFT202012
from referencing.typing import URI
from referencing.retrieval import to_cached_resource
from referencing.typing import URI

NEW_VERSIONS = [
"1.0.0-beta.2",
Expand Down Expand Up @@ -211,7 +210,7 @@ def fetch_remote_schema(uri: str) -> dict:
return response.json()


@to_cached_resource()
@to_cached_resource() # type: ignore
def cached_retrieve(uri: URI) -> str:
"""
Retrieve and cache a remote schema.
Expand Down Expand Up @@ -265,10 +264,10 @@ def validate_with_ref_resolver(schema_path: str, content: dict) -> None:
raise FileNotFoundError(f"Schema file not found: {schema_path}") from e

# Set up the resource and registry for schema resolution
resource: Resource = Resource(contents=schema, specification=DRAFT202012)
resource: Resource = Resource(contents=schema, specification=DRAFT202012) # type: ignore
registry: Registry = Registry(retrieve=cached_retrieve).with_resource(
uri=schema_path, resource=resource
)
) # type: ignore

# Validate the content against the schema
try:
Expand Down
4 changes: 1 addition & 3 deletions stac_validator/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,12 @@ def __init__(
links: bool = False,
assets: bool = False,
assets_open_urls: bool = True,
headers: dict = None,
headers: dict = {},
extensions: bool = False,
custom: str = "",
verbose: bool = False,
log: str = "",
):
if headers is None:
headers = {}
self.stac_file = stac_file
self.collections = collections
self.item_collection = item_collection
Expand Down

0 comments on commit 2b1afe2

Please sign in to comment.