summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Stapleton Cordasco <graffatcolmingov@gmail.com>2021-09-30 06:35:53 -0500
committerIan Stapleton Cordasco <graffatcolmingov@gmail.com>2021-10-01 05:55:18 -0500
commitd19b47a307fd45f2e2d2994f105a3c69d66caf82 (patch)
tree0115f6beae10b55a6988e8698e6f05b0aa7fc0cc
parentbf0c5bc6e61cf728047b2fe43bd8e993581ff16c (diff)
downloadpep8-issue/1018.tar.gz
Allow __all__ to be typedissue/1018
Closes gh-1018
-rwxr-xr-xpycodestyle.py2
-rw-r--r--testsuite/python38.py14
2 files changed, 15 insertions, 1 deletions
diff --git a/pycodestyle.py b/pycodestyle.py
index 68d31d4..1d98dce 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -169,7 +169,7 @@ STARTSWITH_INDENT_STATEMENT_REGEX = re.compile(
'while',
)))
)
-DUNDER_REGEX = re.compile(r'^__([^\s]+)__ = ')
+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*:")
diff --git a/testsuite/python38.py b/testsuite/python38.py
index f927673..1374192 100644
--- a/testsuite/python38.py
+++ b/testsuite/python38.py
@@ -28,3 +28,17 @@ if x:= 1:
#: E225:1:18
if False or (x :=1):
pass
+#: Okay
+import typing as t
+
+__all__: t.List[str] = []
+
+import logging
+
+logging.getLogger(__name__)
+#: E402
+import typing as t
+
+all_the_things: t.List[str] = []
+
+import logging