Skip to content

Commit

Permalink
os.path.exists()
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsleh committed Feb 19, 2025
1 parent fa32d5e commit 71dacc5
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions torchgeo/datasets/bigearthnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,14 +854,9 @@ def _verify(self) -> None:
"""Verify the integrity of the dataset."""
exists = []
for key, metadata in self.metadata_locs.items():
if key != 'metadata':
exists.append(
os.path.exists(os.path.join(self.root, self.dir_file_names[key]))
)
else:
exists.append(
os.path.exists(os.path.join(self.root, self.dir_file_names[key]))
)
exists.append(
os.path.exists(os.path.join(self.root, self.dir_file_names[key]))
)

if all(exists):
return
Expand All @@ -870,17 +865,13 @@ def _verify(self) -> None:
exists = []
for key, metadata in self.metadata_locs.items():
if key == 'metadata':
if os.path.exists(os.path.join(self.root, self.dir_file_names[key])):
exists.append(True)
else:
exists.append(False)
exists.append(
os.path.exists(os.path.join(self.root, self.dir_file_names[key]))
)
else:
for fname in metadata['files']:
fpath = os.path.join(self.root, fname)
if os.path.exists(fpath):
exists.append(True)
else:
exists.append(False)
exists.append(os.path.exists(fpath))

if all(exists):
return
Expand Down

0 comments on commit 71dacc5

Please sign in to comment.