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

Class WithStmt

mypy/nodes.py:2153–2183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2151
2152
2153class WithStmt(Statement):
2154 __slots__ = ("expr", "target", "unanalyzed_type", "analyzed_types", "body", "is_async")
2155
2156 __match_args__ = ("expr", "target", "body")
2157
2158 expr: list[Expression]
2159 target: list[Lvalue | None]
2160 # Type given by type comments for target, can be None
2161 unanalyzed_type: mypy.types.Type | None
2162 # Semantically analyzed types from type comment (TypeList type expanded)
2163 analyzed_types: list[mypy.types.Type]
2164 body: Block
2165 is_async: bool # True if `async with ...` (PEP 492, Python 3.5)
2166
2167 def __init__(
2168 self,
2169 expr: list[Expression],
2170 target: list[Lvalue | None],
2171 body: Block,
2172 target_type: mypy.types.Type | None = None,
2173 ) -> None:
2174 super().__init__()
2175 self.expr = expr
2176 self.target = target
2177 self.unanalyzed_type = target_type
2178 self.analyzed_types = []
2179 self.body = body
2180 self.is_async = False
2181
2182 def accept(self, visitor: StatementVisitor[T]) -> T:
2183 return visitor.visit_with_stmt(self)
2184
2185
2186class MatchStmt(Statement):

Callers 4

visit_WithMethod · 0.90
visit_AsyncWithMethod · 0.90
visit_with_stmtMethod · 0.90
read_statementFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…