mirror of https://github.com/pypa/pip
update mypy to 0.730
This commit is contained in:
parent
d27488d288
commit
64dacbf888
|
@ -25,7 +25,7 @@ repos:
|
|||
files: \.py$
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v0.720
|
||||
rev: v0.730
|
||||
hooks:
|
||||
- id: mypy
|
||||
exclude: docs|tests
|
||||
|
|
|
@ -227,7 +227,8 @@ def _get_win_folder_with_ctypes(csidl_name):
|
|||
}[csidl_name]
|
||||
|
||||
buf = ctypes.create_unicode_buffer(1024)
|
||||
ctypes.windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf)
|
||||
windll = ctypes.windll # type: ignore
|
||||
windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf)
|
||||
|
||||
# Downgrade to short path name if have highbit chars. See
|
||||
# <http://bugs.activestate.com/show_bug.cgi?id=85099>.
|
||||
|
@ -238,7 +239,7 @@ def _get_win_folder_with_ctypes(csidl_name):
|
|||
break
|
||||
if has_high_char:
|
||||
buf2 = ctypes.create_unicode_buffer(1024)
|
||||
if ctypes.windll.kernel32.GetShortPathNameW(buf.value, buf2, 1024):
|
||||
if windll.kernel32.GetShortPathNameW(buf.value, buf2, 1024):
|
||||
buf = buf2
|
||||
|
||||
# The type: ignore is explained under the type annotation for this function
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
"""Filetype information.
|
||||
"""
|
||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from typing import Tuple
|
||||
|
||||
WHEEL_EXTENSION = '.whl'
|
||||
BZ2_EXTENSIONS = ('.tar.bz2', '.tbz')
|
||||
XZ_EXTENSIONS = ('.tar.xz', '.txz', '.tlz', '.tar.lz', '.tar.lzma')
|
||||
ZIP_EXTENSIONS = ('.zip', WHEEL_EXTENSION)
|
||||
TAR_EXTENSIONS = ('.tar.gz', '.tgz', '.tar')
|
||||
BZ2_EXTENSIONS = ('.tar.bz2', '.tbz') # type: Tuple[str, ...]
|
||||
XZ_EXTENSIONS = ('.tar.xz', '.txz', '.tlz',
|
||||
'.tar.lz', '.tar.lzma') # type: Tuple[str, ...]
|
||||
ZIP_EXTENSIONS = ('.zip', WHEEL_EXTENSION) # type: Tuple[str, ...]
|
||||
TAR_EXTENSIONS = ('.tar.gz', '.tgz', '.tar') # type: Tuple[str, ...]
|
||||
ARCHIVE_EXTENSIONS = (
|
||||
ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS
|
||||
)
|
||||
|
|
|
@ -55,7 +55,7 @@ from pip._internal.utils.urls import path_to_url
|
|||
if MYPY_CHECK_RUNNING:
|
||||
from typing import (
|
||||
Dict, List, Optional, Sequence, Mapping, Tuple, IO, Text, Any,
|
||||
Iterable, Callable,
|
||||
Iterable, Callable, Set,
|
||||
)
|
||||
from pip._vendor.packaging.requirements import Requirement
|
||||
from pip._internal.req.req_install import InstallRequirement
|
||||
|
@ -207,7 +207,7 @@ def message_about_scripts_not_on_PATH(scripts):
|
|||
return None
|
||||
|
||||
# Group scripts by the path they were installed in
|
||||
grouped_by_dir = collections.defaultdict(set) # type: Dict[str, set]
|
||||
grouped_by_dir = collections.defaultdict(set) # type: Dict[str, Set[str]]
|
||||
for destfile in scripts:
|
||||
parent_dir = os.path.dirname(destfile)
|
||||
script_name = os.path.basename(destfile)
|
||||
|
@ -224,14 +224,14 @@ def message_about_scripts_not_on_PATH(scripts):
|
|||
warn_for = {
|
||||
parent_dir: scripts for parent_dir, scripts in grouped_by_dir.items()
|
||||
if os.path.normcase(parent_dir) not in not_warn_dirs
|
||||
}
|
||||
} # type: Dict[str, Set[str]]
|
||||
if not warn_for:
|
||||
return None
|
||||
|
||||
# Format a message
|
||||
msg_lines = []
|
||||
for parent_dir, scripts in warn_for.items():
|
||||
sorted_scripts = sorted(scripts) # type: List[str]
|
||||
for parent_dir, dir_scripts in warn_for.items():
|
||||
sorted_scripts = sorted(dir_scripts) # type: List[str]
|
||||
if len(sorted_scripts) == 1:
|
||||
start_text = "script {} is".format(sorted_scripts[0])
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue