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

Function resolve

src/resolution/frameworks/python.ts:27–51  ·  view source on GitHub ↗
(ref, context)

Source from the content-addressed store, hash-verified

25 },
26
27 resolve(ref, context) {
28 if (ref.referenceName.endsWith('Model') || /^[A-Z][a-z]+$/.test(ref.referenceName)) {
29 const result = resolveByNameAndKind(ref, CLASS_KINDS, MODEL_DIRS, context);
30 if (result) return { original: ref, targetNodeId: result, confidence: 0.8, resolvedBy: 'framework' };
31 }
32 if (ref.referenceName.endsWith('View') || ref.referenceName.endsWith('ViewSet')) {
33 const result = resolveByNameAndKind(ref, VIEW_KINDS, VIEW_DIRS, context);
34 if (result) return { original: ref, targetNodeId: result, confidence: 0.8, resolvedBy: 'framework' };
35 }
36 if (ref.referenceName.endsWith('Form')) {
37 const result = resolveByNameAndKind(ref, CLASS_KINDS, FORM_DIRS, context);
38 if (result) return { original: ref, targetNodeId: result, confidence: 0.8, resolvedBy: 'framework' };
39 }
40 // ORM dynamic dispatch: QuerySet._fetch_all (and siblings) call
41 // `self._iterable_class(self)` — a runtime dispatch to the iterable class
42 // (default ModelIterable) whose __iter__ runs the SQL compiler. Static
43 // parsing can't resolve an attribute-as-callable, so it leaves an unresolved
44 // `_iterable_class` ref and a hole in the QuerySet→compiler chain. Bridge it
45 // to ModelIterable.__iter__ so the flow actually exists in the graph.
46 if (ref.referenceName === '_iterable_class') {
47 const target = resolveModelIterableIter(context);
48 if (target) return { original: ref, targetNodeId: target, confidence: 0.7, resolvedBy: 'framework' };
49 }
50 return null;
51 },
52
53 // Let two ref shapes past resolveOne's "no possible match" pre-filter so they
54 // reach resolution: the ORM dynamic-dispatch `_iterable_class` (a QuerySet

Callers

nothing calls this directly

Calls 2

resolveModelIterableIterFunction · 0.85
resolveByNameAndKindFunction · 0.70

Tested by

no test coverage detected