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

Convert type comments

This commit is contained in:
harupy 2021-07-23 23:51:54 +09:00
parent 2de3af1747
commit 6ff78f0b59
4 changed files with 7 additions and 8 deletions

View file

@ -502,7 +502,7 @@ class CandidateEvaluator:
"""
valid_tags = self._supported_tags
support_num = len(valid_tags)
build_tag = () # type: BuildTag
build_tag: BuildTag = ()
binary_preference = 0
link = candidate.link
if link.is_wheel:
@ -603,7 +603,7 @@ class PackageFinder:
self.format_control = format_control
# These are boring links that have already been logged somehow.
self._logged_links = set() # type: Set[Link]
self._logged_links: Set[Link] = set()
# Don't include an allow_yanked default value to make sure each call
# site considers whether yanked releases are allowed. This also causes
@ -699,7 +699,7 @@ class PackageFinder:
second, while eliminating duplicates
"""
eggs, no_eggs = [], []
seen = set() # type: Set[Link]
seen: Set[Link] = set()
for link in links:
if link not in seen:
seen.add(link)
@ -871,7 +871,7 @@ class PackageFinder:
)
best_candidate = best_candidate_result.best_candidate
installed_version = None # type: Optional[_BaseVersion]
installed_version: Optional[_BaseVersion] = None
if req.satisfied_by is not None:
installed_version = parse_version(req.satisfied_by.version)

View file

@ -36,7 +36,7 @@ class SearchScope:
# it and if it exists, use the normalized version.
# This is deliberately conservative - it might be fine just to
# blindly normalize anything starting with a ~...
built_find_links = [] # type: List[str]
built_find_links: List[str] = []
for link in find_links:
if link.startswith('~'):
new_link = normalize_path(link)

View file

@ -23,8 +23,7 @@ class SelectionPreferences:
format_control: Optional[FormatControl] = None,
prefer_binary: bool = False,
ignore_requires_python: Optional[bool] = None,
):
# type: (...) -> None
) -> None:
"""Create a SelectionPreferences object.
:param allow_yanked: Whether files marked as yanked (in the sense

View file

@ -62,7 +62,7 @@ class TargetPython:
self.py_version_info = py_version_info
# This is used to cache the return value of get_tags().
self._valid_tags = None # type: Optional[List[Tag]]
self._valid_tags: Optional[List[Tag]] = None
def format_given(self) -> str:
"""