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

Method visit_index_expr

mypy/semanal.py:6197–6213  ·  view source on GitHub ↗
(self, expr: IndexExpr)

Source from the content-addressed store, hash-verified

6195 expr.expr.accept(self)
6196
6197 def visit_index_expr(self, expr: IndexExpr) -> None:
6198 base = expr.base
6199 base.accept(self)
6200 if (
6201 isinstance(base, RefExpr)
6202 and isinstance(base.node, TypeInfo)
6203 and not base.node.is_generic()
6204 ):
6205 expr.index.accept(self)
6206 elif (
6207 isinstance(base, RefExpr) and isinstance(base.node, TypeAlias)
6208 ) or refers_to_class_or_function(base):
6209 # We need to do full processing on every iteration, since some type
6210 # arguments may contain placeholder types.
6211 self.analyze_type_application(expr)
6212 else:
6213 expr.index.accept(self)
6214
6215 def analyze_type_application(self, expr: IndexExpr) -> None:
6216 """Analyze special form -- type application (either direct or via type aliasing)."""

Callers

nothing calls this directly

Calls 5

isinstanceFunction · 0.85
acceptMethod · 0.45
is_genericMethod · 0.45

Tested by

no test coverage detected