Skip to content

Commit 5eacbba

Browse files
authored
add glob support for file inputs (#68)
this also removes includes/excludes in favor of sensible glob defaults (matches previous os walk (recursive)) pattern
1 parent 24b744e commit 5eacbba

9 files changed

Lines changed: 424 additions & 23 deletions

File tree

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ getrandom = "0.3"
3838
chrono = { version = "0.4.40", features = ["clock"] }
3939
dirs = "5"
4040
pathdiff = "0.2.3"
41+
glob = "0.3"
4142

4243
[profile.dist]
4344
inherits = "release"

scripts/eval-runner.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import sys
1212
import traceback
1313
from dataclasses import dataclass
14-
from pathlib import PurePosixPath
1514
from typing import Any, Callable
1615

1716
try:
@@ -35,8 +34,6 @@
3534
print(str(exc), file=sys.stderr)
3635
sys.exit(1)
3736

38-
INCLUDE = ["**/eval_*.py", "**/*.eval.py"]
39-
EXCLUDE = ["**/site-packages/**", "**/__pycache__/**"]
4037
WATCHABLE_PYTHON_EXTENSIONS = {".py"}
4138
WATCH_EXCLUDE_SEGMENTS = (
4239
"/site-packages/",
@@ -366,26 +363,12 @@ def build_eval_definitions(evaluator_instances: list[EvaluatorInstance]) -> dict
366363
return definitions
367364

368365

369-
def check_match(path_input: str) -> bool:
370-
p = PurePosixPath(os.path.abspath(path_input).replace("\\", "/"))
371-
if INCLUDE:
372-
matched = any(p.match(pattern) for pattern in INCLUDE)
373-
if not matched:
374-
return False
375-
if EXCLUDE:
376-
if any(p.match(pattern) for pattern in EXCLUDE):
377-
return False
378-
return True
379-
380-
381366
def collect_files(input_path: str) -> list[str]:
382367
if os.path.isdir(input_path):
383368
matches: list[str] = []
384369
for root, _, files in os.walk(input_path):
385370
for filename in files:
386-
fname = os.path.join(root, filename)
387-
if check_match(fname):
388-
matches.append(fname)
371+
matches.append(os.path.join(root, filename))
389372
return matches
390373
return [input_path]
391374

0 commit comments

Comments
 (0)