Make mypy happy

This commit is contained in:
Pradyun Gedam 2020-10-20 07:07:14 +05:30
parent 95171c881f
commit daa003bd9b
No known key found for this signature in database
GPG Key ID: FF99710C4332258E
1 changed files with 11 additions and 1 deletions

View File

@ -3,13 +3,22 @@ from logging import getLogger
from pip._vendor.resolvelib.reporters import BaseReporter
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import DefaultDict
from .base import Candidate
logger = getLogger(__name__)
class PipReporter(BaseReporter):
def __init__(self):
self.backtracks_by_package = defaultdict(int)
# type: () -> None
self.backtracks_by_package = defaultdict(int) # type: DefaultDict[str, int]
self._messages_at_backtrack = {
8: (
@ -25,6 +34,7 @@ class PipReporter(BaseReporter):
}
def backtracking(self, candidate):
# type: (Candidate) -> None
self.backtracks_by_package[candidate.name] += 1
count = self.backtracks_by_package[candidate.name]