mirror of https://github.com/pypa/pip
Use --no-implicit-optional for type checking
This makes type checking PEP 484 compliant (as of 2018). mypy will change its defaults soon. See: https://github.com/python/mypy/issues/9091 https://github.com/python/mypy/pull/13401
This commit is contained in:
parent
7607c14662
commit
b9ec5ddc29
|
@ -3,7 +3,7 @@ import itertools
|
|||
import logging
|
||||
import sys
|
||||
import time
|
||||
from typing import IO, Generator
|
||||
from typing import IO, Generator, Optional
|
||||
|
||||
from pip._internal.utils.compat import WINDOWS
|
||||
from pip._internal.utils.logging import get_indentation
|
||||
|
@ -23,7 +23,7 @@ class InteractiveSpinner(SpinnerInterface):
|
|||
def __init__(
|
||||
self,
|
||||
message: str,
|
||||
file: IO[str] = None,
|
||||
file: Optional[IO[str]] = None,
|
||||
spin_chars: str = "-\\|/",
|
||||
# Empirically, 8 updates/second looks nice
|
||||
min_update_interval_seconds: float = 0.125,
|
||||
|
|
|
@ -288,7 +288,10 @@ class NetworkConnectionError(PipError):
|
|||
"""HTTP connection error"""
|
||||
|
||||
def __init__(
|
||||
self, error_msg: str, response: Response = None, request: Request = None
|
||||
self,
|
||||
error_msg: str,
|
||||
response: Optional[Response] = None,
|
||||
request: Optional[Request] = None,
|
||||
) -> None:
|
||||
"""
|
||||
Initialize NetworkConnectionError with `request` and `response`
|
||||
|
|
|
@ -35,10 +35,10 @@ logger = logging.getLogger(__name__)
|
|||
def distutils_scheme(
|
||||
dist_name: str,
|
||||
user: bool = False,
|
||||
home: str = None,
|
||||
root: str = None,
|
||||
home: Optional[str] = None,
|
||||
root: Optional[str] = None,
|
||||
isolated: bool = False,
|
||||
prefix: str = None,
|
||||
prefix: Optional[str] = None,
|
||||
*,
|
||||
ignore_config_files: bool = False,
|
||||
) -> Dict[str, str]:
|
||||
|
|
|
@ -420,7 +420,9 @@ def _raise_for_invalid_entrypoint(specification: str) -> None:
|
|||
|
||||
|
||||
class PipScriptMaker(ScriptMaker):
|
||||
def make(self, specification: str, options: Dict[str, Any] = None) -> List[str]:
|
||||
def make(
|
||||
self, specification: str, options: Optional[Dict[str, Any]] = None
|
||||
) -> List[str]:
|
||||
_raise_for_invalid_entrypoint(specification)
|
||||
return super().make(specification, options)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class Hashes:
|
|||
|
||||
"""
|
||||
|
||||
def __init__(self, hashes: Dict[str, List[str]] = None) -> None:
|
||||
def __init__(self, hashes: Optional[Dict[str, List[str]]] = None) -> None:
|
||||
"""
|
||||
:param hashes: A dict of algorithm names pointing to lists of allowed
|
||||
hex digests
|
||||
|
|
|
@ -48,7 +48,7 @@ _SETUPTOOLS_SHIM = textwrap.dedent(
|
|||
|
||||
def make_setuptools_shim_args(
|
||||
setup_py_path: str,
|
||||
global_options: Sequence[str] = None,
|
||||
global_options: Optional[Sequence[str]] = None,
|
||||
no_user_config: bool = False,
|
||||
unbuffered_output: bool = False,
|
||||
) -> List[str]:
|
||||
|
|
|
@ -184,7 +184,7 @@ class Subversion(VersionControl):
|
|||
"""Always assume the versions don't match"""
|
||||
return False
|
||||
|
||||
def __init__(self, use_interactive: bool = None) -> None:
|
||||
def __init__(self, use_interactive: Optional[bool] = None) -> None:
|
||||
if use_interactive is None:
|
||||
use_interactive = is_console_interactive()
|
||||
self.use_interactive = use_interactive
|
||||
|
|
Loading…
Reference in New Issue