Skip to content

Commit 77f4473

Browse files
committed
Add mypy annotations to init and check in commands
1 parent f7c5a69 commit 77f4473

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/pip/_internal/commands/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
Package containing all pip commands
33
"""
44

5-
# The following comment should be removed at some point in the future.
6-
# mypy: disallow-untyped-defs=False
7-
85
from __future__ import absolute_import
96

107
import importlib
@@ -13,7 +10,7 @@
1310
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
1411

1512
if MYPY_CHECK_RUNNING:
16-
from typing import Any
13+
from typing import Any, Union, Sequence
1714
from pip._internal.cli.base_command import Command
1815

1916

@@ -101,6 +98,7 @@ def create_command(name, **kwargs):
10198

10299

103100
def get_similar_commands(name):
101+
# type: (str) -> Union[bool, Sequence[str]]
104102
"""Command name auto-correct."""
105103
from difflib import get_close_matches
106104

src/pip/_internal/commands/check.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# The following comment should be removed at some point in the future.
2-
# mypy: disallow-untyped-defs=False
3-
41
import logging
52

63
from pip._internal.cli.base_command import Command
@@ -9,9 +6,14 @@
96
create_package_set_from_installed,
107
)
118
from pip._internal.utils.misc import write_output
9+
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
1210

1311
logger = logging.getLogger(__name__)
1412

13+
if MYPY_CHECK_RUNNING:
14+
from typing import List, Any
15+
from optparse import Values
16+
1517

1618
class CheckCommand(Command):
1719
"""Verify installed packages have compatible dependencies."""
@@ -20,6 +22,7 @@ class CheckCommand(Command):
2022
%prog [options]"""
2123

2224
def run(self, options, args):
25+
# type: (Values, List[Any]) -> Any
2326
package_set, parsing_probs = create_package_set_from_installed()
2427
missing, conflicting = check_package_set(package_set)
2528

0 commit comments

Comments
 (0)