mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
add global disallow_any_generics=True
This commit is contained in:
parent
6c04feff1d
commit
d1452ffabd
|
@ -30,6 +30,7 @@ ignore = W504
|
||||||
follow_imports = silent
|
follow_imports = silent
|
||||||
ignore_missing_imports = True
|
ignore_missing_imports = True
|
||||||
disallow_untyped_defs = True
|
disallow_untyped_defs = True
|
||||||
|
disallow_any_generics = True
|
||||||
|
|
||||||
[mypy-pip/_vendor/*]
|
[mypy-pip/_vendor/*]
|
||||||
follow_imports = skip
|
follow_imports = skip
|
||||||
|
|
|
@ -92,7 +92,7 @@ class Command(CommandContextMixIn):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def parse_args(self, args):
|
def parse_args(self, args):
|
||||||
# type: (List[str]) -> Tuple
|
# type: (List[str]) -> Tuple[Any, Any]
|
||||||
# factored out for testability
|
# factored out for testability
|
||||||
return self.parser.parse_args(args)
|
return self.parser.parse_args(args)
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ class LinkEvaluator(object):
|
||||||
self,
|
self,
|
||||||
project_name, # type: str
|
project_name, # type: str
|
||||||
canonical_name, # type: str
|
canonical_name, # type: str
|
||||||
formats, # type: FrozenSet
|
formats, # type: FrozenSet[str]
|
||||||
target_python, # type: TargetPython
|
target_python, # type: TargetPython
|
||||||
allow_yanked, # type: bool
|
allow_yanked, # type: bool
|
||||||
ignore_requires_python=None, # type: Optional[bool]
|
ignore_requires_python=None, # type: Optional[bool]
|
||||||
|
|
|
@ -53,6 +53,7 @@ if MYPY_CHECK_RUNNING:
|
||||||
InstallRequirementProvider = Callable[
|
InstallRequirementProvider = Callable[
|
||||||
[str, InstallRequirement], InstallRequirement
|
[str, InstallRequirement], InstallRequirement
|
||||||
]
|
]
|
||||||
|
DiscoveredDependencies = DefaultDict[str, List[InstallRequirement]]
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ class Resolver(object):
|
||||||
self._make_install_req = make_install_req
|
self._make_install_req = make_install_req
|
||||||
|
|
||||||
self._discovered_dependencies = \
|
self._discovered_dependencies = \
|
||||||
defaultdict(list) # type: DefaultDict[str, List]
|
defaultdict(list) # type: DiscoveredDependencies
|
||||||
|
|
||||||
def resolve(self, requirement_set):
|
def resolve(self, requirement_set):
|
||||||
# type: (RequirementSet) -> None
|
# type: (RequirementSet) -> None
|
||||||
|
|
|
@ -95,7 +95,7 @@ else:
|
||||||
def distutils_scheme(
|
def distutils_scheme(
|
||||||
dist_name, user=False, home=None, root=None, isolated=False, prefix=None
|
dist_name, user=False, home=None, root=None, isolated=False, prefix=None
|
||||||
):
|
):
|
||||||
# type:(str, bool, str, str, bool, str) -> dict
|
# type:(str, bool, str, str, bool, str) -> Dict[str, str]
|
||||||
"""
|
"""
|
||||||
Return a distutils install scheme
|
Return a distutils install scheme
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -16,7 +16,7 @@ class FormatControl(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, no_binary=None, only_binary=None):
|
def __init__(self, no_binary=None, only_binary=None):
|
||||||
# type: (Optional[Set], Optional[Set]) -> None
|
# type: (Optional[Set[str]], Optional[Set[str]]) -> None
|
||||||
if no_binary is None:
|
if no_binary is None:
|
||||||
no_binary = set()
|
no_binary = set()
|
||||||
if only_binary is None:
|
if only_binary is None:
|
||||||
|
@ -40,7 +40,7 @@ class FormatControl(object):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def handle_mutual_excludes(value, target, other):
|
def handle_mutual_excludes(value, target, other):
|
||||||
# type: (str, Optional[Set], Optional[Set]) -> None
|
# type: (str, Optional[Set[str]], Optional[Set[str]]) -> None
|
||||||
if value.startswith('-'):
|
if value.startswith('-'):
|
||||||
raise CommandError(
|
raise CommandError(
|
||||||
"--no-binary / --only-binary option requires 1 argument."
|
"--no-binary / --only-binary option requires 1 argument."
|
||||||
|
@ -63,7 +63,7 @@ class FormatControl(object):
|
||||||
target.add(name)
|
target.add(name)
|
||||||
|
|
||||||
def get_allowed_formats(self, canonical_name):
|
def get_allowed_formats(self, canonical_name):
|
||||||
# type: (str) -> FrozenSet
|
# type: (str) -> FrozenSet[str]
|
||||||
result = {"binary", "source"}
|
result = {"binary", "source"}
|
||||||
if canonical_name in self.only_binary:
|
if canonical_name in self.only_binary:
|
||||||
result.discard('source')
|
result.discard('source')
|
||||||
|
|
|
@ -57,7 +57,7 @@ from pip._internal.vcs import vcs
|
||||||
|
|
||||||
if MYPY_CHECK_RUNNING:
|
if MYPY_CHECK_RUNNING:
|
||||||
from typing import (
|
from typing import (
|
||||||
Callable, IO, List, Optional, Tuple,
|
Any, Callable, IO, List, Optional, Tuple,
|
||||||
)
|
)
|
||||||
|
|
||||||
from mypy_extensions import TypedDict
|
from mypy_extensions import TypedDict
|
||||||
|
@ -116,7 +116,7 @@ def _progress_indicator(iterable, *args, **kwargs):
|
||||||
def _download_url(
|
def _download_url(
|
||||||
resp, # type: Response
|
resp, # type: Response
|
||||||
link, # type: Link
|
link, # type: Link
|
||||||
content_file, # type: IO
|
content_file, # type: IO[Any]
|
||||||
hashes, # type: Optional[Hashes]
|
hashes, # type: Optional[Hashes]
|
||||||
progress_bar # type: str
|
progress_bar # type: str
|
||||||
):
|
):
|
||||||
|
|
|
@ -59,7 +59,7 @@ def _script_names(dist, script_name, is_gui):
|
||||||
|
|
||||||
|
|
||||||
def _unique(fn):
|
def _unique(fn):
|
||||||
# type: (Callable) -> Callable[..., Iterator[Any]]
|
# type: (Callable[..., Iterator[Any]]) -> Callable[..., Iterator[Any]]
|
||||||
@functools.wraps(fn)
|
@functools.wraps(fn)
|
||||||
def unique(*args, **kw):
|
def unique(*args, **kw):
|
||||||
# type: (Any, Any) -> Iterator[Any]
|
# type: (Any, Any) -> Iterator[Any]
|
||||||
|
|
|
@ -254,7 +254,7 @@ def call_subprocess(
|
||||||
|
|
||||||
|
|
||||||
def runner_with_spinner_message(message):
|
def runner_with_spinner_message(message):
|
||||||
# type: (str) -> Callable
|
# type: (str) -> Callable[..., None]
|
||||||
"""Provide a subprocess_runner that shows a spinner message.
|
"""Provide a subprocess_runner that shows a spinner message.
|
||||||
|
|
||||||
Intended for use with for pep517's Pep517HookCaller. Thus, the runner has
|
Intended for use with for pep517's Pep517HookCaller. Thus, the runner has
|
||||||
|
|
|
@ -279,7 +279,7 @@ def DownloadProgressProvider(progress_bar, max=None):
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def hidden_cursor(file):
|
def hidden_cursor(file):
|
||||||
# type: (IO) -> Iterator[None]
|
# type: (IO[Any]) -> Iterator[None]
|
||||||
# The Windows terminal does not support the hide/show cursor ANSI codes,
|
# The Windows terminal does not support the hide/show cursor ANSI codes,
|
||||||
# even via colorama. So don't even try.
|
# even via colorama. So don't even try.
|
||||||
if WINDOWS:
|
if WINDOWS:
|
||||||
|
|
|
@ -69,7 +69,7 @@ def rehash(path, blocksize=1 << 20):
|
||||||
|
|
||||||
|
|
||||||
def open_for_csv(name, mode):
|
def open_for_csv(name, mode):
|
||||||
# type: (str, Text) -> IO
|
# type: (str, Text) -> IO[Any]
|
||||||
if sys.version_info[0] < 3:
|
if sys.version_info[0] < 3:
|
||||||
nl = {} # type: Dict[str, Any]
|
nl = {} # type: Dict[str, Any]
|
||||||
bin = 'b'
|
bin = 'b'
|
||||||
|
@ -237,7 +237,7 @@ def sorted_outrows(outrows):
|
||||||
def get_csv_rows_for_installed(
|
def get_csv_rows_for_installed(
|
||||||
old_csv_rows, # type: Iterable[List[str]]
|
old_csv_rows, # type: Iterable[List[str]]
|
||||||
installed, # type: Dict[str, str]
|
installed, # type: Dict[str, str]
|
||||||
changed, # type: set
|
changed, # type: Set[str]
|
||||||
generated, # type: List[str]
|
generated, # type: List[str]
|
||||||
lib_dir, # type: str
|
lib_dir, # type: str
|
||||||
):
|
):
|
||||||
|
|
|
@ -57,7 +57,7 @@ def replace_python_tag(wheelname, new_tag):
|
||||||
|
|
||||||
def _contains_egg_info(
|
def _contains_egg_info(
|
||||||
s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)):
|
s, _egg_info_re=re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.I)):
|
||||||
# type: (str, Pattern) -> bool
|
# type: (str, Pattern[str]) -> bool
|
||||||
"""Determine whether the string looks like an egg_info.
|
"""Determine whether the string looks like an egg_info.
|
||||||
|
|
||||||
:param s: The string to parse. E.g. foo-2.1
|
:param s: The string to parse. E.g. foo-2.1
|
||||||
|
|
Loading…
Reference in a new issue