MCPcopy
hub / github.com/Doorman11991/smallcode / iter_code_files

Function iter_code_files

scripts/rag_scraper.py:92–105  ·  view source on GitHub ↗
(root: Path, max_bytes: int, languages: Optional[set[str]])

Source from the content-addressed store, hash-verified

90
91
92def iter_code_files(root: Path, max_bytes: int, languages: Optional[set[str]]) -> Iterator[Tuple[Path, str]]:
93 for dirpath, dirnames, filenames in os.walk(root):
94 dirnames[:] = [d for d in dirnames if d not in SKIP_DIRS and not d.startswith(".")]
95 for filename in filenames:
96 path = Path(dirpath) / filename
97 lang = LANG_BY_EXT.get(path.suffix.lower())
98 if not lang or (languages and lang not in languages):
99 continue
100 try:
101 if path.stat().st_size > max_bytes:
102 continue
103 except OSError:
104 continue
105 yield path, lang
106
107
108def symbol_name(match: re.Match[str]) -> str:

Callers 1

scrape_repoFunction · 0.85

Calls 2

walkMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected