Skip to content

Commit 5b95d93

Browse files
examples allow for _ instead of .
1 parent cf1682a commit 5b95d93

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

accelforge/examples.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from pathlib import Path
23

34
EXAMPLES_DIR = Path(__file__).parent.parent / "examples"
@@ -19,6 +20,14 @@ def __getattr__(self, name: Path):
1920
if target_yaml.is_file():
2021
return target_yaml
2122

23+
name_replaced = name.replace(".", "_")
24+
name_yaml_replaced = target_yaml.stem.replace(".", "_")
25+
for item in os.listdir(self.path):
26+
stem = Path(item).stem
27+
if stem.replace(".", "_") in [name_replaced, name_yaml_replaced]:
28+
path = self.path / item
29+
return Directory(path) if path.is_dir() else path
30+
2231
raise ValueError(f"Not found: {target_stem} or {target_yaml}")
2332

2433
def iter(self):

0 commit comments

Comments
 (0)