Index expression x[y]. Also wraps type application such as List[int] as a special form.
| 2574 | |
| 2575 | |
| 2576 | class IndexExpr(Expression): |
| 2577 | """Index expression x[y]. |
| 2578 | |
| 2579 | Also wraps type application such as List[int] as a special form. |
| 2580 | """ |
| 2581 | |
| 2582 | __slots__ = ("base", "index", "method_type", "analyzed", "as_type") |
| 2583 | |
| 2584 | __match_args__ = ("base", "index") |
| 2585 | |
| 2586 | base: Expression |
| 2587 | index: Expression |
| 2588 | # Inferred __getitem__ method type |
| 2589 | method_type: mypy.types.Type | None |
| 2590 | # If not None, this is actually semantically a type application |
| 2591 | # Class[type, ...] or a type alias initializer. |
| 2592 | analyzed: TypeApplication | TypeAliasExpr | None |
| 2593 | # If this value expression can also be parsed as a valid type expression, |
| 2594 | # represents the type denoted by the type expression. |
| 2595 | # None means "is not a type expression". |
| 2596 | as_type: NotParsed | mypy.types.Type | None |
| 2597 | |
| 2598 | def __init__(self, base: Expression, index: Expression) -> None: |
| 2599 | super().__init__() |
| 2600 | self.base = base |
| 2601 | self.index = index |
| 2602 | self.method_type = None |
| 2603 | self.analyzed = None |
| 2604 | self.as_type = NotParsed.VALUE |
| 2605 | |
| 2606 | def accept(self, visitor: ExpressionVisitor[T]) -> T: |
| 2607 | return visitor.visit_index_expr(self) |
| 2608 | |
| 2609 | |
| 2610 | class UnaryExpr(Expression): |
no outgoing calls
no test coverage detected
searching dependent graphs…