MCPcopy
hub / github.com/opentrace/opentrace / resolving

Function resolving

agent/src/opentrace_agent/pipeline/resolving.py:40–97  ·  view source on GitHub ↗

Resolve call references and derivations using registries.

(
    proc: ProcessingOutput,
    ctx: PipelineContext,
    out: StageResult[PipelineResult],
)

Source from the content-addressed store, hash-verified

38
39
40def resolving(
41 proc: ProcessingOutput,
42 ctx: PipelineContext,
43 out: StageResult[PipelineResult],
44) -> Generator[PipelineEvent, None, None]:
45 """Resolve call references and derivations using registries."""
46 total = len(proc.call_infos) + len(proc.derivation_infos)
47 yield PipelineEvent(
48 kind=EventKind.STAGE_START,
49 phase=Phase.RESOLVING,
50 message=f"Resolving calls from {len(proc.call_infos)} callers, {len(proc.derivation_infos)} derivations",
51 detail=ProgressDetail(current=0, total=total),
52 )
53
54 if ctx.cancelled:
55 return
56
57 resolved_rels = resolve_calls(proc.call_infos, proc.registries)
58 calls_count = len(resolved_rels)
59
60 if resolved_rels:
61 yield PipelineEvent(
62 kind=EventKind.STAGE_PROGRESS,
63 phase=Phase.RESOLVING,
64 message=f"Resolved {calls_count} call relationships",
65 detail=ProgressDetail(current=calls_count, total=total),
66 relationships=resolved_rels,
67 )
68
69 # Resolve derivations
70 derivation_rels = resolve_derivations(proc.derivation_infos, proc.registries)
71 derivations_count = len(derivation_rels)
72
73 if derivation_rels:
74 yield PipelineEvent(
75 kind=EventKind.STAGE_PROGRESS,
76 phase=Phase.RESOLVING,
77 message=f"Resolved {derivations_count} derivation relationships",
78 detail=ProgressDetail(current=calls_count + derivations_count, total=total),
79 relationships=derivation_rels,
80 )
81
82 yield PipelineEvent(
83 kind=EventKind.STAGE_STOP,
84 phase=Phase.RESOLVING,
85 message=f"Resolved {calls_count} calls, {derivations_count} derivations",
86 )
87
88 out.value = PipelineResult(
89 nodes_created=proc.nodes_created,
90 relationships_created=proc.relationships_created + calls_count + derivations_count,
91 files_processed=proc.files_processed,
92 classes_extracted=proc.classes_extracted,
93 functions_extracted=proc.functions_extracted,
94 variables_extracted=proc.variables_extracted,
95 derivations_resolved=derivations_count,
96 errors=proc.errors,
97 )

Callers 4

core_pipelineFunction · 0.90
_run_pipelineFunction · 0.90
corePipelineFunction · 0.85

Calls 5

PipelineEventClass · 0.90
ProgressDetailClass · 0.90
PipelineResultClass · 0.90
resolve_callsFunction · 0.85
resolve_derivationsFunction · 0.85

Tested by 2

_run_pipelineFunction · 0.72