diff --git a/mypy/checkexpr.py b/mypy/checkexpr.py index 0ba58694792e..0ed9e4948d3d 100644 --- a/mypy/checkexpr.py +++ b/mypy/checkexpr.py @@ -4,7 +4,7 @@ from contextlib import contextmanager from typing import ( cast, Dict, Set, List, Tuple, Callable, Union, Optional, Iterable, - Sequence, Any, Iterator + Sequence, Iterator ) MYPY = False if MYPY: @@ -18,9 +18,8 @@ from mypy.types import ( Type, AnyType, CallableType, Overloaded, NoneTyp, TypeVarDef, TupleType, TypedDictType, Instance, TypeVarType, ErasedType, UnionType, - PartialType, DeletedType, UnboundType, UninhabitedType, TypeType, TypeOfAny, - true_only, false_only, is_named_instance, function_type, callable_type, FunctionLike, - get_typ_args, StarType + PartialType, DeletedType, UninhabitedType, TypeType, TypeOfAny, true_only, + false_only, is_named_instance, function_type, callable_type, FunctionLike, StarType, ) from mypy.nodes import ( NameExpr, RefExpr, Var, FuncDef, OverloadedFuncDef, TypeInfo, CallExpr, @@ -45,13 +44,12 @@ from mypy.infer import infer_type_arguments, infer_function_type_arguments from mypy import join from mypy.meet import narrow_declared_type -from mypy.maptype import map_instance_to_supertype from mypy.subtypes import ( is_subtype, is_proper_subtype, is_equivalent, find_member, non_method_protocol_members, ) from mypy import applytype from mypy import erasetype -from mypy.checkmember import analyze_member_access, type_object_type, bind_self +from mypy.checkmember import analyze_member_access, type_object_type from mypy.constraints import get_actual_type from mypy.checkstrformat import StringFormatterChecker from mypy.expandtype import expand_type, expand_type_by_instance, freshen_function_type_vars @@ -61,8 +59,6 @@ from mypy.plugin import Plugin, MethodContext, MethodSigContext, FunctionContext from mypy.typeanal import make_optional_type -from mypy import experiments - # Type of callback user for checking individual function arguments. See # check_args() below for details. ArgChecker = Callable[[Type, Type, int, Type, int, int, CallableType, Context, MessageBuilder], diff --git a/mypy/errors.py b/mypy/errors.py index f8893290e32b..19028e12ab56 100644 --- a/mypy/errors.py +++ b/mypy/errors.py @@ -2,9 +2,8 @@ import sys import traceback from collections import OrderedDict, defaultdict -from contextlib import contextmanager -from typing import Tuple, List, TypeVar, Set, Dict, Iterator, Optional, cast +from typing import Tuple, List, TypeVar, Set, Dict, Optional from mypy.scope import Scope from mypy.options import Options diff --git a/mypy/fastparse2.py b/mypy/fastparse2.py index 713b8f2ff4b3..970d1f0ce000 100644 --- a/mypy/fastparse2.py +++ b/mypy/fastparse2.py @@ -14,7 +14,6 @@ different class hierarchies, which made it difficult to write a shared visitor between the two in a typesafe way. """ -from functools import wraps import sys from typing import Tuple, Union, TypeVar, Callable, Sequence, Optional, Any, Dict, cast, List diff --git a/mypy/main.py b/mypy/main.py index 1c47affeae4e..588ea2a7cb57 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -9,13 +9,12 @@ import sys import time -from typing import Any, Dict, List, Mapping, Optional, Tuple, Callable +from typing import Any, Dict, List, Mapping, Optional, Tuple from mypy import build from mypy import defaults from mypy import experiments from mypy import util -from mypy.build import BuildResult from mypy.modulefinder import BuildSource, FindModuleCache, mypy_path, SearchPaths from mypy.find_sources import create_source_list, InvalidSourceList from mypy.fscache import FileSystemCache diff --git a/mypy/stats.py b/mypy/stats.py index 3c00d9440a68..888ab5eebf4e 100644 --- a/mypy/stats.py +++ b/mypy/stats.py @@ -1,6 +1,6 @@ """Utilities for calculating and reporting statistics about types.""" -import os.path +import os import typing from collections import Counter diff --git a/mypy/util.py b/mypy/util.py index bcf5d9edee99..3400cbdcfddd 100644 --- a/mypy/util.py +++ b/mypy/util.py @@ -1,6 +1,5 @@ """Utility functions with no non-trivial dependencies.""" import inspect -import genericpath # type: ignore # no stub files yet import os import pathlib import re diff --git a/scripts/dumpmodule.py b/scripts/dumpmodule.py index 5d31241f4a0d..ac8470ece763 100644 --- a/scripts/dumpmodule.py +++ b/scripts/dumpmodule.py @@ -12,7 +12,6 @@ import sys import types from typing import Text -from collections import defaultdict if sys.version_info >= (3, 0):