MCPcopy Create free account
hub / github.com/Houseofmvps/codesight / parsePythonRequirements

Function parsePythonRequirements

src/scanner.ts:1109–1128  ·  view source on GitHub ↗
(content: string, root: string, deps: string[])

Source from the content-addressed store, hash-verified

1107}
1108
1109async function parsePythonRequirements(content: string, root: string, deps: string[]): Promise<void> {
1110 for (const line of content.split("\n")) {
1111 const trimmed = line.trim();
1112 if (!trimmed || trimmed.startsWith("#")) continue;
1113 // Follow -r includes one level deep
1114 const includeMatch = trimmed.match(/^-r\s+(.+)/);
1115 if (includeMatch) {
1116 try {
1117 const included = await readFile(join(root, includeMatch[1].trim()), "utf-8");
1118 for (const subLine of included.split("\n")) {
1119 const name = subLine.split(/[>=<\[#]/)[0].trim().toLowerCase().replace(/-/g, "-");
1120 if (name && !name.startsWith("-") && !deps.includes(name)) deps.push(name);
1121 }
1122 } catch {}
1123 continue;
1124 }
1125 const name = trimmed.split(/[>=<\[#]/)[0].trim().toLowerCase();
1126 if (name && !name.startsWith("-") && !deps.includes(name)) deps.push(name);
1127 }
1128}
1129
1130async function getPythonDeps(root: string): Promise<string[]> {
1131 const deps: string[] = [];

Callers 1

getPythonDepsFunction · 0.85

Calls 1

joinFunction · 0.85

Tested by

no test coverage detected