summaryrefslogtreecommitdiff
path: root/pycodestyle.py
diff options
context:
space:
mode:
authorMarc Mueller <30130371+cdce8p@users.noreply.github.com>2021-05-03 01:21:24 +0200
committerMarc Mueller <30130371+cdce8p@users.noreply.github.com>2021-05-03 01:56:28 +0200
commit76abb5ddc61b6532cca1f448d7e95793b4296eac (patch)
tree4f05cc89ab5af3dffb669ee6c90bce46eb2c72cb /pycodestyle.py
parentd13134eba2f6a2f2d9fced5a95bf78fdeaabc9e8 (diff)
downloadpep8-76abb5ddc61b6532cca1f448d7e95793b4296eac.tar.gz
Moved to existing check
Diffstat (limited to 'pycodestyle.py')
-rwxr-xr-xpycodestyle.py37
1 files changed, 11 insertions, 26 deletions
diff --git a/pycodestyle.py b/pycodestyle.py
index abadf6e..47ab5ce 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -494,6 +494,17 @@ 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:
+ whitespace = match.groups()[0]
+ if whitespace == ' ':
+ return
+ if whitespace == '':
+ 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):
@@ -514,32 +525,6 @@ def missing_whitespace_after_import_keyword(logical_line):
@register_check
-def missing_whitespace_after_match_case(logical_line):
- r"""Check whitespace after 'match' and 'case'.
-
- Python 3.10
- Okay: match status:
- E271: match status:
- E271: case\tstatus:
- E271: case _:
- E275: matchstatus:
- E275: casestatus:
- E275: case_:
- """
- if sys.version_info < (3, 10):
- return
- match = MATCH_CASE_REGEX.match(logical_line)
- if match:
- whitespace = match.groups()[0]
- if whitespace == ' ':
- return
- if whitespace == '':
- yield match.start(1), "E275 missing whitespace after keyword"
- else:
- yield match.start(1), "E271 multiple spaces after keyword"
-
-
-@register_check
def missing_whitespace(logical_line):
r"""Each comma, semicolon or colon should be followed by whitespace.