mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-02 19:56:52 +00:00
clean up TYPE_CHECKING imports
This commit is contained in:
parent
83856872d3
commit
64a610ed19
8 changed files with 17 additions and 12 deletions
|
|
@ -30,3 +30,4 @@ exclude_lines =
|
|||
# Don't complain if non-runnable code isn't run:
|
||||
^if __name__ == ['"]__main__['"]:$
|
||||
^\s*if False:
|
||||
^\s*if TYPE_CHECKING:
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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__)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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+))? @@.*$")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue