Skip to content

Commit

Permalink
Group typing_extensions imports next to typing (#13361)
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Aug 8, 2022
1 parent 694f283 commit 0db44d2
Show file tree
Hide file tree
Showing 80 changed files with 8 additions and 81 deletions.
1 change: 0 additions & 1 deletion misc/proper_plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from typing import Callable, Optional

from typing_extensions import Type as typing_Type

from mypy.nodes import TypeInfo
Expand Down
1 change: 0 additions & 1 deletion mypy/binder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from collections import defaultdict
from contextlib import contextmanager
from typing import DefaultDict, Dict, Iterator, List, Optional, Set, Tuple, Union, cast

from typing_extensions import TypeAlias as _TypeAlias

from mypy.erasetype import remove_instance_last_known_values
Expand Down
2 changes: 1 addition & 1 deletion mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
TypeVar,
Union,
)
from typing_extensions import Final, TypeAlias as _TypeAlias

from mypy_extensions import TypedDict
from typing_extensions import Final, TypeAlias as _TypeAlias

import mypy.semanal_main
from mypy.checker import TypeChecker
Expand Down
1 change: 0 additions & 1 deletion mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
cast,
overload,
)

from typing_extensions import Final, TypeAlias as _TypeAlias

import mypy.checkexpr
Expand Down
1 change: 0 additions & 1 deletion mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
Union,
cast,
)

from typing_extensions import Final, TypeAlias as _TypeAlias, overload

import mypy.checker
Expand Down
1 change: 0 additions & 1 deletion mypy/checkpattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from collections import defaultdict
from typing import Dict, List, NamedTuple, Optional, Set, Tuple, Union

from typing_extensions import Final

import mypy.checker
Expand Down
1 change: 0 additions & 1 deletion mypy/checkstrformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
Union,
cast,
)

from typing_extensions import Final, TypeAlias as _TypeAlias

import mypy.errorcodes as codes
Expand Down
1 change: 0 additions & 1 deletion mypy/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
Tuple,
Union,
)

from typing_extensions import Final, TypeAlias as _TypeAlias

from mypy import defaults
Expand Down
1 change: 0 additions & 1 deletion mypy/constraints.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Type inference constraints."""

from typing import TYPE_CHECKING, Iterable, List, Optional, Sequence

from typing_extensions import Final

import mypy.subtypes
Expand Down
1 change: 0 additions & 1 deletion mypy/defaults.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os

from typing_extensions import Final

PYTHON2_VERSION: Final = (2, 7)
Expand Down
1 change: 0 additions & 1 deletion mypy/dmypy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import traceback
from contextlib import redirect_stderr, redirect_stdout
from typing import AbstractSet, Any, Callable, Dict, List, Optional, Sequence, Set, Tuple

from typing_extensions import Final

import mypy.build
Expand Down
1 change: 0 additions & 1 deletion mypy/dmypy_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import json
from typing import Any

from typing_extensions import Final

from mypy.ipc import IPCBase
Expand Down
1 change: 0 additions & 1 deletion mypy/errorcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""

from typing import Dict

from typing_extensions import Final

error_codes: Dict[str, "ErrorCode"] = {}
Expand Down
1 change: 0 additions & 1 deletion mypy/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import traceback
from collections import defaultdict
from typing import Callable, Dict, List, NoReturn, Optional, Set, TextIO, Tuple, TypeVar, Union

from typing_extensions import Final, Literal

from mypy import errorcodes as codes
Expand Down
1 change: 0 additions & 1 deletion mypy/fastparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import typing # for typing.Type, which conflicts with types.Type
import warnings
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeVar, Union, cast

from typing_extensions import Final, Literal, overload

from mypy import defaults, errorcodes as codes, message_registry
Expand Down
1 change: 0 additions & 1 deletion mypy/find_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import functools
import os
from typing import List, Optional, Sequence, Set, Tuple

from typing_extensions import Final

from mypy.fscache import FileSystemCache
Expand Down
1 change: 0 additions & 1 deletion mypy/fixup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Fix up various things after deserialization."""

from typing import Any, Dict, Optional

from typing_extensions import Final

from mypy.lookup import lookup_fully_qualified
Expand Down
1 change: 0 additions & 1 deletion mypy/ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import tempfile
from types import TracebackType
from typing import Callable, Optional, Type

from typing_extensions import Final

if sys.platform == "win32":
Expand Down
1 change: 0 additions & 1 deletion mypy/literals.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from typing import Any, Iterable, Optional, Tuple, Union

from typing_extensions import Final

from mypy.nodes import (
Expand Down
1 change: 0 additions & 1 deletion mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import time
from gettext import gettext
from typing import IO, Any, Dict, List, NoReturn, Optional, Sequence, TextIO, Tuple, Union

from typing_extensions import Final

from mypy import build, defaults, state, util
Expand Down
1 change: 0 additions & 1 deletion mypy/message_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""

from typing import NamedTuple, Optional

from typing_extensions import Final

from mypy import errorcodes as codes
Expand Down
1 change: 0 additions & 1 deletion mypy/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
Union,
cast,
)

from typing_extensions import Final

from mypy import errorcodes as codes, message_registry
Expand Down
1 change: 0 additions & 1 deletion mypy/modulefinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import tomli as tomllib

from typing import Dict, List, NamedTuple, Optional, Set, Tuple, Union

from typing_extensions import Final, TypeAlias as _TypeAlias

from mypy import pyinfo
Expand Down
2 changes: 1 addition & 1 deletion mypy/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
Union,
cast,
)
from typing_extensions import Final, TypeAlias as _TypeAlias

from mypy_extensions import trait
from typing_extensions import Final, TypeAlias as _TypeAlias

import mypy.strconv
from mypy.bogus_type import Bogus
Expand Down
1 change: 0 additions & 1 deletion mypy/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import re
import sys
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Mapping, Optional, Pattern, Set, Tuple

from typing_extensions import Final

from mypy import defaults
Expand Down
1 change: 0 additions & 1 deletion mypy/plugins/attrs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Plugin for supporting the attrs library (http://www.attrs.org)"""

from typing import Dict, Iterable, List, Optional, Tuple, cast

from typing_extensions import Final

import mypy.plugin # To avoid circular imports.
Expand Down
1 change: 0 additions & 1 deletion mypy/plugins/dataclasses.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Plugin that provides support for dataclasses."""

from typing import Dict, List, Optional, Set, Tuple

from typing_extensions import Final

from mypy.nodes import (
Expand Down
1 change: 0 additions & 1 deletion mypy/plugins/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
semanal_enum.py).
"""
from typing import Iterable, Optional, Sequence, TypeVar, cast

from typing_extensions import Final

import mypy.plugin # To avoid circular imports.
Expand Down
1 change: 0 additions & 1 deletion mypy/plugins/functools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Plugin for supporting the functools standard library module."""
from typing import Dict, NamedTuple, Optional

from typing_extensions import Final

import mypy.plugin
Expand Down
1 change: 0 additions & 1 deletion mypy/plugins/singledispatch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from typing import List, NamedTuple, Optional, Sequence, TypeVar, Union

from typing_extensions import Final

from mypy.messages import format_type
Expand Down
1 change: 0 additions & 1 deletion mypy/reachability.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Utilities related to determining the reachability of code (in semantic analysis)."""

from typing import Optional, Tuple, TypeVar, Union

from typing_extensions import Final

from mypy.literals import literal
Expand Down
1 change: 0 additions & 1 deletion mypy/renaming.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from contextlib import contextmanager
from typing import Dict, Iterator, List, Set

from typing_extensions import Final

from mypy.nodes import (
Expand Down
3 changes: 1 addition & 2 deletions mypy/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
from abc import ABCMeta, abstractmethod
from operator import attrgetter
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, cast
from urllib.request import pathname2url

from typing_extensions import Final, TypeAlias as _TypeAlias
from urllib.request import pathname2url

from mypy import stats
from mypy.defaults import REPORTER_NAMES
Expand Down
1 change: 0 additions & 1 deletion mypy/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from contextlib import contextmanager, nullcontext
from typing import Iterator, List, Optional, Tuple

from typing_extensions import TypeAlias as _TypeAlias

from mypy.nodes import FuncBase, TypeInfo
Expand Down
1 change: 0 additions & 1 deletion mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
Union,
cast,
)

from typing_extensions import Final, TypeAlias as _TypeAlias

from mypy import errorcodes as codes, message_registry
Expand Down
1 change: 0 additions & 1 deletion mypy/semanal_classprop.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""

from typing import List, Optional, Set, Tuple

from typing_extensions import Final

from mypy.errors import Errors
Expand Down
1 change: 0 additions & 1 deletion mypy/semanal_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""

from typing import List, Optional, Tuple, cast

from typing_extensions import Final

from mypy.nodes import (
Expand Down
1 change: 0 additions & 1 deletion mypy/semanal_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

from contextlib import nullcontext
from typing import TYPE_CHECKING, Callable, List, Optional, Tuple, Union

from typing_extensions import Final, TypeAlias as _TypeAlias

import mypy.build
Expand Down
1 change: 0 additions & 1 deletion mypy/semanal_namedtuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from contextlib import contextmanager
from typing import Dict, Iterator, List, Mapping, Optional, Tuple, cast

from typing_extensions import Final

from mypy.exprtotype import TypeTranslationError, expr_to_unanalyzed_type
Expand Down
2 changes: 1 addition & 1 deletion mypy/semanal_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from abc import abstractmethod
from typing import Callable, List, Optional, Union
from typing_extensions import Final, Protocol

from mypy_extensions import trait
from typing_extensions import Final, Protocol

from mypy import join
from mypy.errorcodes import ErrorCode
Expand Down
1 change: 0 additions & 1 deletion mypy/semanal_typeddict.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Semantic analysis of TypedDict definitions."""

from typing import List, Optional, Set, Tuple

from typing_extensions import Final

from mypy import errorcodes as codes
Expand Down
1 change: 0 additions & 1 deletion mypy/server/mergecheck.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Check for duplicate AST nodes after merge."""

from typing import Dict, List, Tuple

from typing_extensions import Final

from mypy.nodes import Decorator, FakeInfo, FuncDef, SymbolNode, Var
Expand Down
1 change: 0 additions & 1 deletion mypy/server/objgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import weakref
from collections.abc import Iterable
from typing import Dict, Iterator, List, Mapping, Tuple

from typing_extensions import Final

method_descriptor_type: Final = type(object.__dir__)
Expand Down
1 change: 0 additions & 1 deletion mypy/server/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
import sys
import time
from typing import Callable, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, Union

from typing_extensions import Final

from mypy.build import (
Expand Down
1 change: 0 additions & 1 deletion mypy/sharedparse.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from typing import Optional

from typing_extensions import Final

"""Shared logic between our three mypy parser files."""
Expand Down
1 change: 0 additions & 1 deletion mypy/state.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from contextlib import contextmanager
from typing import Iterator, Optional, Tuple

from typing_extensions import Final

# These are global mutable state. Don't add anything here unless there's a very
Expand Down
1 change: 0 additions & 1 deletion mypy/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from collections import Counter
from contextlib import contextmanager
from typing import Dict, Iterator, List, Optional, Union, cast

from typing_extensions import Final

from mypy import nodes
Expand Down
1 change: 0 additions & 1 deletion mypy/stubdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
Sequence,
Tuple,
)

from typing_extensions import Final

# Type alias for signatures strings in format ('func_name', '(arg, opt_arg=False)').
Expand Down
1 change: 0 additions & 1 deletion mypy/stubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import traceback
from collections import defaultdict
from typing import Dict, Iterable, List, Mapping, Optional, Set, Tuple, Union, cast

from typing_extensions import Final

import mypy.build
Expand Down
1 change: 0 additions & 1 deletion mypy/stubgenc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import re
from types import ModuleType
from typing import Any, Dict, List, Mapping, Optional, Set, Tuple

from typing_extensions import Final

from mypy.moduleinspect import is_c_module
Expand Down
Loading

0 comments on commit 0db44d2

Please sign in to comment.