diff --git a/pystac/catalog.py b/pystac/catalog.py index 35be90f8f..5fbb209b3 100644 --- a/pystac/catalog.py +++ b/pystac/catalog.py @@ -911,7 +911,7 @@ def from_dict( info = identify_stac_object(d) d = migrate_to_latest(d, info) - if not cls.dict_matches_object_type(d): + if not cls.matches_object_type(d): raise STACTypeError(f"{d} does not represent a {cls.__name__} instance") catalog_type = CatalogType.determine_type(d) @@ -964,5 +964,5 @@ def from_file(cls, href: str, stac_io: Optional[pystac.StacIO] = None) -> "Catal return result @classmethod - def dict_matches_object_type(cls, d: Dict[str, Any]) -> bool: + def matches_object_type(cls, d: Dict[str, Any]) -> bool: return identify_stac_object_type(d) == STACObjectType.CATALOG diff --git a/pystac/collection.py b/pystac/collection.py index 0d0b6ea4d..77a9a8644 100644 --- a/pystac/collection.py +++ b/pystac/collection.py @@ -592,7 +592,7 @@ def from_dict( info = identify_stac_object(d) d = migrate_to_latest(d, info) - if not cls.dict_matches_object_type(d): + if not cls.matches_object_type(d): raise STACTypeError(f"{d} does not represent a {cls.__name__} instance") catalog_type = CatalogType.determine_type(d) @@ -685,5 +685,5 @@ def from_file( return result @classmethod - def dict_matches_object_type(cls, d: Dict[str, Any]) -> bool: + def matches_object_type(cls, d: Dict[str, Any]) -> bool: return identify_stac_object_type(d) == STACObjectType.COLLECTION diff --git a/pystac/item.py b/pystac/item.py index ff4a0a984..d0896a324 100644 --- a/pystac/item.py +++ b/pystac/item.py @@ -920,7 +920,7 @@ def from_dict( info = identify_stac_object(d) d = migrate_to_latest(d, info) - if not cls.dict_matches_object_type(d): + if not cls.matches_object_type(d): raise pystac.STACTypeError( f"{d} does not represent a {cls.__name__} instance" ) @@ -990,5 +990,5 @@ def from_file(cls, href: str, stac_io: Optional[pystac.StacIO] = None) -> "Item" return result @classmethod - def dict_matches_object_type(cls, d: Dict[str, Any]) -> bool: + def matches_object_type(cls, d: Dict[str, Any]) -> bool: return identify_stac_object_type(d) == STACObjectType.ITEM diff --git a/pystac/stac_object.py b/pystac/stac_object.py index a6a16b550..7564b104f 100644 --- a/pystac/stac_object.py +++ b/pystac/stac_object.py @@ -515,7 +515,7 @@ def from_dict( @classmethod @abstractmethod - def dict_matches_object_type(cls, d: Dict[str, Any]) -> bool: + def matches_object_type(cls, d: Dict[str, Any]) -> bool: """Returns a boolean indicating whether the given dictionary represents a valid instance of this :class:`~STACObject` sub-class. diff --git a/tests/test_writing.py b/tests/test_writing.py index 85d197665..665a053b9 100644 --- a/tests/test_writing.py +++ b/tests/test_writing.py @@ -74,7 +74,9 @@ def validate_catalog_link_type( cat_dict = pystac.StacIO.default().read_json(href) cat = pystac.read_file(href) if not isinstance(cat, pystac.Catalog): - raise pystac.STACTypeError(f"File at {href} is a {cat.STAC_OBJECT_TYPE} not a Catalog.") + raise pystac.STACTypeError( + f"File at {href} is a {cat.STAC_OBJECT_TYPE} not a Catalog." + ) rels = set([link["rel"] for link in cat_dict["links"]]) self.assertEqual("self" in rels, should_include_self)