Skip to content

Commit

Permalink
Remove reduntand cast to set
Browse files Browse the repository at this point in the history
  • Loading branch information
adriantre committed Jun 29, 2023
1 parent a932659 commit e2fb866
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions torchgeo/datasets/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,18 +439,18 @@ def list_files(self, filename_glob: Optional[str] = None) -> list[str]:
filepaths: set[str] = set()
for dir_or_file in paths:
if os.path.exists(dir_or_file):
if os.path.isdir(dir_or_file):
if os.path.isfile(dir_or_file):
filepaths.add(dir_or_file)
else:
pathname = os.path.join(dir_or_file, "**", filename_glob)
filepaths |= set(glob.iglob(pathname, recursive=True))
else:
filepaths.add(dir_or_file)
else:
filepaths |= self.handle_nonlocal_path(dir_or_file)

return list(set(filepaths))
return list(filepaths)

def handle_nonlocal_path(self, path: str) -> set[str]:
"""Override this method if your path can not be interpreded by os module.
"""Override this method if your path can not be interpreted by os module.
See docs for Advanced Datasets
https://rasterio.readthedocs.io/en/stable/topics/datasets.html
Expand Down

0 comments on commit e2fb866

Please sign in to comment.