Skip to content

Commit

Permalink
fix: warning from get_all_items deprecation (#1203)
Browse files Browse the repository at this point in the history
Also, remove usages of deprecated functions.
  • Loading branch information
gadomski authored Aug 10, 2023
1 parent bd5c80b commit 27ea872
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions docs/tutorials/pystac-introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,7 @@
],
"source": [
"# get all items anywhere below this catalog on the STAC tree\n",
"list(cat.get_all_items())"
"list(cat.get_items(recursive=True))"
]
},
{
Expand Down Expand Up @@ -1812,7 +1812,7 @@
],
"source": [
"print(\"\\n**Items**\")\n",
"for i in cat.get_all_items():\n",
"for i in cat.get_items(recursive=True):\n",
" print(i.id)"
]
},
Expand Down Expand Up @@ -6096,7 +6096,7 @@
}
],
"source": [
"item = next(mycat.get_all_items())\n",
"item = next(mycat.get_items(recursive=True))\n",
"item.get_single_link(\"parent\").get_href()"
]
},
Expand Down Expand Up @@ -6135,7 +6135,7 @@
}
],
"source": [
"item = next(mycat.get_all_items())\n",
"item = next(mycat.get_items(recursive=True))\n",
"item.get_single_link(\"parent\").get_href()"
]
}
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/pystac-spacenet-tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
"source": [
"bounds = [\n",
" list(\n",
" GeometryCollection([shape(s.geometry) for s in spacenet.get_all_items()]).bounds\n",
" GeometryCollection([shape(s.geometry) for s in spacenet.get_items(recursive=True)]).bounds\n",
" )\n",
"]\n",
"vegas.extent.spatial = pystac.SpatialExtent(bounds)"
Expand Down
4 changes: 2 additions & 2 deletions pystac/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,12 +585,12 @@ def get_all_items(self) -> Iterator[Item]:
child links.
"""
warnings.warn(
"get_item is deprecated and will be removed in v2",
"get_all_items is deprecated and will be removed in v2",
DeprecationWarning,
)
return chain(
self.get_items(),
*(child.get_all_items() for child in self.get_children()),
*(child.get_items(recursive=True) for child in self.get_children()),
)

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

0 comments on commit 27ea872

Please sign in to comment.