MCPcopy Index your code
hub / github.com/python/mypy / CollectAliasesVisitor

Class CollectAliasesVisitor

mypy/types.py:4038–4058  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4036
4037
4038class CollectAliasesVisitor(TypeQuery[list[mypy.nodes.TypeAlias]]):
4039 def __init__(self) -> None:
4040 super().__init__()
4041 self.seen_alias_nodes: set[mypy.nodes.TypeAlias] = set()
4042
4043 def strategy(self, items: list[list[mypy.nodes.TypeAlias]]) -> list[mypy.nodes.TypeAlias]:
4044 out = []
4045 for item in items:
4046 out.extend(item)
4047 return out
4048
4049 def visit_type_alias_type(self, t: TypeAliasType, /) -> list[mypy.nodes.TypeAlias]:
4050 assert t.alias is not None
4051 if t.alias not in self.seen_alias_nodes:
4052 self.seen_alias_nodes.add(t.alias)
4053 res = [t.alias] + t.alias.target.accept(self)
4054 else:
4055 res = []
4056 for arg in t.args:
4057 res.extend(arg.accept(self))
4058 return res
4059
4060
4061def is_named_instance(t: Type, fullnames: str | tuple[str, ...]) -> TypeGuard[Instance]:

Callers 1

is_recursiveMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…