From 645a1a364994b7088c1b53b54c63c1db2cc68f66 Mon Sep 17 00:00:00 2001 From: Victor Engmark Date: Tue, 6 Jul 2021 14:15:40 +1200 Subject: [PATCH 1/3] refactor: Rename parameter to clarify it's not used It's needed for type checking, but the value is not used in production. --- pystac/extensions/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pystac/extensions/base.py b/pystac/extensions/base.py index b8f27ad0c..9633f3af2 100644 --- a/pystac/extensions/base.py +++ b/pystac/extensions/base.py @@ -57,7 +57,7 @@ class PropertiesExtension(ABC): ``additional_read_properties`` will take precedence. """ - def _get_property(self, prop_name: str, typ: Type[P]) -> Optional[P]: + def _get_property(self, prop_name: str, _typ: Type[P]) -> Optional[P]: maybe_property: Optional[P] = self.properties.get(prop_name) if maybe_property is not None: return maybe_property From c68aea5b3e29dd86055c6c0ade1b6ccfbc1485f3 Mon Sep 17 00:00:00 2001 From: Victor Engmark Date: Tue, 6 Jul 2021 14:16:46 +1200 Subject: [PATCH 2/3] chore: Remove unused parameter --- pystac/catalog.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pystac/catalog.py b/pystac/catalog.py index be31b9eab..7acbb40ea 100644 --- a/pystac/catalog.py +++ b/pystac/catalog.py @@ -626,7 +626,6 @@ def generate_subcatalogs( template: str, defaults: Optional[Dict[str, Any]] = None, parent_ids: Optional[List[str]] = None, - **kwargs: Any, ) -> List["Catalog"]: """Walks through the catalog and generates subcatalogs for items based on the template string. From 0b8dd59f5af0d5f58e5419be2f58f19cbab2ebbb Mon Sep 17 00:00:00 2001 From: Victor Engmark Date: Tue, 6 Jul 2021 14:21:49 +1200 Subject: [PATCH 3/3] chore: Remove unused variables These variables are always overwritten before use. --- pystac/extensions/label.py | 1 - pystac/serialization/common_properties.py | 2 -- pystac/validation/schema_uri_map.py | 3 --- 3 files changed, 6 deletions(-) diff --git a/pystac/extensions/label.py b/pystac/extensions/label.py index e7ed694fa..c18721db6 100644 --- a/pystac/extensions/label.py +++ b/pystac/extensions/label.py @@ -391,7 +391,6 @@ def merge_counts(self, other: "LabelOverview") -> "LabelOverview": """ assert self.property_key == other.property_key - new_counts = None if self.counts is None: new_counts = other.counts else: diff --git a/pystac/serialization/common_properties.py b/pystac/serialization/common_properties.py index de9abe563..8ebcc7c27 100644 --- a/pystac/serialization/common_properties.py +++ b/pystac/serialization/common_properties.py @@ -29,7 +29,6 @@ def merge_common_properties( properties_merged = False collection: Optional[Union[pystac.Collection, Dict[str, Any]]] = None - collection_id: Optional[str] = None collection_href: Optional[str] = None stac_version = item_dict.get("stac_version") @@ -79,7 +78,6 @@ def merge_common_properties( collection = pystac.StacIO.default().read_json(collection_href) if collection is not None: - collection_id = None collection_props: Optional[Dict[str, Any]] = None if isinstance(collection, pystac.Collection): collection_id = collection.id diff --git a/pystac/validation/schema_uri_map.py b/pystac/validation/schema_uri_map.py index 0bcd273b9..08b2a5948 100644 --- a/pystac/validation/schema_uri_map.py +++ b/pystac/validation/schema_uri_map.py @@ -77,7 +77,6 @@ class DefaultSchemaUriMap(SchemaUriMap): def _append_base_uri_if_needed(cls, uri: str, stac_version: str) -> Optional[str]: # Only append the base URI if it's not already an absolute URI if "://" not in uri: - base_uri = None for version_range, f in cls.BASE_URIS: if version_range.contains(stac_version): base_uri = f(stac_version) @@ -91,7 +90,6 @@ def _append_base_uri_if_needed(cls, uri: str, stac_version: str) -> Optional[str def get_object_schema_uri( self, object_type: STACObjectType, stac_version: str ) -> Optional[str]: - uri = None is_latest = stac_version == pystac.get_stac_version() if object_type not in self.DEFAULT_SCHEMA_MAP: @@ -315,7 +313,6 @@ def _append_base_uri_if_needed( ) -> Optional[str]: # Only append the base URI if it's not already an absolute URI if "://" not in uri: - base_uri = None for version_range, f in cls.get_base_uris(): if version_range.contains(stac_version): base_uri = f(stac_version)