summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2020-03-23 10:01:28 -0700
committerAnthony Sottile <asottile@umich.edu>2020-03-23 10:02:44 -0700
commite7abf262b6ffb992bf53bb8e33e213d77928d64a (patch)
treed5ebb57f165a7be7e2d008da8e6b266c443e578a
parent19a3925a89c71d422b98363d9ccfa8903a65b707 (diff)
downloadpep8-e7abf262b6ffb992bf53bb8e33e213d77928d64a.tar.gz
Fix E225 for PEP 570 all positional-only arguments
-rwxr-xr-xpycodestyle.py11
-rw-r--r--testsuite/python38.py14
2 files changed, 23 insertions, 2 deletions
diff --git a/pycodestyle.py b/pycodestyle.py
index 235532c..7629429 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -863,7 +863,16 @@ def missing_whitespace_around_operator(logical_line, tokens):
# Tolerate the "<>" operator, even if running Python 3
# Deal with Python 3's annotated return value "->"
pass
- elif prev_text == '/' and text == ',':
+ elif (
+ # def f(a, /, b):
+ # ^
+ # def f(a, b, /):
+ # ^
+ prev_text == '/' and text in {',', ')'} or
+ # def f(a, b, /):
+ # ^
+ prev_text == ')' and text == ':'
+ ):
# Tolerate the "/" operator in function definition
# For more info see PEP570
pass
diff --git a/testsuite/python38.py b/testsuite/python38.py
index 5f62a3f..57ee613 100644
--- a/testsuite/python38.py
+++ b/testsuite/python38.py
@@ -1,5 +1,17 @@
#: Okay
-def f(a, /, b):
+def f1(a, /, b):
+ pass
+
+
+def f2(a, b, /):
+ pass
+
+
+def f3(
+ a,
+ /,
+ b,
+):
pass
#: Okay
if x := 1: