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

Method visit_Try

mypy/fastparse.py:1367–1382  ·  view source on GitHub ↗
(self, n: ast3.Try)

Source from the content-addressed store, hash-verified

1365
1366 # Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)
1367 def visit_Try(self, n: ast3.Try) -> TryStmt:
1368 vs = [
1369 self.set_line(NameExpr(h.name), h) if h.name is not None else None for h in n.handlers
1370 ]
1371 types = [self.visit(h.type) for h in n.handlers]
1372 handlers = [self.as_required_block(h.body) for h in n.handlers]
1373
1374 node = TryStmt(
1375 self.as_required_block(n.body),
1376 vs,
1377 types,
1378 handlers,
1379 self.as_block(n.orelse),
1380 self.as_block(n.finalbody),
1381 )
1382 return self.set_line(node, n)
1383
1384 def visit_TryStar(self, n: TryStar) -> TryStmt:
1385 vs = [

Callers

nothing calls this directly

Calls 6

set_lineMethod · 0.95
visitMethod · 0.95
as_required_blockMethod · 0.95
as_blockMethod · 0.95
NameExprClass · 0.90
TryStmtClass · 0.90

Tested by

no test coverage detected