-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
internalAn internal refactor or improvementAn internal refactor or improvement
Description
I'm working on a fix for the flake8-unused-arguments (ARG) rules that would delete them.
While working on this, I noticed that the *args and **kwargs Parameter.range does not include the *.
I think that Parameter.range should include * or **, leaving Parameter.name.range for the actual name range if needed.
def f(*args, **kwargs): pass
# ~~~~ ~~~~~~ <-- actual range
# ^^^^^ ^^^^^^^^ <-- expected rangeSee the currently generated AST
Lines 58 to 67 in 7b4a73d
| vararg: Some( | |
| Parameter { | |
| range: 16..20, | |
| name: Identifier { | |
| id: "args", | |
| range: 16..20, | |
| }, | |
| annotation: None, | |
| }, | |
| ), |
Here I would expect the Parameter range to be 1 longer than the Identifier range.
Lines 124 to 134 in 7b4a73d
| kwarg: Some( | |
| Parameter { | |
| range: 39..45, | |
| name: Identifier { | |
| id: "kwargs", | |
| range: 39..45, | |
| }, | |
| annotation: None, | |
| }, | |
| ), | |
| }, |
And here I would expect the Parameter range to be 2 longer than the Identifier range.
If this is indeed considered a bug, I have a PR ready to fix it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
internalAn internal refactor or improvementAn internal refactor or improvement