1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Add type annotations to pip._internal.cache

This commit is contained in:
Devesh Kumar Singh 2020-07-09 21:42:27 +05:30
parent 2f9b50c097
commit dadac2ce03
2 changed files with 3 additions and 5 deletions

View file

@ -1,9 +1,6 @@
"""Cache Management
"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
import hashlib
import json
import logging
@ -122,7 +119,7 @@ class Cache(object):
return parts
def _get_candidates(self, link, canonical_package_name):
# type: (Link, Optional[str]) -> List[Any]
# type: (Link, str) -> List[Any]
can_not_cache = (
not self.cache_dir or
not canonical_package_name or
@ -185,6 +182,7 @@ class SimpleWheelCache(Cache):
def get_path_for_link_legacy(self, link):
# type: (Link) -> str
parts = self._get_cache_path_parts_legacy(link)
assert self.cache_dir
return os.path.join(self.cache_dir, "wheels", *parts)
def get_path_for_link(self, link):
@ -204,7 +202,7 @@ class SimpleWheelCache(Cache):
:param link: The link of the sdist for which this will cache wheels.
"""
parts = self._get_cache_path_parts(link)
assert self.cache_dir
# Store wheels within the root cache_dir
return os.path.join(self.cache_dir, "wheels", *parts)