Skip to content

Commit a6aa201

Browse files
committed
Rename to matches_object_type
1 parent 1fbf4c2 commit a6aa201

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

pystac/catalog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ def from_dict(
911911
info = identify_stac_object(d)
912912
d = migrate_to_latest(d, info)
913913

914-
if not cls.dict_matches_object_type(d):
914+
if not cls.matches_object_type(d):
915915
raise STACTypeError(f"{d} does not represent a {cls.__name__} instance")
916916

917917
catalog_type = CatalogType.determine_type(d)
@@ -964,5 +964,5 @@ def from_file(cls, href: str, stac_io: Optional[pystac.StacIO] = None) -> "Catal
964964
return result
965965

966966
@classmethod
967-
def dict_matches_object_type(cls, d: Dict[str, Any]) -> bool:
967+
def matches_object_type(cls, d: Dict[str, Any]) -> bool:
968968
return identify_stac_object_type(d) == STACObjectType.CATALOG

pystac/collection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ def from_dict(
592592
info = identify_stac_object(d)
593593
d = migrate_to_latest(d, info)
594594

595-
if not cls.dict_matches_object_type(d):
595+
if not cls.matches_object_type(d):
596596
raise STACTypeError(f"{d} does not represent a {cls.__name__} instance")
597597

598598
catalog_type = CatalogType.determine_type(d)
@@ -685,5 +685,5 @@ def from_file(
685685
return result
686686

687687
@classmethod
688-
def dict_matches_object_type(cls, d: Dict[str, Any]) -> bool:
688+
def matches_object_type(cls, d: Dict[str, Any]) -> bool:
689689
return identify_stac_object_type(d) == STACObjectType.COLLECTION

pystac/item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ def from_dict(
920920
info = identify_stac_object(d)
921921
d = migrate_to_latest(d, info)
922922

923-
if not cls.dict_matches_object_type(d):
923+
if not cls.matches_object_type(d):
924924
raise pystac.STACTypeError(
925925
f"{d} does not represent a {cls.__name__} instance"
926926
)
@@ -990,5 +990,5 @@ def from_file(cls, href: str, stac_io: Optional[pystac.StacIO] = None) -> "Item"
990990
return result
991991

992992
@classmethod
993-
def dict_matches_object_type(cls, d: Dict[str, Any]) -> bool:
993+
def matches_object_type(cls, d: Dict[str, Any]) -> bool:
994994
return identify_stac_object_type(d) == STACObjectType.ITEM

pystac/stac_object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ def from_dict(
515515

516516
@classmethod
517517
@abstractmethod
518-
def dict_matches_object_type(cls, d: Dict[str, Any]) -> bool:
518+
def matches_object_type(cls, d: Dict[str, Any]) -> bool:
519519
"""Returns a boolean indicating whether the given dictionary represents a valid
520520
instance of this :class:`~STACObject` sub-class.
521521

tests/test_writing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ def validate_catalog_link_type(
7474
cat_dict = pystac.StacIO.default().read_json(href)
7575
cat = pystac.read_file(href)
7676
if not isinstance(cat, pystac.Catalog):
77-
raise pystac.STACTypeError(f"File at {href} is a {cat.STAC_OBJECT_TYPE} not a Catalog.")
77+
raise pystac.STACTypeError(
78+
f"File at {href} is a {cat.STAC_OBJECT_TYPE} not a Catalog."
79+
)
7880

7981
rels = set([link["rel"] for link in cat_dict["links"]])
8082
self.assertEqual("self" in rels, should_include_self)

0 commit comments

Comments
 (0)