diff options
author | Anthony Sottile <asottile@umich.edu> | 2021-10-13 12:29:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 12:29:49 -0700 |
commit | abc475ca09949aea9a802598c984bf822eea252f (patch) | |
tree | 11ccde1e06557f14253ae15629026617a510d931 | |
parent | c2ec41377bd6b04653f8dd372b12046e40d96c38 (diff) | |
parent | d17c08b507cbf5428a0ad263a6856ca85e6f205a (diff) | |
download | pep8-abc475ca09949aea9a802598c984bf822eea252f.tar.gz |
Merge pull request #1032 from cdce8p/walrus-multiple-spaces
Emit E221-E224 for walrus op
-rwxr-xr-x | pycodestyle.py | 2 | ||||
-rw-r--r-- | testsuite/python38.py | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/pycodestyle.py b/pycodestyle.py index 16167df..7222907 100755 --- a/pycodestyle.py +++ b/pycodestyle.py @@ -152,7 +152,7 @@ COMPARE_NEGATIVE_REGEX = re.compile(r'\b(?<!is\s)(not)\s+[^][)(}{ ]+\s+' COMPARE_TYPE_REGEX = re.compile(r'(?:[=!]=|is(?:\s+not)?)\s+type(?:s.\w+Type' r'|\s*\(\s*([^)]*[^ )])\s*\))') KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS)) -OPERATOR_REGEX = re.compile(r'(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+)(\s*)') +OPERATOR_REGEX = re.compile(r'(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+|:=)(\s*)') LAMBDA_REGEX = re.compile(r'\blambda\b') HUNK_REGEX = re.compile(r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$') STARTSWITH_DEF_REGEX = re.compile(r'^(async\s+def|def)\b') diff --git a/testsuite/python38.py b/testsuite/python38.py index 1374192..8bf0d4d 100644 --- a/testsuite/python38.py +++ b/testsuite/python38.py @@ -42,3 +42,14 @@ import typing as t all_the_things: t.List[str] = [] import logging +#: E221:1:5 E222:1:9 E221:3:6 +if x := 1: + pass +if (x := 2): + pass +#: E223:1:5 E224:1:8 +if x := 2: + pass +#: E221:1:6 E221:1:19 +if (x := 1) == (y := 2): + pass |