Skip to content

Commit

Permalink
Add type hints to self.run wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMino committed Jan 4, 2021
1 parent 548688d commit 235643a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pip/_internal/cli/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@

if MYPY_CHECK_RUNNING:
from optparse import Values
from typing import Any, List, Optional, Tuple
from typing import Any, Callable, List, Optional, Tuple

from pip._internal.utils.temp_dir import (
TempDirectoryTypeRegistry as TempDirRegistry,
)

status = int

__all__ = ['Command']

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -189,8 +191,10 @@ def _main(self, args):
)

def intercepts_unhandled_exc(run_func):
# type: (Callable[..., status]) -> Callable[..., status]
@wraps(run_func)
def exc_logging_wrapper(*args):
# type: (*Any) -> status
try:
status = run_func(*args)
assert isinstance(status, int)
Expand Down

0 comments on commit 235643a

Please sign in to comment.