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