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

Add type annotations in find_egg_info

This commit is contained in:
Pradyun Gedam 2019-09-30 13:00:36 +05:30
parent e600aebe7d
commit 628dfd9fab
No known key found for this signature in database
GPG key ID: DA17C4B29CB32E4B

View file

@ -36,13 +36,15 @@ def find_egg_info(install_req):
# type: (InstallRequirement) -> str
def looks_like_virtual_env(path):
# type: (str) -> bool
return (
os.path.lexists(os.path.join(path, 'bin', 'python')) or
os.path.exists(os.path.join(path, 'Scripts', 'Python.exe'))
)
def locate_editable_egg_info(base):
candidates = []
# type: (str) -> List[str]
candidates = [] # type: List[str]
for root, dirs, files in os.walk(base):
for dir_ in vcs.dirnames:
if dir_ in dirs:
@ -60,6 +62,7 @@ def find_egg_info(install_req):
return [f for f in candidates if f.endswith('.egg-info')]
def depth_of_directory(dir_):
# type: (str) -> int
return (
dir_.count(os.path.sep) +
(os.path.altsep and dir_.count(os.path.altsep) or 0)