mirror of https://github.com/pypa/pip
Add mypy annotations to pip._internal.commands.check
This commit is contained in:
parent
f7c5a69e69
commit
c2fdf4a35b
|
@ -4,6 +4,10 @@ Package containing all pip commands
|
|||
|
||||
# The following comment should be removed at some point in the future.
|
||||
# mypy: disallow-untyped-defs=False
|
||||
# There is currently a bug in python/typeshed mentioned at
|
||||
# https://github.com/python/typeshed/issues/3906 which causes the
|
||||
# return type of difflib.get_close_matches to be reported
|
||||
# as List[Sequence[str]] whereas it should have been List[str]
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
# The following comment should be removed at some point in the future.
|
||||
# mypy: disallow-untyped-defs=False
|
||||
|
||||
import logging
|
||||
|
||||
from pip._internal.cli.base_command import Command
|
||||
from pip._internal.cli.status_codes import ERROR, SUCCESS
|
||||
from pip._internal.operations.check import (
|
||||
check_package_set,
|
||||
create_package_set_from_installed,
|
||||
)
|
||||
from pip._internal.utils.misc import write_output
|
||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from typing import List, Any
|
||||
from optparse import Values
|
||||
|
||||
|
||||
class CheckCommand(Command):
|
||||
"""Verify installed packages have compatible dependencies."""
|
||||
|
@ -20,6 +23,8 @@ class CheckCommand(Command):
|
|||
%prog [options]"""
|
||||
|
||||
def run(self, options, args):
|
||||
# type: (Values, List[Any]) -> int
|
||||
|
||||
package_set, parsing_probs = create_package_set_from_installed()
|
||||
missing, conflicting = check_package_set(package_set)
|
||||
|
||||
|
@ -40,6 +45,7 @@ class CheckCommand(Command):
|
|||
)
|
||||
|
||||
if missing or conflicting or parsing_probs:
|
||||
return 1
|
||||
return ERROR
|
||||
else:
|
||||
write_output("No broken requirements found.")
|
||||
return SUCCESS
|
||||
|
|
Loading…
Reference in New Issue