Skip to content

Commit 6267c77

Browse files
committed
Use type values in STACObjectType
1 parent 0a81994 commit 6267c77

File tree

4 files changed

+132
-142
lines changed

4 files changed

+132
-142
lines changed

pystac/serialization/identify.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,6 @@ class OldExtensionShortIDs(Enum):
3131
FILE = "file"
3232

3333

34-
class STACType(str, Enum):
35-
def __str__(self) -> str:
36-
return str(self.value)
37-
38-
CATALOG = "Catalog"
39-
COLLECTION = "Collection"
40-
ITEM = "Feature"
41-
42-
4334
@total_ordering
4435
class STACVersionID:
4536
"""Defines STAC versions in an object that is orderable based on version number.
@@ -206,11 +197,11 @@ def identify_stac_object_type(
206197
return None
207198

208199
# Try to match the "type" attribute
209-
if obj_type == STACType.CATALOG:
200+
if obj_type == pystac.STACObjectType.CATALOG:
210201
return pystac.STACObjectType.CATALOG
211-
elif obj_type == STACType.COLLECTION:
202+
elif obj_type == pystac.STACObjectType.COLLECTION:
212203
return pystac.STACObjectType.COLLECTION
213-
elif obj_type == STACType.ITEM:
204+
elif obj_type == pystac.STACObjectType.ITEM:
214205
return pystac.STACObjectType.ITEM
215206
else:
216207
return None

pystac/serialization/migrate.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
OldExtensionShortIDs,
88
STACJSONDescription,
99
STACVersionID,
10-
STACType,
1110
)
1211

1312
if TYPE_CHECKING:
@@ -17,7 +16,7 @@
1716
def _migrate_catalog(
1817
d: Dict[str, Any], version: STACVersionID, info: STACJSONDescription
1918
) -> None:
20-
d["type"] = STACType.CATALOG
19+
d["type"] = pystac.STACObjectType.CATALOG
2120

2221

2322
def _migrate_collection_summaries(
@@ -35,7 +34,7 @@ def _migrate_collection_summaries(
3534
def _migrate_collection(
3635
d: Dict[str, Any], version: STACVersionID, info: STACJSONDescription
3736
) -> None:
38-
d["type"] = STACType.COLLECTION
37+
d["type"] = pystac.STACObjectType.COLLECTION
3938
_migrate_collection_summaries(d, version, info)
4039

4140

pystac/stac_object.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class STACObjectType(str, Enum):
1515
def __str__(self) -> str:
1616
return str(self.value)
1717

18-
CATALOG = "CATALOG"
19-
COLLECTION = "COLLECTION"
20-
ITEM = "ITEM"
18+
CATALOG = "Catalog"
19+
COLLECTION = "Collection"
20+
ITEM = "Feature"
2121

2222

2323
class STACObject(ABC):

0 commit comments

Comments
 (0)