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

Class TryStmt

mypy/nodes.py:2116–2150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2114
2115
2116class TryStmt(Statement):
2117 __slots__ = ("body", "types", "vars", "handlers", "else_body", "finally_body", "is_star")
2118
2119 __match_args__ = ("body", "types", "vars", "handlers", "else_body", "finally_body", "is_star")
2120
2121 body: Block # Try body
2122 # Plain 'except:' also possible
2123 types: list[Expression | None] # Except type expressions
2124 vars: list[NameExpr | None] # Except variable names
2125 handlers: list[Block] # Except bodies
2126 else_body: Block | None
2127 finally_body: Block | None
2128 # Whether this is try ... except* (added in Python 3.11)
2129 is_star: bool
2130
2131 def __init__(
2132 self,
2133 body: Block,
2134 vars: list[NameExpr | None],
2135 types: list[Expression | None],
2136 handlers: list[Block],
2137 else_body: Block | None,
2138 finally_body: Block | None,
2139 ) -> None:
2140 super().__init__()
2141 self.body = body
2142 self.vars = vars
2143 self.types = types
2144 self.handlers = handlers
2145 self.else_body = else_body
2146 self.finally_body = finally_body
2147 self.is_star = False
2148
2149 def accept(self, visitor: StatementVisitor[T]) -> T:
2150 return visitor.visit_try_stmt(self)
2151
2152
2153class WithStmt(Statement):

Callers 4

visit_TryMethod · 0.90
visit_TryStarMethod · 0.90
visit_try_stmtMethod · 0.90
read_try_stmtFunction · 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…