MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / pythonNameScan

Function pythonNameScan

src/resolution/name-matcher.ts:610–615  ·  view source on GitHub ↗

Per-file, per-name scans are shared by every ref in the file; cleared with the other memos on sync.

(context: ResolutionContext, key: string, scan: () => T)

Source from the content-addressed store, hash-verified

608const PYTHON_NAME_SCANS = new WeakMap<ResolutionContext, Map<string, unknown>>();
609/** Per-file, per-name scans are shared by every ref in the file; cleared with the other memos on sync. */
610function pythonNameScan<T>(context: ResolutionContext, key: string, scan: () => T): T {
611 let memo = PYTHON_NAME_SCANS.get(context);
612 if (!memo) { memo = new Map(); PYTHON_NAME_SCANS.set(context, memo); }
613 if (!memo.has(key)) memo.set(key, scan());
614 return memo.get(key) as T;
615}
616
617function scanPythonImportKeys(name: string, filePath: string, context: ResolutionContext): Set<string> {
618 const lines = pythonMemberLines(filePath, context);

Callers 4

pythonImportKeysFunction · 0.85
pythonGlobalBindingsFunction · 0.85
pythonMainBlockLinesFunction · 0.85
pythonExternalWritesFunction · 0.85

Calls 4

hasMethod · 0.80
scanFunction · 0.70
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected