mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-11-09 20:40:36 +00:00
is_eval_fixture_path returned on the first 'evals' segment, so a path whose 'evals/fixtures/' came after a plain 'evals' segment read as a non-fixture. Move the 'fixtures' test into the loop condition so every segment is checked. Co-authored-by: sxh313 <sxh313@users.noreply.github.com>
25 lines
851 B
Python
25 lines
851 B
Python
"""Shared helpers for skill-package relative paths."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import PurePosixPath
|
|
|
|
|
|
def _parts(path: str | PurePosixPath) -> tuple[str, ...]:
|
|
return PurePosixPath(str(path).replace("\\", "/")).parts
|
|
|
|
|
|
def is_eval_fixture_path(path: str | PurePosixPath) -> bool:
|
|
"""Return whether a path is under an eval fixture directory."""
|
|
parts = _parts(path)
|
|
for index, part in enumerate(parts[:-1]):
|
|
if part == "evals" and len(parts) > index + 2 and parts[index + 1] == "fixtures":
|
|
return True
|
|
return False
|
|
|
|
|
|
def is_eval_fixture_skill_md(path: str | PurePosixPath) -> bool:
|
|
"""Return whether a path is an eval fixture's nested SKILL.md file."""
|
|
parts = _parts(path)
|
|
return bool(parts) and parts[-1] == "SKILL.md" and is_eval_fixture_path(PurePosixPath(*parts[:-1]))
|