mirror of https://github.com/astral-sh/ruff
299 lines
21 KiB
Plaintext
299 lines
21 KiB
Plaintext
---
|
|
source: parser/src/parser.rs
|
|
expression: parse_ast
|
|
---
|
|
[
|
|
Attributed {
|
|
range: 0..134,
|
|
custom: (),
|
|
node: Try(
|
|
StmtTry {
|
|
body: [
|
|
Attributed {
|
|
range: 9..28,
|
|
custom: (),
|
|
node: Raise(
|
|
StmtRaise {
|
|
exc: Some(
|
|
Attributed {
|
|
range: 15..28,
|
|
custom: (),
|
|
node: Call(
|
|
ExprCall {
|
|
func: Attributed {
|
|
range: 15..25,
|
|
custom: (),
|
|
node: Name(
|
|
ExprName {
|
|
id: "ValueError",
|
|
ctx: Load,
|
|
},
|
|
),
|
|
},
|
|
args: [
|
|
Attributed {
|
|
range: 26..27,
|
|
custom: (),
|
|
node: Constant(
|
|
ExprConstant {
|
|
value: Int(
|
|
1,
|
|
),
|
|
kind: None,
|
|
},
|
|
),
|
|
},
|
|
],
|
|
keywords: [],
|
|
},
|
|
),
|
|
},
|
|
),
|
|
cause: None,
|
|
},
|
|
),
|
|
},
|
|
],
|
|
handlers: [
|
|
Attributed {
|
|
range: 29..82,
|
|
custom: (),
|
|
node: ExceptHandler(
|
|
ExcepthandlerExceptHandler {
|
|
type_: Some(
|
|
Attributed {
|
|
range: 36..45,
|
|
custom: (),
|
|
node: Name(
|
|
ExprName {
|
|
id: "TypeError",
|
|
ctx: Load,
|
|
},
|
|
),
|
|
},
|
|
),
|
|
name: Some(
|
|
"e",
|
|
),
|
|
body: [
|
|
Attributed {
|
|
range: 56..82,
|
|
custom: (),
|
|
node: Expr(
|
|
StmtExpr {
|
|
value: Attributed {
|
|
range: 56..82,
|
|
custom: (),
|
|
node: Call(
|
|
ExprCall {
|
|
func: Attributed {
|
|
range: 56..61,
|
|
custom: (),
|
|
node: Name(
|
|
ExprName {
|
|
id: "print",
|
|
ctx: Load,
|
|
},
|
|
),
|
|
},
|
|
args: [
|
|
Attributed {
|
|
range: 62..81,
|
|
custom: (),
|
|
node: JoinedStr(
|
|
ExprJoinedStr {
|
|
values: [
|
|
Attributed {
|
|
range: 62..81,
|
|
custom: (),
|
|
node: Constant(
|
|
ExprConstant {
|
|
value: Str(
|
|
"caught ",
|
|
),
|
|
kind: None,
|
|
},
|
|
),
|
|
},
|
|
Attributed {
|
|
range: 62..81,
|
|
custom: (),
|
|
node: FormattedValue(
|
|
ExprFormattedValue {
|
|
value: Attributed {
|
|
range: 72..79,
|
|
custom: (),
|
|
node: Call(
|
|
ExprCall {
|
|
func: Attributed {
|
|
range: 72..76,
|
|
custom: (),
|
|
node: Name(
|
|
ExprName {
|
|
id: "type",
|
|
ctx: Load,
|
|
},
|
|
),
|
|
},
|
|
args: [
|
|
Attributed {
|
|
range: 77..78,
|
|
custom: (),
|
|
node: Name(
|
|
ExprName {
|
|
id: "e",
|
|
ctx: Load,
|
|
},
|
|
),
|
|
},
|
|
],
|
|
keywords: [],
|
|
},
|
|
),
|
|
},
|
|
conversion: 0,
|
|
format_spec: None,
|
|
},
|
|
),
|
|
},
|
|
],
|
|
},
|
|
),
|
|
},
|
|
],
|
|
keywords: [],
|
|
},
|
|
),
|
|
},
|
|
},
|
|
),
|
|
},
|
|
],
|
|
},
|
|
),
|
|
},
|
|
Attributed {
|
|
range: 83..134,
|
|
custom: (),
|
|
node: ExceptHandler(
|
|
ExcepthandlerExceptHandler {
|
|
type_: Some(
|
|
Attributed {
|
|
range: 90..97,
|
|
custom: (),
|
|
node: Name(
|
|
ExprName {
|
|
id: "OSError",
|
|
ctx: Load,
|
|
},
|
|
),
|
|
},
|
|
),
|
|
name: Some(
|
|
"e",
|
|
),
|
|
body: [
|
|
Attributed {
|
|
range: 108..134,
|
|
custom: (),
|
|
node: Expr(
|
|
StmtExpr {
|
|
value: Attributed {
|
|
range: 108..134,
|
|
custom: (),
|
|
node: Call(
|
|
ExprCall {
|
|
func: Attributed {
|
|
range: 108..113,
|
|
custom: (),
|
|
node: Name(
|
|
ExprName {
|
|
id: "print",
|
|
ctx: Load,
|
|
},
|
|
),
|
|
},
|
|
args: [
|
|
Attributed {
|
|
range: 114..133,
|
|
custom: (),
|
|
node: JoinedStr(
|
|
ExprJoinedStr {
|
|
values: [
|
|
Attributed {
|
|
range: 114..133,
|
|
custom: (),
|
|
node: Constant(
|
|
ExprConstant {
|
|
value: Str(
|
|
"caught ",
|
|
),
|
|
kind: None,
|
|
},
|
|
),
|
|
},
|
|
Attributed {
|
|
range: 114..133,
|
|
custom: (),
|
|
node: FormattedValue(
|
|
ExprFormattedValue {
|
|
value: Attributed {
|
|
range: 124..131,
|
|
custom: (),
|
|
node: Call(
|
|
ExprCall {
|
|
func: Attributed {
|
|
range: 124..128,
|
|
custom: (),
|
|
node: Name(
|
|
ExprName {
|
|
id: "type",
|
|
ctx: Load,
|
|
},
|
|
),
|
|
},
|
|
args: [
|
|
Attributed {
|
|
range: 129..130,
|
|
custom: (),
|
|
node: Name(
|
|
ExprName {
|
|
id: "e",
|
|
ctx: Load,
|
|
},
|
|
),
|
|
},
|
|
],
|
|
keywords: [],
|
|
},
|
|
),
|
|
},
|
|
conversion: 0,
|
|
format_spec: None,
|
|
},
|
|
),
|
|
},
|
|
],
|
|
},
|
|
),
|
|
},
|
|
],
|
|
keywords: [],
|
|
},
|
|
),
|
|
},
|
|
},
|
|
),
|
|
},
|
|
],
|
|
},
|
|
),
|
|
},
|
|
],
|
|
orelse: [],
|
|
finalbody: [],
|
|
},
|
|
),
|
|
},
|
|
]
|