[syntax-errors] Starred expressions in return, yield, and for (#17134)

Summary
--

Fixes https://github.com/astral-sh/ruff/issues/16520 by flagging single,
starred expressions in `return`, `yield`, and
`for` statements.

I thought `yield from` would also be included here, but that error is
emitted by
the CPython parser:

```pycon
>>> ast.parse("def f(): yield from *x")
Traceback (most recent call last):
  File "<python-input-214>", line 1, in <module>
    ast.parse("def f(): yield from *x")
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/ast.py", line 54, in parse
    return compile(source, filename, mode, flags,
                   _feature_version=feature_version, optimize=optimize)
  File "<unknown>", line 1
    def f(): yield from *x
                        ^
SyntaxError: invalid syntax
```

And we also already catch it in our parser.

Test Plan
--

New inline tests and updates to existing tests.
This commit is contained in:
Brent Westbrook 2025-04-02 08:38:25 -04:00 committed by GitHub
parent 2ae39edccf
commit d45593288f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 679 additions and 435 deletions

View file

@ -111,3 +111,14 @@ Module(
4 | yield *x and y, z
| ^^^^^^^ Syntax Error: Boolean expression cannot be used here
|
## Semantic Syntax Errors
|
1 | # Cannot use starred expression here
2 | yield (*x)
| ^^ Syntax Error: can't use starred expression here
3 |
4 | yield *x and y, z
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/for_stmt_invalid_iter_expr.py
snapshot_kind: text
---
## AST
@ -182,3 +181,13 @@ Module(
3 | for target in x := 1: ...
| ^ Syntax Error: Invalid annotated assignment target
|
## Semantic Syntax Errors
|
1 | for x in *a and b: ...
| ^^^^^^^^ Syntax Error: can't use starred expression here
2 | for x in yield a: ...
3 | for target in x := 1: ...
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/for_stmt_invalid_target.py
snapshot_kind: text
---
## AST
@ -462,3 +461,25 @@ Module(
7 | for [x, 1, y, *["a"]] in z: ...
| ^^^ Syntax Error: Invalid assignment target
|
## Semantic Syntax Errors
|
1 | for 1 in x: ...
2 | for "a" in x: ...
3 | for *x and y in z: ...
| ^^^^^^^^ Syntax Error: can't use starred expression here
4 | for *x | y in z: ...
5 | for await x in z: ...
|
|
2 | for "a" in x: ...
3 | for *x and y in z: ...
4 | for *x | y in z: ...
| ^^^^^^ Syntax Error: can't use starred expression here
5 | for await x in z: ...
6 | for yield x in y: ...
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/return_stmt_invalid_expr.py
snapshot_kind: text
---
## AST
@ -181,3 +180,21 @@ Module(
5 | return *x and y
| ^^^^^^^ Syntax Error: Boolean expression cannot be used here
|
## Semantic Syntax Errors
|
1 | return *
| ^ Syntax Error: can't use starred expression here
2 | return yield x
3 | return yield from x
|
|
3 | return yield from x
4 | return x := 1
5 | return *x and y
| ^^^^^^^^ Syntax Error: can't use starred expression here
|

View file

@ -0,0 +1,107 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/single_star_for.py
---
## AST
```
Module(
ModModule {
range: 0..35,
body: [
For(
StmtFor {
range: 0..16,
is_async: false,
target: Name(
ExprName {
range: 4..5,
id: Name("_"),
ctx: Store,
},
),
iter: Starred(
ExprStarred {
range: 9..11,
value: Name(
ExprName {
range: 10..11,
id: Name("x"),
ctx: Load,
},
),
ctx: Load,
},
),
body: [
Expr(
StmtExpr {
range: 13..16,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 13..16,
},
),
},
),
],
orelse: [],
},
),
For(
StmtFor {
range: 17..34,
is_async: false,
target: Starred(
ExprStarred {
range: 21..23,
value: Name(
ExprName {
range: 22..23,
id: Name("x"),
ctx: Store,
},
),
ctx: Store,
},
),
iter: Name(
ExprName {
range: 27..29,
id: Name("xs"),
ctx: Load,
},
),
body: [
Expr(
StmtExpr {
range: 31..34,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 31..34,
},
),
},
),
],
orelse: [],
},
),
],
},
)
```
## Semantic Syntax Errors
|
1 | for _ in *x: ...
| ^^ Syntax Error: can't use starred expression here
2 | for *x in xs: ...
|
|
1 | for _ in *x: ...
2 | for *x in xs: ...
| ^^ Syntax Error: can't use starred expression here
|

View file

@ -0,0 +1,64 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/single_star_return.py
---
## AST
```
Module(
ModModule {
range: 0..19,
body: [
FunctionDef(
StmtFunctionDef {
range: 0..18,
is_async: false,
decorator_list: [],
name: Identifier {
id: Name("f"),
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..7,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Return(
StmtReturn {
range: 9..18,
value: Some(
Starred(
ExprStarred {
range: 16..18,
value: Name(
ExprName {
range: 17..18,
id: Name("x"),
ctx: Load,
},
),
ctx: Load,
},
),
),
},
),
],
},
),
],
},
)
```
## Semantic Syntax Errors
|
1 | def f(): return *x
| ^^ Syntax Error: can't use starred expression here
|

View file

@ -0,0 +1,69 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/single_star_yield.py
---
## AST
```
Module(
ModModule {
range: 0..18,
body: [
FunctionDef(
StmtFunctionDef {
range: 0..17,
is_async: false,
decorator_list: [],
name: Identifier {
id: Name("f"),
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..7,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Expr(
StmtExpr {
range: 9..17,
value: Yield(
ExprYield {
range: 9..17,
value: Some(
Starred(
ExprStarred {
range: 15..17,
value: Name(
ExprName {
range: 16..17,
id: Name("x"),
ctx: Load,
},
),
ctx: Load,
},
),
),
},
),
},
),
],
},
),
],
},
)
```
## Semantic Syntax Errors
|
1 | def f(): yield *x
| ^^ Syntax Error: can't use starred expression here
|

View file

@ -1,14 +1,13 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/valid/expressions/yield.py
snapshot_kind: text
---
## AST
```
Module(
ModModule {
range: 0..188,
range: 0..166,
body: [
Expr(
StmtExpr {
@ -385,53 +384,28 @@ Module(
),
Expr(
StmtExpr {
range: 144..152,
range: 144..155,
value: Yield(
ExprYield {
range: 144..152,
value: Some(
Starred(
ExprStarred {
range: 150..152,
value: Name(
ExprName {
range: 151..152,
id: Name("y"),
ctx: Load,
},
),
ctx: Load,
},
),
),
},
),
},
),
Expr(
StmtExpr {
range: 153..164,
value: Yield(
ExprYield {
range: 153..164,
range: 144..155,
value: Some(
Tuple(
ExprTuple {
range: 159..164,
range: 150..155,
elts: [
Name(
ExprName {
range: 159..160,
range: 150..151,
id: Name("x"),
ctx: Load,
},
),
Starred(
ExprStarred {
range: 162..164,
range: 153..155,
value: Name(
ExprName {
range: 163..164,
range: 154..155,
id: Name("y"),
ctx: Load,
},
@ -451,21 +425,21 @@ Module(
),
Expr(
StmtExpr {
range: 165..174,
range: 156..165,
value: Yield(
ExprYield {
range: 165..174,
range: 156..165,
value: Some(
Tuple(
ExprTuple {
range: 171..174,
range: 162..165,
elts: [
Starred(
ExprStarred {
range: 171..173,
range: 162..164,
value: Name(
ExprName {
range: 172..173,
range: 163..164,
id: Name("x"),
ctx: Load,
},
@ -483,44 +457,6 @@ Module(
),
},
),
Expr(
StmtExpr {
range: 175..187,
value: Yield(
ExprYield {
range: 175..187,
value: Some(
Starred(
ExprStarred {
range: 181..187,
value: BinOp(
ExprBinOp {
range: 182..187,
left: Name(
ExprName {
range: 182..183,
id: Name("x"),
ctx: Load,
},
),
op: BitOr,
right: Name(
ExprName {
range: 186..187,
id: Name("y"),
ctx: Load,
},
),
},
),
ctx: Load,
},
),
),
},
),
},
),
],
},
)

View file

@ -0,0 +1,220 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/ok/single_star_in_tuple.py
---
## AST
```
Module(
ModModule {
range: 0..84,
body: [
FunctionDef(
StmtFunctionDef {
range: 0..20,
is_async: false,
decorator_list: [],
name: Identifier {
id: Name("f"),
range: 4..5,
},
type_params: None,
parameters: Parameters {
range: 5..7,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Expr(
StmtExpr {
range: 9..20,
value: Yield(
ExprYield {
range: 9..20,
value: Some(
Tuple(
ExprTuple {
range: 15..20,
elts: [
Starred(
ExprStarred {
range: 16..18,
value: Name(
ExprName {
range: 17..18,
id: Name("x"),
ctx: Load,
},
),
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
),
},
),
},
),
],
},
),
FunctionDef(
StmtFunctionDef {
range: 21..42,
is_async: false,
decorator_list: [],
name: Identifier {
id: Name("f"),
range: 25..26,
},
type_params: None,
parameters: Parameters {
range: 26..28,
posonlyargs: [],
args: [],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
returns: None,
body: [
Return(
StmtReturn {
range: 30..42,
value: Some(
Tuple(
ExprTuple {
range: 37..42,
elts: [
Starred(
ExprStarred {
range: 38..40,
value: Name(
ExprName {
range: 39..40,
id: Name("x"),
ctx: Load,
},
),
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
),
},
),
],
},
),
For(
StmtFor {
range: 43..62,
is_async: false,
target: Name(
ExprName {
range: 47..48,
id: Name("_"),
ctx: Store,
},
),
iter: Tuple(
ExprTuple {
range: 52..57,
elts: [
Starred(
ExprStarred {
range: 53..55,
value: Name(
ExprName {
range: 54..55,
id: Name("x"),
ctx: Load,
},
),
ctx: Load,
},
),
],
ctx: Load,
parenthesized: true,
},
),
body: [
Expr(
StmtExpr {
range: 59..62,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 59..62,
},
),
},
),
],
orelse: [],
},
),
For(
StmtFor {
range: 63..83,
is_async: false,
target: Tuple(
ExprTuple {
range: 67..72,
elts: [
Starred(
ExprStarred {
range: 68..70,
value: Name(
ExprName {
range: 69..70,
id: Name("x"),
ctx: Store,
},
),
ctx: Store,
},
),
],
ctx: Store,
parenthesized: true,
},
),
iter: Name(
ExprName {
range: 76..78,
id: Name("xs"),
ctx: Load,
},
),
body: [
Expr(
StmtExpr {
range: 80..83,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 80..83,
},
),
},
),
],
orelse: [],
},
),
],
},
)
```

View file

@ -1,14 +1,13 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/valid/statement/for.py
snapshot_kind: text
---
## AST
```
Module(
ModModule {
range: 0..660,
range: 0..523,
body: [
For(
StmtFor {
@ -377,7 +376,7 @@ Module(
),
For(
StmtFor {
range: 264..295,
range: 264..294,
is_async: false,
target: Name(
ExprName {
@ -386,57 +385,13 @@ Module(
ctx: Store,
},
),
iter: Starred(
ExprStarred {
range: 278..285,
value: Attribute(
ExprAttribute {
range: 279..285,
value: Name(
ExprName {
range: 279..280,
id: Name("x"),
ctx: Load,
},
),
attr: Identifier {
id: Name("attr"),
range: 281..285,
},
ctx: Load,
},
),
ctx: Load,
},
),
body: [
Pass(
StmtPass {
range: 291..295,
},
),
],
orelse: [],
},
),
For(
StmtFor {
range: 297..327,
is_async: false,
target: Name(
ExprName {
range: 301..307,
id: Name("target"),
ctx: Store,
},
),
iter: List(
ExprList {
range: 311..317,
range: 278..284,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 312..313,
range: 279..280,
value: Int(
1,
),
@ -444,7 +399,7 @@ Module(
),
NumberLiteral(
ExprNumberLiteral {
range: 315..316,
range: 282..283,
value: Int(
2,
),
@ -457,7 +412,7 @@ Module(
body: [
Pass(
StmtPass {
range: 323..327,
range: 290..294,
},
),
],
@ -466,180 +421,21 @@ Module(
),
For(
StmtFor {
range: 329..377,
is_async: false,
target: Starred(
ExprStarred {
range: 333..340,
value: Name(
ExprName {
range: 334..340,
id: Name("target"),
ctx: Store,
},
),
ctx: Store,
},
),
iter: Tuple(
ExprTuple {
range: 344..352,
elts: [
Name(
ExprName {
range: 344..345,
id: Name("a"),
ctx: Load,
},
),
Name(
ExprName {
range: 347..348,
id: Name("b"),
ctx: Load,
},
),
Name(
ExprName {
range: 350..351,
id: Name("c"),
ctx: Load,
},
),
],
ctx: Load,
parenthesized: false,
},
),
body: [
Pass(
StmtPass {
range: 358..362,
},
),
],
orelse: [
Pass(
StmtPass {
range: 373..377,
},
),
],
},
),
For(
StmtFor {
range: 379..404,
range: 296..322,
is_async: false,
target: Name(
ExprName {
range: 383..389,
id: Name("target"),
ctx: Store,
},
),
iter: Starred(
ExprStarred {
range: 393..399,
value: BinOp(
ExprBinOp {
range: 394..399,
left: Name(
ExprName {
range: 394..395,
id: Name("x"),
ctx: Load,
},
),
op: BitOr,
right: Name(
ExprName {
range: 398..399,
id: Name("y"),
ctx: Load,
},
),
},
),
ctx: Load,
},
),
body: [
Expr(
StmtExpr {
range: 401..404,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 401..404,
},
),
},
),
],
orelse: [],
},
),
For(
StmtFor {
range: 405..432,
is_async: false,
target: Name(
ExprName {
range: 409..415,
id: Name("target"),
ctx: Store,
},
),
iter: Starred(
ExprStarred {
range: 419..427,
value: Await(
ExprAwait {
range: 420..427,
value: Name(
ExprName {
range: 426..427,
id: Name("x"),
ctx: Load,
},
),
},
),
ctx: Load,
},
),
body: [
Expr(
StmtExpr {
range: 429..432,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 429..432,
},
),
},
),
],
orelse: [],
},
),
For(
StmtFor {
range: 433..459,
is_async: false,
target: Name(
ExprName {
range: 437..443,
range: 300..306,
id: Name("target"),
ctx: Store,
},
),
iter: Await(
ExprAwait {
range: 447..454,
range: 310..317,
value: Name(
ExprName {
range: 453..454,
range: 316..317,
id: Name("x"),
ctx: Load,
},
@ -649,10 +445,10 @@ Module(
body: [
Expr(
StmtExpr {
range: 456..459,
range: 319..322,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 456..459,
range: 319..322,
},
),
},
@ -663,30 +459,30 @@ Module(
),
For(
StmtFor {
range: 460..490,
range: 323..353,
is_async: false,
target: Name(
ExprName {
range: 464..470,
range: 327..333,
id: Name("target"),
ctx: Store,
},
),
iter: Lambda(
ExprLambda {
range: 474..485,
range: 337..348,
parameters: Some(
Parameters {
range: 481..482,
range: 344..345,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 481..482,
range: 344..345,
parameter: Parameter {
range: 481..482,
range: 344..345,
name: Identifier {
id: Name("x"),
range: 481..482,
range: 344..345,
},
annotation: None,
},
@ -700,7 +496,7 @@ Module(
),
body: Name(
ExprName {
range: 484..485,
range: 347..348,
id: Name("x"),
ctx: Load,
},
@ -710,10 +506,10 @@ Module(
body: [
Expr(
StmtExpr {
range: 487..490,
range: 350..353,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 487..490,
range: 350..353,
},
),
},
@ -724,34 +520,34 @@ Module(
),
For(
StmtFor {
range: 491..526,
range: 354..389,
is_async: false,
target: Name(
ExprName {
range: 495..501,
range: 358..364,
id: Name("target"),
ctx: Store,
},
),
iter: If(
ExprIf {
range: 505..521,
range: 368..384,
test: BooleanLiteral(
ExprBooleanLiteral {
range: 510..514,
range: 373..377,
value: true,
},
),
body: Name(
ExprName {
range: 505..506,
range: 368..369,
id: Name("x"),
ctx: Load,
},
),
orelse: Name(
ExprName {
range: 520..521,
range: 383..384,
id: Name("y"),
ctx: Load,
},
@ -761,10 +557,10 @@ Module(
body: [
Expr(
StmtExpr {
range: 523..526,
range: 386..389,
value: EllipsisLiteral(
ExprEllipsisLiteral {
range: 523..526,
range: 386..389,
},
),
},
@ -775,10 +571,10 @@ Module(
),
If(
StmtIf {
range: 528..659,
range: 391..522,
test: Name(
ExprName {
range: 531..532,
range: 394..395,
id: Name("x"),
ctx: Load,
},
@ -786,18 +582,18 @@ Module(
body: [
For(
StmtFor {
range: 538..570,
range: 401..433,
is_async: false,
target: Name(
ExprName {
range: 542..548,
range: 405..411,
id: Name("target"),
ctx: Store,
},
),
iter: Name(
ExprName {
range: 552..556,
range: 415..419,
id: Name("iter"),
ctx: Load,
},
@ -805,7 +601,7 @@ Module(
body: [
Pass(
StmtPass {
range: 566..570,
range: 429..433,
},
),
],
@ -815,12 +611,12 @@ Module(
],
elif_else_clauses: [
ElifElseClause {
range: 645..659,
range: 508..522,
test: None,
body: [
Pass(
StmtPass {
range: 655..659,
range: 518..522,
},
),
],

View file

@ -1,14 +1,13 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/valid/statement/return.py
snapshot_kind: text
---
## AST
```
Module(
ModModule {
range: 0..191,
range: 0..167,
body: [
Return(
StmtReturn {
@ -32,71 +31,18 @@ Module(
),
Return(
StmtReturn {
range: 16..25,
value: Some(
Starred(
ExprStarred {
range: 23..25,
value: Name(
ExprName {
range: 24..25,
id: Name("x"),
ctx: Load,
},
),
ctx: Load,
},
),
),
},
),
Return(
StmtReturn {
range: 26..39,
value: Some(
Starred(
ExprStarred {
range: 33..39,
value: BinOp(
ExprBinOp {
range: 34..39,
left: Name(
ExprName {
range: 34..35,
id: Name("x"),
ctx: Load,
},
),
op: BitOr,
right: Name(
ExprName {
range: 38..39,
id: Name("y"),
ctx: Load,
},
),
},
),
ctx: Load,
},
),
),
},
),
Return(
StmtReturn {
range: 40..53,
range: 16..29,
value: Some(
Tuple(
ExprTuple {
range: 47..53,
range: 23..29,
elts: [
Starred(
ExprStarred {
range: 47..49,
range: 23..25,
value: Name(
ExprName {
range: 48..49,
range: 24..25,
id: Name("x"),
ctx: Load,
},
@ -106,10 +52,10 @@ Module(
),
Starred(
ExprStarred {
range: 51..53,
range: 27..29,
value: Name(
ExprName {
range: 52..53,
range: 28..29,
id: Name("y"),
ctx: Load,
},
@ -127,21 +73,21 @@ Module(
),
Return(
StmtReturn {
range: 54..69,
range: 30..45,
value: Some(
Named(
ExprNamed {
range: 62..68,
range: 38..44,
target: Name(
ExprName {
range: 62..63,
range: 38..39,
id: Name("x"),
ctx: Store,
},
),
value: NumberLiteral(
ExprNumberLiteral {
range: 67..68,
range: 43..44,
value: Int(
1,
),
@ -154,11 +100,11 @@ Module(
),
Return(
StmtReturn {
range: 70..81,
range: 46..57,
value: Some(
NoneLiteral(
ExprNoneLiteral {
range: 77..81,
range: 53..57,
},
),
),
@ -166,23 +112,23 @@ Module(
),
Return(
StmtReturn {
range: 82..96,
range: 58..72,
value: Some(
BoolOp(
ExprBoolOp {
range: 89..96,
range: 65..72,
op: And,
values: [
Name(
ExprName {
range: 89..90,
range: 65..66,
id: Name("x"),
ctx: Load,
},
),
Name(
ExprName {
range: 95..96,
range: 71..72,
id: Name("y"),
ctx: Load,
},
@ -195,14 +141,14 @@ Module(
),
Return(
StmtReturn {
range: 97..109,
range: 73..85,
value: Some(
Compare(
ExprCompare {
range: 104..109,
range: 80..85,
left: NumberLiteral(
ExprNumberLiteral {
range: 104..105,
range: 80..81,
value: Int(
1,
),
@ -214,7 +160,7 @@ Module(
comparators: [
NumberLiteral(
ExprNumberLiteral {
range: 108..109,
range: 84..85,
value: Int(
2,
),
@ -228,15 +174,15 @@ Module(
),
Return(
StmtReturn {
range: 110..122,
range: 86..98,
value: Some(
Tuple(
ExprTuple {
range: 117..122,
range: 93..98,
elts: [
NumberLiteral(
ExprNumberLiteral {
range: 117..118,
range: 93..94,
value: Int(
1,
),
@ -244,7 +190,7 @@ Module(
),
NumberLiteral(
ExprNumberLiteral {
range: 120..121,
range: 96..97,
value: Int(
2,
),
@ -260,20 +206,20 @@ Module(
),
Return(
StmtReturn {
range: 123..136,
range: 99..112,
value: Some(
Call(
ExprCall {
range: 130..136,
range: 106..112,
func: Name(
ExprName {
range: 130..134,
range: 106..110,
id: Name("call"),
ctx: Load,
},
),
arguments: Arguments {
range: 134..136,
range: 110..112,
args: [],
keywords: [],
},
@ -284,30 +230,30 @@ Module(
),
Return(
StmtReturn {
range: 137..156,
range: 113..132,
value: Some(
Call(
ExprCall {
range: 144..156,
range: 120..132,
func: Attribute(
ExprAttribute {
range: 144..154,
range: 120..130,
value: Name(
ExprName {
range: 144..148,
range: 120..124,
id: Name("attr"),
ctx: Load,
},
),
attr: Identifier {
id: Name("value"),
range: 149..154,
range: 125..130,
},
ctx: Load,
},
),
arguments: Arguments {
range: 154..156,
range: 130..132,
args: [],
keywords: [],
},
@ -318,14 +264,14 @@ Module(
),
Return(
StmtReturn {
range: 157..171,
range: 133..147,
value: Some(
Await(
ExprAwait {
range: 164..171,
range: 140..147,
value: Name(
ExprName {
range: 170..171,
range: 146..147,
id: Name("x"),
ctx: Load,
},
@ -337,23 +283,23 @@ Module(
),
Return(
StmtReturn {
range: 172..190,
range: 148..166,
value: Some(
Lambda(
ExprLambda {
range: 179..190,
range: 155..166,
parameters: Some(
Parameters {
range: 186..187,
range: 162..163,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 186..187,
range: 162..163,
parameter: Parameter {
range: 186..187,
range: 162..163,
name: Identifier {
id: Name("x"),
range: 186..187,
range: 162..163,
},
annotation: None,
},
@ -367,7 +313,7 @@ Module(
),
body: Name(
ExprName {
range: 189..190,
range: 165..166,
id: Name("y"),
ctx: Load,
},