-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix false positive for ``keyword-arg-before-vararg`` when a positional-only parameter with a default value precedes ``*args``. Closes #8570 (cherry picked from commit 56fa5dc) Co-authored-by: Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com>
- Loading branch information
1 parent
16fe498
commit ec96bdc
Showing
5 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Fix false positive for ``keyword-arg-before-vararg`` when a positional-only parameter with a default value precedes ``*args``. | ||
|
||
Closes #8570 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/functional/k/keyword_arg_before_vararg_positional_only.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Test `keyword-arg-before-vararg` in the context of positional-only parameters""" | ||
|
||
# pylint: disable=missing-function-docstring, unused-argument | ||
|
||
|
||
def name1(param1, /, param2=True, *args): ... # [keyword-arg-before-vararg] | ||
def name2(param1=True, /, param2=True, *args): ... # [keyword-arg-before-vararg] | ||
def name3(param1, param2=True, /, param3=True, *args): ... # [keyword-arg-before-vararg] | ||
def name4(param1, /, *args): ... | ||
def name5(param1=True, /, *args): ... | ||
def name6(param1, /, *args, param2=True): ... | ||
def name7(param1=True, /, *args, param2=True): ... | ||
def name8(param1, param2=True, /, *args, param3=True): ... |
2 changes: 2 additions & 0 deletions
2
tests/functional/k/keyword_arg_before_vararg_positional_only.rc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[testoptions] | ||
min_pyver=3.8 |
3 changes: 3 additions & 0 deletions
3
tests/functional/k/keyword_arg_before_vararg_positional_only.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
keyword-arg-before-vararg:6:0:6:9:name1:Keyword argument before variable positional arguments list in the definition of name1 function:UNDEFINED | ||
keyword-arg-before-vararg:7:0:7:9:name2:Keyword argument before variable positional arguments list in the definition of name2 function:UNDEFINED | ||
keyword-arg-before-vararg:8:0:8:9:name3:Keyword argument before variable positional arguments list in the definition of name3 function:UNDEFINED |