MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / resolve_qualified

Method resolve_qualified

graphify/extractors/csharp.py:759–781  ·  view source on GitHub ↗
(
        self, label: str, qualifier: object, source_node: dict, source_file: str
    )

Source from the content-addressed store, hash-verified

757 return resolved
758
759 def resolve_qualified(
760 self, label: str, qualifier: object, source_node: dict, source_file: str
761 ) -> str | None:
762 # Sound qualified resolution: an in-scope alias for Q shadows the namespace Q. For a qualified
763 # ref Q.label, look up (alias_target_namespace, label). If no in-scope alias, fall through to an
764 # exact known namespace. Dangle on ambiguity / no hit / unknown qualifier.
765 if not isinstance(qualifier, str) or not qualifier:
766 return None
767 in_scope = [
768 entry for entry in self.aliases_by_file.get(source_file, {}).get(qualifier, [])
769 if self._using_in_scope(entry[1], entry[2], source_node)
770 ]
771 if in_scope:
772 hits = set()
773 for target_fqn, _scope_kind, _scope_id in in_scope:
774 alias_ns = _strip_trailing_csharp_generic_args(html.unescape(target_fqn))
775 hit = self.type_def_index.get((alias_ns, label))
776 if hit:
777 hits.add(hit)
778 return next(iter(hits)) if len(hits) == 1 else None
779 if qualifier in self.known_namespaces:
780 return self.type_def_index.get((qualifier, label))
781 return None
782
783
784def _resolve_csharp_type_references(

Callers 2

resolve_type_nameMethod · 0.95
_resolve_qualifiedFunction · 0.80

Calls 3

_using_in_scopeMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected