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

Method analyze_unbound_tvar_impl

mypy/semanal.py:2419–2443  ·  view source on GitHub ↗
(
        self, t: UnboundType, is_unpacked: bool = False, is_typealias_param: bool = False
    )

Source from the content-addressed store, hash-verified

2417 return None
2418
2419 def analyze_unbound_tvar_impl(
2420 self, t: UnboundType, is_unpacked: bool = False, is_typealias_param: bool = False
2421 ) -> tuple[str, TypeVarLikeExpr] | None:
2422 assert not is_unpacked or not is_typealias_param, "Mutually exclusive conditions"
2423 sym = self.lookup_qualified(t.name, t)
2424 if sym and isinstance(sym.node, PlaceholderNode):
2425 self.record_incomplete_ref()
2426 if not is_unpacked and sym and isinstance(sym.node, ParamSpecExpr):
2427 if sym.fullname and not self.tvar_scope.allow_binding(sym.fullname):
2428 # It's bound by our type variable scope
2429 return None
2430 return t.name, sym.node
2431 if (is_unpacked or is_typealias_param) and sym and isinstance(sym.node, TypeVarTupleExpr):
2432 if sym.fullname and not self.tvar_scope.allow_binding(sym.fullname):
2433 # It's bound by our type variable scope
2434 return None
2435 return t.name, sym.node
2436 if sym is None or not isinstance(sym.node, TypeVarExpr) or is_unpacked:
2437 return None
2438 elif sym.fullname and not self.tvar_scope.allow_binding(sym.fullname):
2439 # It's bound by our type variable scope
2440 return None
2441 else:
2442 assert isinstance(sym.node, TypeVarExpr)
2443 return t.name, sym.node
2444
2445 def find_type_var_likes(self, t: Type) -> TypeVarLikeList:
2446 visitor = FindTypeVarVisitor(self, self.tvar_scope)

Callers 2

analyze_unbound_tvarMethod · 0.95

Calls 4

lookup_qualifiedMethod · 0.95
record_incomplete_refMethod · 0.95
isinstanceFunction · 0.85
allow_bindingMethod · 0.80

Tested by

no test coverage detected