From d19b47a307fd45f2e2d2994f105a3c69d66caf82 Mon Sep 17 00:00:00 2001 From: Ian Stapleton Cordasco Date: Thu, 30 Sep 2021 06:35:53 -0500 Subject: Allow __all__ to be typed Closes gh-1018 --- pycodestyle.py | 2 +- testsuite/python38.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1