Skip to content

Commit

Permalink
Update tools/schemacode/src/bidsschematools/types/namespace.py
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Markiewicz <[email protected]>
  • Loading branch information
Remi-Gau and effigies authored Dec 17, 2024
1 parent 383a64e commit 76ccc4d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/schemacode/src/bidsschematools/types/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,13 @@ def from_json(cls, jsonstr: str):
def _read_yaml_dir(path: Path) -> dict:
mapping = {}
for subpath in sorted(path.iterdir()):
try:
if subpath.is_dir():
mapping[subpath.name] = _read_yaml_dir(subpath)
elif subpath.name.endswith("yaml"):
if subpath.is_dir():
mapping[subpath.name] = _read_yaml_dir(subpath)
elif subpath.name.endswith("yaml"):
try:
mapping[subpath.stem] = yaml.safe_load(subpath.read_text())
except Exception as e:
raise ValueError(f"There was an error reading the file: {subpath}") from e
except Exception as e:
raise ValueError(f"There was an error reading the file: {subpath}") from e
return mapping


Expand Down

0 comments on commit 76ccc4d

Please sign in to comment.