summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Stapleton Cordasco <graffatcolmingov@gmail.com>2021-10-05 20:02:26 -0500
committerGitHub <noreply@github.com>2021-10-05 20:02:26 -0500
commit533073e22cb66b277e09ee41a034380494f9a11e (patch)
treea076224601aa3e34af23502f8075eb0d3647946a
parent6f01bda37924c362ebd0d342a20c586548f35b46 (diff)
parente06e93e0dc6193e3b4045b470fd6ec5b022e50fc (diff)
downloadpep8-master.tar.gz
Merge pull request #1025 from asottile/revert-990master
revert #990
-rwxr-xr-xpycodestyle.py11
-rw-r--r--testsuite/E27.py2
-rw-r--r--testsuite/python3.py2
-rw-r--r--testsuite/python310.py18
4 files changed, 4 insertions, 29 deletions
diff --git a/pycodestyle.py b/pycodestyle.py
index ca6a2bd..cb26904 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -170,7 +170,6 @@ STARTSWITH_INDENT_STATEMENT_REGEX = re.compile(
)))
)
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': {}}
@@ -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):
diff --git a/testsuite/E27.py b/testsuite/E27.py
index 888b3a8..9bb53f8 100644
--- a/testsuite/E27.py
+++ b/testsuite/E27.py
@@ -42,3 +42,5 @@ try:
from importable.module import(e, f)
except ImportError:
pass
+#: Okay
+matched = {"true": True, "false": False}
diff --git a/testsuite/python3.py b/testsuite/python3.py
index 709695a..959956e 100644
--- a/testsuite/python3.py
+++ b/testsuite/python3.py
@@ -9,6 +9,8 @@ def foo(x: int) -> int:
# Annotated variables #575
CONST: int = 42
+match: int = 42
+case: int = 42
class Class:
diff --git a/testsuite/python310.py b/testsuite/python310.py
index 8cd98f2..2355f55 100644
--- a/testsuite/python310.py
+++ b/testsuite/python310.py
@@ -22,21 +22,3 @@ match var:
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