Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support PEP-570 (positional only arguments) (#946)
Code using positional only arguments is considered >= 3.8
- Loading branch information
Showing
4 changed files
with
120 additions
and
11 deletions.
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
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
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,44 @@ | ||
def positional_only_arg(a, /): | ||
pass | ||
|
||
|
||
def all_markers(a, b, /, c, d, *, e, f): | ||
pass | ||
|
||
|
||
def all_markers_with_args_and_kwargs( | ||
a_long_one, | ||
b_long_one, | ||
/, | ||
c_long_one, | ||
d_long_one, | ||
*args, | ||
e_long_one, | ||
f_long_one, | ||
**kwargs, | ||
): | ||
pass | ||
|
||
|
||
def all_markers_with_defaults(a, b=1, /, c=2, d=3, *, e=4, f=5): | ||
pass | ||
|
||
|
||
def long_one_with_long_parameter_names( | ||
but_all_of_them, | ||
are_positional_only, | ||
arguments_mmmmkay, | ||
so_this_is_only_valid_after, | ||
three_point_eight, | ||
/, | ||
): | ||
pass | ||
|
||
|
||
lambda a, /: a | ||
|
||
lambda a, b, /, c, d, *, e, f: a | ||
|
||
lambda a, b, /, c, d, *args, e, f, **kwargs: args | ||
|
||
lambda a, b=1, /, c=2, d=3, *, e=4, f=5: 1 |
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