Skip to content

Commit 0e0b958

Browse files
authored
Merge pull request #918 from asottile/only_positional
Fix E225 for PEP 570 all positional-only arguments
2 parents a9e8ebc + e7abf26 commit 0e0b958

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

pycodestyle.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,16 @@ def missing_whitespace_around_operator(logical_line, tokens):
863863
# Tolerate the "<>" operator, even if running Python 3
864864
# Deal with Python 3's annotated return value "->"
865865
pass
866-
elif prev_text == '/' and text == ',':
866+
elif (
867+
# def f(a, /, b):
868+
# ^
869+
# def f(a, b, /):
870+
# ^
871+
prev_text == '/' and text in {',', ')'} or
872+
# def f(a, b, /):
873+
# ^
874+
prev_text == ')' and text == ':'
875+
):
867876
# Tolerate the "/" operator in function definition
868877
# For more info see PEP570
869878
pass

testsuite/python38.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#: Okay
2-
def f(a, /, b):
2+
def f1(a, /, b):
3+
pass
4+
5+
6+
def f2(a, b, /):
7+
pass
8+
9+
10+
def f3(
11+
a,
12+
/,
13+
b,
14+
):
315
pass
416
#: Okay
517
if x := 1:

0 commit comments

Comments
 (0)