Skip to content

Commit

Permalink
fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dchandan committed Jan 17, 2024
1 parent 6d65466 commit ed82212
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions STACpopulator/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ def __iter__(self) -> Iterator[Tuple[str, str, MutableMapping[str, Any]]]:
for item_name, ds in self.catalog_head.datasets.items():
attrs = self.extract_metadata(ds)
yield item_name, ds.url_path, attrs
# yield item_name, ds.url_path, []

for name, ref in self.catalog_head.catalog_refs.items():
self.catalog_head = ref.follow()
Expand Down Expand Up @@ -208,7 +207,7 @@ def __iter__(self) -> Iterator[Tuple[str, MutableMapping[str, Any]]]:
if self.prune: # stop recursive search if requested
del dirs[:]
col_path = os.path.join(root, self._collection_name)
yield col_path, self._load_json(col_path)
yield col_path, "", self._load_json(col_path)
# if a collection is found deeper when not expected for items parsing
# drop the nested directories to avoid over-crawling nested collections
elif not self._collection_mode and not is_root and self._collection_name in files:
Expand All @@ -218,7 +217,7 @@ def __iter__(self) -> Iterator[Tuple[str, MutableMapping[str, Any]]]:
for name in files:
if not self._collection_mode and self._is_item(name):
item_path = os.path.join(root, name)
yield item_path, self._load_json(item_path)
yield item_path, "", self._load_json(item_path)

def _is_item(self, path: Union[os.PathLike[str], str]) -> bool:
name = os.path.split(path)[-1]
Expand Down

0 comments on commit ed82212

Please sign in to comment.