MCPcopy Create free account
hub / github.com/python/mypy / named_type

Method named_type

mypy/semanal.py:6962–6970  ·  view source on GitHub ↗
(self, fullname: str, args: list[Type] | None = None)

Source from the content-addressed store, hash-verified

6960 return self._function_type
6961
6962 def named_type(self, fullname: str, args: list[Type] | None = None) -> Instance:
6963 sym = self.lookup_fully_qualified(fullname)
6964 assert sym, "Internal error: attempted to construct unknown type"
6965 node = sym.node
6966 assert isinstance(node, TypeInfo), node
6967 if args:
6968 # TODO: assert len(args) == len(node.defn.type_vars)
6969 return Instance(node, args)
6970 return Instance(node, [AnyType(TypeOfAny.special_form)] * len(node.defn.type_vars))
6971
6972 def named_type_or_none(self, fullname: str, args: list[Type] | None = None) -> Instance | None:
6973 sym = self.lookup_fully_qualified_or_none(fullname)

Callers 7

analyze_type_paramMethod · 0.95
object_typeMethod · 0.95
str_typeMethod · 0.95
function_typeMethod · 0.95
builtin_typeMethod · 0.95

Calls 5

InstanceClass · 0.90
AnyTypeClass · 0.90
isinstanceFunction · 0.85
lenFunction · 0.85

Tested by

no test coverage detected