diff --git a/CHANGELOG.md b/CHANGELOG.md index f2b96fc0b..7c6882244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Changed - Include a copy of the `fields.json` file (for summaries) with each distribution of PySTAC ([#1045](https://github.com/stac-utils/pystac/pull/1045)) +- Removed documentation references to `to_dict` methods returning JSON ([#1074](https://github.com/stac-utils/pystac/pull/1074)) ### Deprecated diff --git a/pystac/asset.py b/pystac/asset.py index 362470b47..554c5996e 100644 --- a/pystac/asset.py +++ b/pystac/asset.py @@ -112,10 +112,10 @@ def get_absolute_href(self) -> Optional[str]: return None def to_dict(self) -> Dict[str, Any]: - """Generate a dictionary representing the JSON of this Asset. + """Returns this Asset as a dictionary. Returns: - dict: A serialization of the Asset that can be written out as JSON. + dict: A serialization of the Asset. """ d: Dict[str, Any] = {"href": self.href} diff --git a/pystac/collection.py b/pystac/collection.py index 113e6f5c9..f5b986c2d 100644 --- a/pystac/collection.py +++ b/pystac/collection.py @@ -86,10 +86,10 @@ def __init__( self.extra_fields = extra_fields or {} def to_dict(self) -> Dict[str, Any]: - """Generate a dictionary representing the JSON of this SpatialExtent. + """Returns this spatial extent as a dictionary. Returns: - dict: A serialization of the SpatialExtent that can be written out as JSON. + dict: A serialization of the SpatialExtent. """ d = {"bbox": self.bboxes, **self.extra_fields} return d @@ -212,10 +212,10 @@ def __init__( self.extra_fields = extra_fields or {} def to_dict(self) -> Dict[str, Any]: - """Generate a dictionary representing the JSON of this TemporalExtent. + """Returns this temporal extent as a dictionary. Returns: - dict: A serialization of the TemporalExtent that can be written out as JSON. + dict: A serialization of the TemporalExtent. """ encoded_intervals: List[List[Optional[str]]] = [] for i in self.intervals: @@ -311,10 +311,10 @@ def __init__( self.extra_fields = extra_fields or {} def to_dict(self) -> Dict[str, Any]: - """Generate a dictionary representing the JSON of this Extent. + """Returns this extent as a dictionary. Returns: - dict: A serialization of the Extent that can be written out as JSON. + dict: A serialization of the Extent. """ d = { "spatial": self.spatial.to_dict(), diff --git a/pystac/extensions/eo.py b/pystac/extensions/eo.py index 8f1b4951b..ac156d4df 100644 --- a/pystac/extensions/eo.py +++ b/pystac/extensions/eo.py @@ -217,10 +217,10 @@ def __repr__(self) -> str: return "".format(self.name) def to_dict(self) -> Dict[str, Any]: - """Returns the dictionary representing the JSON of this Band. + """Returns this band as a dictionary. Returns: - dict: The wrapped dict of the Band that can be written out as JSON. + dict: The serialization of this Band. """ return self.properties diff --git a/pystac/extensions/item_assets.py b/pystac/extensions/item_assets.py index 8b37da72c..abe78bf98 100644 --- a/pystac/extensions/item_assets.py +++ b/pystac/extensions/item_assets.py @@ -163,7 +163,7 @@ def roles(self, v: Optional[List[str]]) -> None: self.properties[ASSET_ROLES_PROP] = v def to_dict(self) -> Dict[str, Any]: - """Returns a JSON-like dictionary representing this ``AssetDefinition``.""" + """Returns a dictionary representing this ``AssetDefinition``.""" return deepcopy(self.properties) def create_asset(self, href: str) -> pystac.Asset: diff --git a/pystac/extensions/label.py b/pystac/extensions/label.py index 2dc18321e..64a1f4362 100644 --- a/pystac/extensions/label.py +++ b/pystac/extensions/label.py @@ -141,7 +141,7 @@ def __eq__(self, o: object) -> bool: return self.to_dict() == o def to_dict(self) -> Dict[str, Any]: - """Returns the dictionary representing the JSON of this instance.""" + """Returns this label classes object as a dictionary.""" return self.properties @@ -197,7 +197,7 @@ def count(self, v: int) -> None: self.properties["count"] = v def to_dict(self) -> Dict[str, Any]: - """Returns the dictionary representing the JSON of this instance.""" + """Returns this label count object as a dictionary.""" return self.properties def __eq__(self, o: object) -> bool: @@ -262,7 +262,7 @@ def value(self, v: float) -> None: self.properties["value"] = v def to_dict(self) -> Dict[str, Any]: - """Returns the dictionary representing the JSON of this LabelStatistics.""" + """Returns this label statistics object as a dictionary.""" return self.properties def __eq__(self, o: object) -> bool: @@ -417,7 +417,7 @@ def add_counts(counts: List[LabelCount]) -> None: return LabelOverview.create(self.property_key, counts=new_counts) def to_dict(self) -> Dict[str, Any]: - """Returns the dictionary representing the JSON of this LabelOverview.""" + """Returns this label overview as a dictionary.""" return self.properties def __eq__(self, o: object) -> bool: diff --git a/pystac/extensions/pointcloud.py b/pystac/extensions/pointcloud.py index b3d7c53c9..8bc8f1884 100644 --- a/pystac/extensions/pointcloud.py +++ b/pystac/extensions/pointcloud.py @@ -125,7 +125,7 @@ def __repr__(self) -> str: ) def to_dict(self) -> Dict[str, Any]: - """Returns a JSON-like dictionary representing this ``Schema``.""" + """Returns this schema as a dictionary.""" return self.properties @@ -309,7 +309,7 @@ def __repr__(self) -> str: return "".format(str(self.properties)) def to_dict(self) -> Dict[str, Any]: - """Returns a JSON-like dictionary representing this ``Statistic``.""" + """Returns this statistic as a dictionary.""" return self.properties def __eq__(self, o: object) -> bool: diff --git a/pystac/extensions/raster.py b/pystac/extensions/raster.py index 7d7054b99..fa59db537 100644 --- a/pystac/extensions/raster.py +++ b/pystac/extensions/raster.py @@ -192,10 +192,10 @@ def valid_percent(self, v: Optional[float]) -> None: self.properties.pop("valid_percent", None) def to_dict(self) -> Dict[str, Any]: - """Returns the dictionary representing the JSON of those Statistics. + """Returns these statistics as a dictionary. Returns: - dict: The wrapped dict of the Statistics that can be written out as JSON. + dict: The serialization of the Statistics. """ return self.properties @@ -328,10 +328,10 @@ def buckets(self, v: List[int]) -> None: self.properties["buckets"] = v def to_dict(self) -> Dict[str, Any]: - """Returns the dictionary representing the JSON of this histogram. + """Returns this histogram as a dictionary. Returns: - dict: The wrapped dict of the Histogram that can be written out as JSON. + dict: The serialization of the Histogram. """ return self.properties @@ -631,10 +631,10 @@ def __repr__(self) -> str: return "" def to_dict(self) -> Dict[str, Any]: - """Returns the dictionary representing the JSON of this Band. + """Returns this band as a dictionary. Returns: - dict: The wrapped dict of the Band that can be written out as JSON. + dict: The serialization of the Band. """ return self.properties diff --git a/pystac/extensions/table.py b/pystac/extensions/table.py index a922d9c6c..10af0136f 100644 --- a/pystac/extensions/table.py +++ b/pystac/extensions/table.py @@ -76,7 +76,7 @@ def col_type(self, v: Optional[str]) -> None: self.properties[COL_TYPE_PROP] = v def to_dict(self) -> Dict[str, Any]: - """Returns a JSON-like dictionary representing this ``Column``.""" + """Returns a dictionary representing this ``Column``.""" return self.properties @@ -111,7 +111,7 @@ def description(self, v: Optional[str]) -> None: self.properties[COL_DESCRIPTION_PROP] = v def to_dict(self) -> Dict[str, Any]: - """Returns a JSON-like dictionary representing this ``Table``.""" + """Returns a dictionary representing this ``Table``.""" return self.properties diff --git a/pystac/item_collection.py b/pystac/item_collection.py index 7a55d638a..93ae74fa6 100644 --- a/pystac/item_collection.py +++ b/pystac/item_collection.py @@ -129,7 +129,7 @@ def __add__(self, other: object) -> "ItemCollection": return ItemCollection(items=combined) def to_dict(self, transform_hrefs: bool = False) -> Dict[str, Any]: - """Serializes an :class:`ItemCollection` instance to a JSON-like dictionary. + """Serializes an :class:`ItemCollection` instance to a dictionary. Args: transform_hrefs: If True, transform the HREF of hierarchical links diff --git a/pystac/link.py b/pystac/link.py index add3c3fbf..832e84995 100644 --- a/pystac/link.py +++ b/pystac/link.py @@ -359,7 +359,7 @@ def is_hierarchical(self) -> bool: return self.rel in HIERARCHICAL_LINKS def to_dict(self, transform_href: bool = True) -> Dict[str, Any]: - """Generate a dictionary representing the JSON of this serialized Link. + """Returns this link as a dictionary. Args: transform_href : If ``True``, transform the HREF based on the type of @@ -368,7 +368,7 @@ def to_dict(self, transform_href: bool = True) -> Dict[str, Any]: the HREF will be transformed to be relative to the catalog root if this is a hierarchical link relation. Returns: - dict : A serialization of the Link that can be written out as JSON. + dict : A serialization of the Link. """ d: Dict[str, Any] = { diff --git a/pystac/provider.py b/pystac/provider.py index ae30a7151..4620f85bc 100644 --- a/pystac/provider.py +++ b/pystac/provider.py @@ -81,10 +81,10 @@ def _repr_html_(self) -> str: return escape(repr(self)) def to_dict(self) -> Dict[str, Any]: - """Generate a dictionary representing the JSON of this Provider. + """Returns this provider as a dictionary. Returns: - dict: A serialization of the Provider that can be written out as JSON. + dict: A serialization of the Provider. """ d: Dict[str, Any] = {"name": self.name} if self.description is not None: diff --git a/pystac/stac_object.py b/pystac/stac_object.py index 3ed060f68..bffedad40 100644 --- a/pystac/stac_object.py +++ b/pystac/stac_object.py @@ -515,7 +515,7 @@ def _object_links(self) -> List[str]: def to_dict( self, include_self_link: bool = True, transform_hrefs: bool = True ) -> Dict[str, Any]: - """Generate a dictionary representing the JSON of this serialized object. + """Returns this object as a dictionary. Args: include_self_link : If True, the dict will contain a self link @@ -527,7 +527,7 @@ def to_dict( hierarchical link HREFs will be transformed to be relative to the catalog root. - dict: A serialization of the object that can be written out as JSON. + dict: A serialization of the object. """ raise NotImplementedError