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

Function resolve

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

Source from the content-addressed store, hash-verified

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