diff options
| author | Anthony Sottile <asottile@umich.edu> | 2021-03-29 19:33:44 -0700 |
|---|---|---|
| committer | Anthony Sottile <asottile@umich.edu> | 2021-03-30 17:37:13 -0700 |
| commit | 64a610ed19beb3a9b50c7ae83d1ae861fc6613ef (patch) | |
| tree | a77a8b3b139fbea735049619a4f40b4fdc033747 /src | |
| parent | 83856872d37d30f04e0252960ffb5e3d5468ae5c (diff) | |
| download | flake8-64a610ed19beb3a9b50c7ae83d1ae861fc6613ef.tar.gz | |
clean up TYPE_CHECKING imports
Diffstat (limited to 'src')
| -rw-r--r-- | src/flake8/__init__.py | 4 | ||||
| -rw-r--r-- | src/flake8/formatting/base.py | 3 | ||||
| -rw-r--r-- | src/flake8/formatting/default.py | 3 | ||||
| -rw-r--r-- | src/flake8/main/application.py | 6 | ||||
| -rw-r--r-- | src/flake8/options/manager.py | 6 | ||||
| -rw-r--r-- | src/flake8/statistics.py | 3 | ||||
| -rw-r--r-- | src/flake8/utils.py | 3 |
7 files changed, 16 insertions, 12 deletions
diff --git a/src/flake8/__init__.py b/src/flake8/__init__.py index ea2f541..a6f2b62 100644 --- a/src/flake8/__init__.py +++ b/src/flake8/__init__.py @@ -11,9 +11,7 @@ This module """ import logging import sys - -if False: # `typing.TYPE_CHECKING` was introduced in 3.5.2 - from typing import Type # `typing.Type` was introduced in 3.5.2 +from typing import Type LOG = logging.getLogger(__name__) LOG.addHandler(logging.NullHandler()) diff --git a/src/flake8/formatting/base.py b/src/flake8/formatting/base.py index 89789b5..d98b290 100644 --- a/src/flake8/formatting/base.py +++ b/src/flake8/formatting/base.py @@ -4,8 +4,9 @@ from typing import IO from typing import List from typing import Optional from typing import Tuple +from typing import TYPE_CHECKING -if False: # `typing.TYPE_CHECKING` was introduced in 3.5.2 +if TYPE_CHECKING: from flake8.statistics import Statistics from flake8.style_guide import Violation diff --git a/src/flake8/formatting/default.py b/src/flake8/formatting/default.py index 0ff5a9b..dc78254 100644 --- a/src/flake8/formatting/default.py +++ b/src/flake8/formatting/default.py @@ -1,10 +1,11 @@ """Default formatting class for Flake8.""" from typing import Optional from typing import Set +from typing import TYPE_CHECKING from flake8.formatting import base -if False: # `typing.TYPE_CHECKING` was introduced in 3.5.2 +if TYPE_CHECKING: from flake8.style_guide import Violation diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py index f5e3f10..fb23db5 100644 --- a/src/flake8/main/application.py +++ b/src/flake8/main/application.py @@ -8,6 +8,8 @@ from typing import List from typing import Optional from typing import Set from typing import Tuple +from typing import Type +from typing import TYPE_CHECKING import flake8 from flake8 import checker @@ -21,9 +23,7 @@ from flake8.options import config from flake8.options import manager from flake8.plugins import manager as plugin_manager -if False: # `typing.TYPE_CHECKING` was introduced in 3.5.2 - from typing import Type # `typing.Type` was introduced in 3.5.2 - +if TYPE_CHECKING: from flake8.formatting.base import BaseFormatter diff --git a/src/flake8/options/manager.py b/src/flake8/options/manager.py index f537a42..206094f 100644 --- a/src/flake8/options/manager.py +++ b/src/flake8/options/manager.py @@ -16,12 +16,14 @@ from typing import Optional from typing import Sequence from typing import Set from typing import Tuple +from typing import Type +from typing import TYPE_CHECKING from typing import Union from flake8 import utils -if False: # TYPE_CHECKING - from typing import NoReturn, Type +if TYPE_CHECKING: + from typing import NoReturn LOG = logging.getLogger(__name__) diff --git a/src/flake8/statistics.py b/src/flake8/statistics.py index c238b8d..0ccc746 100644 --- a/src/flake8/statistics.py +++ b/src/flake8/statistics.py @@ -4,8 +4,9 @@ from typing import Dict from typing import Generator from typing import List from typing import Optional +from typing import TYPE_CHECKING -if False: # `typing.TYPE_CHECKING` was introduced in 3.5.2 +if TYPE_CHECKING: from flake8.style_guide import Violation diff --git a/src/flake8/utils.py b/src/flake8/utils.py index d461bb5..aec5a43 100644 --- a/src/flake8/utils.py +++ b/src/flake8/utils.py @@ -19,11 +19,12 @@ from typing import Pattern from typing import Sequence from typing import Set from typing import Tuple +from typing import TYPE_CHECKING from typing import Union from flake8 import exceptions -if False: # `typing.TYPE_CHECKING` was introduced in 3.5.2 +if TYPE_CHECKING: from flake8.plugins.manager import Plugin DIFF_HUNK_REGEXP = re.compile(r"^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$") |
