MCPcopy Create free account
hub / github.com/OpenBMB/ChatDev / _iter_candidate_files

Function _iter_candidate_files

functions/function_calling/file.py:1009–1029  ·  view source on GitHub ↗
(
    root: Path,
    include_patterns: Sequence[str],
    exclude_patterns: Sequence[str],
    include_hidden: bool,
)

Source from the content-addressed store, hash-verified

1007
1008
1009def _iter_candidate_files(
1010 root: Path,
1011 include_patterns: Sequence[str],
1012 exclude_patterns: Sequence[str],
1013 include_hidden: bool,
1014) -> Iterable[Path]:
1015 yielded: set[str] = set()
1016 for pattern in include_patterns:
1017 for candidate in root.glob(pattern):
1018 if not candidate.is_file():
1019 continue
1020 rel = candidate.relative_to(root)
1021 rel_key = rel.as_posix()
1022 if rel_key in yielded:
1023 continue
1024 if not include_hidden and _path_is_hidden(rel):
1025 continue
1026 if _is_excluded(rel_key, exclude_patterns):
1027 continue
1028 yielded.add(rel_key)
1029 yield candidate
1030
1031
1032def _path_is_hidden(path: Path) -> bool:

Callers 1

search_in_filesFunction · 0.85

Calls 2

_path_is_hiddenFunction · 0.85
_is_excludedFunction · 0.85

Tested by

no test coverage detected