mirror of https://github.com/pypa/pip
Fix new issues found in mypy 0.620 -> 0.650
This commit is contained in:
parent
7e22a2234e
commit
22fe45d462
|
@ -8,8 +8,8 @@ from pip._vendor.six import iteritems
|
|||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from typing import Optional
|
||||
from pip._internal.req.req_install import InstallRequirement
|
||||
from typing import Optional # noqa: F401
|
||||
from pip._internal.req.req_install import InstallRequirement # noqa: F401
|
||||
|
||||
|
||||
class PipError(Exception):
|
||||
|
|
|
@ -15,7 +15,7 @@ from pip._internal.utils.compat import WINDOWS, expanduser
|
|||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from typing import Union, Dict, List, Optional # noqa: F401
|
||||
from typing import Any, Union, Dict, List, Optional # noqa: F401
|
||||
|
||||
|
||||
# Application Directories
|
||||
|
@ -163,8 +163,10 @@ def distutils_scheme(dist_name, user=False, home=None, root=None,
|
|||
|
||||
d = Distribution(dist_args)
|
||||
# Ignoring, typeshed issue reported python/typeshed/issues/2567
|
||||
d.parse_config_files() # type: ignore
|
||||
i = d.get_command_obj('install', create=True) # type: ignore
|
||||
d.parse_config_files()
|
||||
# NOTE: Ignoring type since mypy can't find attributes on 'Command'
|
||||
i = d.get_command_obj('install', create=True) # type: Any
|
||||
assert i is not None
|
||||
# NOTE: setting user or home has the side-effect of creating the home dir
|
||||
# or user base for installations during finalize_options()
|
||||
# ideally, we'd prefer a scheme class that has no side-effects.
|
||||
|
|
|
@ -31,7 +31,7 @@ from pip._internal.wheel import Wheel
|
|||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from typing import ( # noqa: F401
|
||||
Optional, Tuple, Set, Any, Mapping, Union, Text
|
||||
Optional, Tuple, Set, Any, Union, Text, Dict,
|
||||
)
|
||||
from pip._internal.cache import WheelCache # noqa: F401
|
||||
|
||||
|
@ -160,7 +160,7 @@ def install_req_from_editable(
|
|||
comes_from=None, # type: Optional[str]
|
||||
use_pep517=None, # type: Optional[bool]
|
||||
isolated=False, # type: bool
|
||||
options=None, # type: Optional[Mapping[Text, Any]]
|
||||
options=None, # type: Optional[Dict[str, Any]]
|
||||
wheel_cache=None, # type: Optional[WheelCache]
|
||||
constraint=False # type: bool
|
||||
):
|
||||
|
@ -196,7 +196,7 @@ def install_req_from_line(
|
|||
comes_from=None, # type: Optional[Union[str, InstallRequirement]]
|
||||
use_pep517=None, # type: Optional[bool]
|
||||
isolated=False, # type: bool
|
||||
options=None, # type: Optional[Mapping[Text, Any]]
|
||||
options=None, # type: Optional[Dict[str, Any]]
|
||||
wheel_cache=None, # type: Optional[WheelCache]
|
||||
constraint=False # type: bool
|
||||
):
|
||||
|
|
|
@ -68,7 +68,7 @@ SUPPORTED_OPTIONS_REQ = [
|
|||
] # type: List[Callable[..., optparse.Option]]
|
||||
|
||||
# the 'dest' string values
|
||||
SUPPORTED_OPTIONS_REQ_DEST = [o().dest for o in SUPPORTED_OPTIONS_REQ]
|
||||
SUPPORTED_OPTIONS_REQ_DEST = [str(o().dest) for o in SUPPORTED_OPTIONS_REQ]
|
||||
|
||||
|
||||
def parse_requirements(
|
||||
|
|
|
@ -42,7 +42,7 @@ from pip._internal.wheel import move_wheel_files
|
|||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from typing import ( # noqa: F401
|
||||
Optional, Iterable, List, Union, Any, Mapping, Text, Sequence
|
||||
Optional, Iterable, List, Union, Any, Text, Sequence, Dict
|
||||
)
|
||||
from pip._internal.build_env import BuildEnvironment # noqa: F401
|
||||
from pip._internal.cache import WheelCache # noqa: F401
|
||||
|
@ -73,7 +73,7 @@ class InstallRequirement(object):
|
|||
markers=None, # type: Optional[Marker]
|
||||
use_pep517=None, # type: Optional[bool]
|
||||
isolated=False, # type: bool
|
||||
options=None, # type: Optional[Mapping[Text, Any]]
|
||||
options=None, # type: Optional[Dict[str, Any]]
|
||||
wheel_cache=None, # type: Optional[WheelCache]
|
||||
constraint=False, # type: bool
|
||||
extras=() # type: Iterable[str]
|
||||
|
|
|
@ -23,8 +23,8 @@ except ImportError:
|
|||
from pip._vendor import ipaddress # type: ignore
|
||||
except ImportError:
|
||||
import ipaddr as ipaddress # type: ignore
|
||||
ipaddress.ip_address = ipaddress.IPAddress
|
||||
ipaddress.ip_network = ipaddress.IPNetwork
|
||||
ipaddress.ip_address = ipaddress.IPAddress # type: ignore
|
||||
ipaddress.ip_network = ipaddress.IPNetwork # type: ignore
|
||||
|
||||
|
||||
__all__ = [
|
||||
|
|
Loading…
Reference in New Issue