MCPcopy
hub / github.com/Fokkyp/SoftwareCopyright-Skill / read_text

Function read_text

software-copyright-materials/scripts/common.py:199–208  ·  view source on GitHub ↗
(path: Path, limit: int | None = None)

Source from the content-addressed store, hash-verified

197
198
199def read_text(path: Path, limit: int | None = None) -> str:
200 data = path.read_bytes()
201 if limit is not None:
202 data = data[:limit]
203 for encoding in ("utf-8", "utf-8-sig", "gb18030", "latin-1"):
204 try:
205 return data.decode(encoding)
206 except UnicodeDecodeError:
207 continue
208 return data.decode("utf-8", errors="replace")
209
210
211def read_json(path: Path) -> dict[str, Any]:

Callers 10

extract_route_pathsFunction · 0.90
summarize_readmeFunction · 0.90
collect_documentsFunction · 0.90
mainFunction · 0.90
should_skip_fileFunction · 0.90
collect_code_linesFunction · 0.90
read_readmeFunction · 0.90
infer_runtime_supportFunction · 0.90
read_jsonFunction · 0.85
count_text_linesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected