Skip to content

Commit

Permalink
Merge pull request #1025 from asottile/revert-990
Browse files Browse the repository at this point in the history
revert #990
  • Loading branch information
sigmavirus24 committed Oct 6, 2021
2 parents 6f01bda + e06e93e commit 533073e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 29 deletions.
11 changes: 0 additions & 11 deletions pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ def lru_cache(maxsize=128): # noqa as it's a fake implementation.
)))
)
DUNDER_REGEX = re.compile(r"^__([^\s]+)__(?::\s*[a-zA-Z.0-9_\[\]\"]+)? = ")
MATCH_CASE_REGEX = re.compile(r'^\s*\b(?:match|case)(\s*)(?=.*\:)')
BLANK_EXCEPT_REGEX = re.compile(r"except\s*:")

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

if sys.version_info >= (3, 10):
match = MATCH_CASE_REGEX.match(logical_line)
if match:
if match[1] == ' ':
return
if match[1] == '':
yield match.start(1), "E275 missing whitespace after keyword"
else:
yield match.start(1), "E271 multiple spaces after keyword"


@register_check
def missing_whitespace_after_import_keyword(logical_line):
Expand Down
2 changes: 2 additions & 0 deletions testsuite/E27.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@
from importable.module import(e, f)
except ImportError:
pass
#: Okay
matched = {"true": True, "false": False}
2 changes: 2 additions & 0 deletions testsuite/python3.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def foo(x: int) -> int:

# Annotated variables #575
CONST: int = 42
match: int = 42
case: int = 42


class Class:
Expand Down
18 changes: 0 additions & 18 deletions testsuite/python310.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,3 @@
pass
case (0, 1, *_):
pass
#: E271:2:6 E271:3:9 E271:5:9 E271:7:9
var = 1
match var:
case 1:
pass
case 2:
pass
case (
3
):
pass
#: E275:2:6 E275:3:9 E275:5:9
var = 1
match(var):
case(1):
pass
case_:
pass

0 comments on commit 533073e

Please sign in to comment.