Skip to content

Commit 533073e

Browse files
authored
Merge pull request #1025 from asottile/revert-990
revert #990
2 parents 6f01bda + e06e93e commit 533073e

File tree

4 files changed

+4
-29
lines changed

4 files changed

+4
-29
lines changed

pycodestyle.py

-11
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ def lru_cache(maxsize=128): # noqa as it's a fake implementation.
170170
)))
171171
)
172172
DUNDER_REGEX = re.compile(r"^__([^\s]+)__(?::\s*[a-zA-Z.0-9_\[\]\"]+)? = ")
173-
MATCH_CASE_REGEX = re.compile(r'^\s*\b(?:match|case)(\s*)(?=.*\:)')
174173
BLANK_EXCEPT_REGEX = re.compile(r"except\s*:")
175174

176175
_checks = {'physical_line': {}, 'logical_line': {}, 'tree': {}}
@@ -502,16 +501,6 @@ def whitespace_around_keywords(logical_line):
502501
elif len(after) > 1:
503502
yield match.start(2), "E271 multiple spaces after keyword"
504503

505-
if sys.version_info >= (3, 10):
506-
match = MATCH_CASE_REGEX.match(logical_line)
507-
if match:
508-
if match[1] == ' ':
509-
return
510-
if match[1] == '':
511-
yield match.start(1), "E275 missing whitespace after keyword"
512-
else:
513-
yield match.start(1), "E271 multiple spaces after keyword"
514-
515504

516505
@register_check
517506
def missing_whitespace_after_import_keyword(logical_line):

testsuite/E27.py

+2
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@
4242
from importable.module import(e, f)
4343
except ImportError:
4444
pass
45+
#: Okay
46+
matched = {"true": True, "false": False}

testsuite/python3.py

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ def foo(x: int) -> int:
99

1010
# Annotated variables #575
1111
CONST: int = 42
12+
match: int = 42
13+
case: int = 42
1214

1315

1416
class Class:

testsuite/python310.py

-18
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,3 @@
2222
pass
2323
case (0, 1, *_):
2424
pass
25-
#: E271:2:6 E271:3:9 E271:5:9 E271:7:9
26-
var = 1
27-
match var:
28-
case 1:
29-
pass
30-
case 2:
31-
pass
32-
case (
33-
3
34-
):
35-
pass
36-
#: E275:2:6 E275:3:9 E275:5:9
37-
var = 1
38-
match(var):
39-
case(1):
40-
pass
41-
case_:
42-
pass

0 commit comments

Comments
 (0)