Skip to content

Commit 27ea872

Browse files
authored
fix: warning from get_all_items deprecation (#1203)
Also, remove usages of deprecated functions.
1 parent bd5c80b commit 27ea872

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

docs/tutorials/pystac-introduction.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@
16711671
],
16721672
"source": [
16731673
"# get all items anywhere below this catalog on the STAC tree\n",
1674-
"list(cat.get_all_items())"
1674+
"list(cat.get_items(recursive=True))"
16751675
]
16761676
},
16771677
{
@@ -1812,7 +1812,7 @@
18121812
],
18131813
"source": [
18141814
"print(\"\\n**Items**\")\n",
1815-
"for i in cat.get_all_items():\n",
1815+
"for i in cat.get_items(recursive=True):\n",
18161816
" print(i.id)"
18171817
]
18181818
},
@@ -6096,7 +6096,7 @@
60966096
}
60976097
],
60986098
"source": [
6099-
"item = next(mycat.get_all_items())\n",
6099+
"item = next(mycat.get_items(recursive=True))\n",
61006100
"item.get_single_link(\"parent\").get_href()"
61016101
]
61026102
},
@@ -6135,7 +6135,7 @@
61356135
}
61366136
],
61376137
"source": [
6138-
"item = next(mycat.get_all_items())\n",
6138+
"item = next(mycat.get_items(recursive=True))\n",
61396139
"item.get_single_link(\"parent\").get_href()"
61406140
]
61416141
}

docs/tutorials/pystac-spacenet-tutorial.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@
250250
"source": [
251251
"bounds = [\n",
252252
" list(\n",
253-
" GeometryCollection([shape(s.geometry) for s in spacenet.get_all_items()]).bounds\n",
253+
" GeometryCollection([shape(s.geometry) for s in spacenet.get_items(recursive=True)]).bounds\n",
254254
" )\n",
255255
"]\n",
256256
"vegas.extent.spatial = pystac.SpatialExtent(bounds)"

pystac/catalog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,12 +585,12 @@ def get_all_items(self) -> Iterator[Item]:
585585
child links.
586586
"""
587587
warnings.warn(
588-
"get_item is deprecated and will be removed in v2",
588+
"get_all_items is deprecated and will be removed in v2",
589589
DeprecationWarning,
590590
)
591591
return chain(
592592
self.get_items(),
593-
*(child.get_all_items() for child in self.get_children()),
593+
*(child.get_items(recursive=True) for child in self.get_children()),
594594
)
595595

596596
def get_item_links(self) -> List[Link]:

0 commit comments

Comments
 (0)