MCPcopy Create free account
hub / github.com/astral-sh/ruff / unparse_except_handler

Method unparse_except_handler

crates/ruff_python_codegen/src/generator.rs:742–767  ·  view source on GitHub ↗
(&mut self, ast: &ExceptHandler, star: bool)

Source from the content-addressed store, hash-verified

740 }
741
742 fn unparse_except_handler(&mut self, ast: &ExceptHandler, star: bool) {
743 match ast {
744 ExceptHandler::ExceptHandler(ast::ExceptHandlerExceptHandler {
745 type_,
746 name,
747 body,
748 range: _,
749 node_index: _,
750 }) => {
751 self.p("except");
752 if star {
753 self.p("*");
754 }
755 if let Some(type_) = type_ {
756 self.p(" ");
757 self.unparse_expr(type_, precedence::MAX);
758 }
759 if let Some(name) = name {
760 self.p(" as ");
761 self.p_id(name);
762 }
763 self.p(":");
764 self.body(body);
765 }
766 }
767 }
768
769 fn unparse_pattern(&mut self, ast: &Pattern) {
770 match ast {

Callers

nothing calls this directly

Calls 4

pMethod · 0.80
p_idMethod · 0.80
unparse_exprMethod · 0.45
bodyMethod · 0.45

Tested by

no test coverage detected