Skip to content

Commit f57ec7e

Browse files
mshuaibiimshuaibi user
and
mshuaibi user
authored
sort fix for multiple src (#1037)
* sort fix for multiple src * lint --------- Co-authored-by: mshuaibi user <[email protected]>
1 parent 1573d44 commit f57ec7e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/fairchem/core/datasets/ase_datasets.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -471,23 +471,23 @@ class AseDBDataset(AseAtomsDataset):
471471
def _load_dataset_get_ids(self, config: dict) -> list[int]:
472472
if isinstance(config["src"], list):
473473
filepaths = []
474-
for path in config["src"]:
474+
for path in sorted(config["src"]):
475475
if os.path.isdir(path):
476-
filepaths.extend(glob(f"{path}/*"))
476+
filepaths.extend(sorted(glob(f"{path}/*")))
477477
elif os.path.isfile(path):
478478
filepaths.append(path)
479479
else:
480480
raise RuntimeError(f"Error reading dataset in {path}!")
481481
elif os.path.isfile(config["src"]):
482482
filepaths = [config["src"]]
483483
elif os.path.isdir(config["src"]):
484-
filepaths = glob(f'{config["src"]}/*')
484+
filepaths = sorted(glob(f'{config["src"]}/*'))
485485
else:
486-
filepaths = glob(config["src"])
486+
filepaths = sorted(glob(config["src"]))
487487

488488
self.dbs = []
489489

490-
for path in sorted(filepaths):
490+
for path in filepaths:
491491
try:
492492
self.dbs.append(self.connect_db(path, config.get("connect_args", {})))
493493
except ValueError:

0 commit comments

Comments
 (0)