Add mypy annotations to pip._internal.req.constructors

This commit is contained in:
Devesh Kumar Singh 2020-05-17 04:37:53 +05:30
parent f34f8d501f
commit ea3aa04987
2 changed files with 3 additions and 6 deletions

View File

@ -8,9 +8,6 @@ These are meant to be used elsewhere within pip to create instances of
InstallRequirement.
"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
import logging
import os
import re
@ -188,7 +185,7 @@ class RequirementParts(object):
requirement, # type: Optional[Requirement]
link, # type: Optional[Link]
markers, # type: Optional[Marker]
extras, # type: Set[str]
extras, # type: Optional[Set[str]]
):
self.requirement = requirement
self.link = link
@ -264,7 +261,7 @@ def _looks_like_path(name):
def _get_url_from_path(path, name):
# type: (str, str) -> str
# type: (str, str) -> Optional[str]
"""
First, it checks whether a provided path is an installable directory
(e.g. it has a setup.py). If it is, returns the path.

View File

@ -110,7 +110,7 @@ class InstallRequirement(object):
global_options=None, # type: Optional[List[str]]
hash_options=None, # type: Optional[Dict[str, List[str]]]
constraint=False, # type: bool
extras=() # type: Iterable[str]
extras=() # type: Optional[Iterable[str]]
):
# type: (...) -> None
assert req is None or isinstance(req, Requirement), req