From 2b1afe206a0661964ee431b93e167cfe8b562eb7 Mon Sep 17 00:00:00 2001 From: jonhealy1 Date: Fri, 10 Jan 2025 09:57:30 +0800 Subject: [PATCH] mypy --- stac_validator/utilities.py | 11 +++++------ stac_validator/validate.py | 4 +--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/stac_validator/utilities.py b/stac_validator/utilities.py index de78246..4dee5cc 100644 --- a/stac_validator/utilities.py +++ b/stac_validator/utilities.py @@ -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 @@ -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", @@ -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. @@ -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: diff --git a/stac_validator/validate.py b/stac_validator/validate.py index 48b13d5..ba71a7f 100644 --- a/stac_validator/validate.py +++ b/stac_validator/validate.py @@ -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