Skip to content

Commit c1feab8

Browse files
authored
Revert "Apply StacIO instance from root in Catalog.set_root (#590)"
This reverts commit 5ddfa83.
1 parent acc5089 commit c1feab8

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

CHANGELOG.md

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
- Enable [strict
1414
mode](https://mypy.readthedocs.io/en/latest/command_line.html?highlight=strict%20mode#cmdoption-mypy-strict)
1515
for `mypy` ([#591](https://github.com/stac-utils/pystac/pull/591))
16-
- `Catalog.set_root` also sets `Catalog.stac_io` for the calling instance to be the same
17-
as `root.stac_io`, if that value is not `None`
18-
([#590](https://github.com/stac-utils/pystac/pull/590))
1916
- Links will get their `title` from their target if no `title` is provided ([#607](https://github.com/stac-utils/pystac/pull/607))
2017
- Relax typing on `LabelClasses` from `List` to `Sequence` ([#627](https://github.com/stac-utils/pystac/pull/627))
2118

pystac/catalog.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CatalogType(str, Enum):
4545
4646
See:
4747
:stac-spec:`The best practices documentation on self-contained catalogs
48-
<best-practices.md#self-contained-catalogs>`
48+
<best-practices.md#self-contained-catalogs>`
4949
"""
5050

5151
ABSOLUTE_PUBLISHED = "ABSOLUTE_PUBLISHED"
@@ -55,7 +55,7 @@ class CatalogType(str, Enum):
5555
5656
See:
5757
:stac-spec:`The best practices documentation on published catalogs
58-
<best-practices.md#published-catalogs>`
58+
<best-practices.md#published-catalogs>`
5959
"""
6060

6161
RELATIVE_PUBLISHED = "RELATIVE_PUBLISHED"
@@ -65,7 +65,7 @@ class CatalogType(str, Enum):
6565
6666
See:
6767
:stac-spec:`The best practices documentation on published catalogs
68-
<best-practices.md#published-catalogs>`
68+
<best-practices.md#published-catalogs>`
6969
"""
7070

7171
@classmethod
@@ -181,13 +181,11 @@ def __repr__(self) -> str:
181181
return "<Catalog id={}>".format(self.id)
182182

183183
def set_root(self, root: Optional["Catalog"]) -> None:
184-
super().set_root(root)
184+
STACObject.set_root(self, root)
185185
if root is not None:
186186
root._resolved_objects = ResolvedObjectCache.merge(
187187
root._resolved_objects, self._resolved_objects
188188
)
189-
if root._stac_io is not None:
190-
self._stac_io = root._stac_io
191189

192190
def is_relative(self) -> bool:
193191
return self.catalog_type in [

tests/test_catalog.py

-14
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
HIERARCHICAL_LINKS,
1919
)
2020
from pystac.extensions.label import LabelClasses, LabelExtension, LabelType
21-
from pystac.stac_io import DefaultStacIO
2221
from pystac.utils import is_absolute_href, join_path_or_url, JoinType
2322
from tests.utils import (
2423
TestCases,
@@ -108,19 +107,6 @@ def test_from_dict_set_root(self) -> None:
108107
collection = Catalog.from_dict(cat_dict, root=root_cat)
109108
self.assertIs(collection.get_root(), root_cat)
110109

111-
def test_from_dict_uses_root_stac_io(self) -> None:
112-
class CustomStacIO(DefaultStacIO):
113-
pass
114-
115-
path = TestCases.get_path("data-files/catalogs/test-case-1/catalog.json")
116-
with open(path) as f:
117-
cat_dict = json.load(f)
118-
root_cat = pystac.Catalog(id="test", description="test desc")
119-
root_cat._stac_io = CustomStacIO()
120-
121-
collection = Catalog.from_dict(cat_dict, root=root_cat)
122-
self.assertIsInstance(collection._stac_io, CustomStacIO)
123-
124110
def test_read_remote(self) -> None:
125111
# TODO: Move this URL to the main stac-spec repo once the example JSON is fixed.
126112
catalog_url = (

0 commit comments

Comments
 (0)