Look up a target by fully-qualified name. The first item in the return tuple is a list of deferred nodes that needs to be reprocessed. If the target represents a TypeInfo corresponding to a protocol, return it as a second item in the return tuple, otherwise None.
(
manager: BuildManager, target: str, module_id: str
)
| 1097 | |
| 1098 | |
| 1099 | def lookup_target( |
| 1100 | manager: BuildManager, target: str, module_id: str |
| 1101 | ) -> tuple[list[FineGrainedDeferredNode], TypeInfo | None]: |
| 1102 | """Look up a target by fully-qualified name. |
| 1103 | |
| 1104 | The first item in the return tuple is a list of deferred nodes that |
| 1105 | needs to be reprocessed. If the target represents a TypeInfo corresponding |
| 1106 | to a protocol, return it as a second item in the return tuple, otherwise None. |
| 1107 | """ |
| 1108 | deferred, stale_proto = _lookup_target_impl(manager, target) |
| 1109 | |
| 1110 | # If there are function targets that can infer outer variables, they should |
| 1111 | # be re-processed as part of the module top-level instead (for consistency). |
| 1112 | regular = [] |
| 1113 | shared = [] |
| 1114 | for d in deferred: |
| 1115 | if isinstance(d.node, FuncBase) and d.node.def_or_infer_vars: |
| 1116 | shared.append(d) |
| 1117 | else: |
| 1118 | regular.append(d) |
| 1119 | deferred = regular |
| 1120 | if shared: |
| 1121 | deferred.append(FineGrainedDeferredNode(manager.modules[module_id], None)) |
| 1122 | return deferred, stale_proto |
| 1123 | |
| 1124 | |
| 1125 | def _lookup_target_impl( |
no test coverage detected
searching dependent graphs…