Remove redundant 3.6 code and bump mypy's python_version to 3.7 (#3313)
This commit is contained in:
parent
27d20144a7
commit
b60b85b234
@ -57,8 +57,8 @@ def _get_virtualenv_site_packages(venv_path, pyver):
|
|||||||
|
|
||||||
def _initialize_black_env(upgrade=False):
|
def _initialize_black_env(upgrade=False):
|
||||||
pyver = sys.version_info[:3]
|
pyver = sys.version_info[:3]
|
||||||
if pyver < (3, 6, 2):
|
if pyver < (3, 7):
|
||||||
print("Sorry, Black requires Python 3.6.2+ to run.")
|
print("Sorry, Black requires Python 3.7+ to run.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
7
mypy.ini
7
mypy.ini
@ -2,7 +2,7 @@
|
|||||||
# Specify the target platform details in config, so your developers are
|
# Specify the target platform details in config, so your developers are
|
||||||
# free to run mypy on Windows, Linux, or macOS and get consistent
|
# free to run mypy on Windows, Linux, or macOS and get consistent
|
||||||
# results.
|
# results.
|
||||||
python_version=3.6
|
python_version=3.7
|
||||||
|
|
||||||
mypy_path=src
|
mypy_path=src
|
||||||
|
|
||||||
@ -19,11 +19,6 @@ no_implicit_reexport = False
|
|||||||
# to avoid 'em in the first place.
|
# to avoid 'em in the first place.
|
||||||
warn_unreachable=True
|
warn_unreachable=True
|
||||||
|
|
||||||
[mypy-black]
|
|
||||||
# The following is because of `patch_click()`. Remove when
|
|
||||||
# we drop Python 3.6 support.
|
|
||||||
warn_unused_ignores=False
|
|
||||||
|
|
||||||
[mypy-blib2to3.driver.*]
|
[mypy-blib2to3.driver.*]
|
||||||
ignore_missing_imports = True
|
ignore_missing_imports = True
|
||||||
|
|
||||||
|
@ -1382,9 +1382,9 @@ def patch_click() -> None:
|
|||||||
|
|
||||||
for module in modules:
|
for module in modules:
|
||||||
if hasattr(module, "_verify_python3_env"):
|
if hasattr(module, "_verify_python3_env"):
|
||||||
module._verify_python3_env = lambda: None # type: ignore
|
module._verify_python3_env = lambda: None
|
||||||
if hasattr(module, "_verify_python_env"):
|
if hasattr(module, "_verify_python_env"):
|
||||||
module._verify_python_env = lambda: None # type: ignore
|
module._verify_python_env = lambda: None
|
||||||
|
|
||||||
|
|
||||||
def patched_main() -> None:
|
def patched_main() -> None:
|
||||||
|
@ -47,12 +47,8 @@ def cancel(tasks: Iterable["asyncio.Task[Any]"]) -> None:
|
|||||||
def shutdown(loop: asyncio.AbstractEventLoop) -> None:
|
def shutdown(loop: asyncio.AbstractEventLoop) -> None:
|
||||||
"""Cancel all pending tasks on `loop`, wait for them, and close the loop."""
|
"""Cancel all pending tasks on `loop`, wait for them, and close the loop."""
|
||||||
try:
|
try:
|
||||||
if sys.version_info[:2] >= (3, 7):
|
|
||||||
all_tasks = asyncio.all_tasks
|
|
||||||
else:
|
|
||||||
all_tasks = asyncio.Task.all_tasks
|
|
||||||
# This part is borrowed from asyncio/runners.py in Python 3.7b2.
|
# This part is borrowed from asyncio/runners.py in Python 3.7b2.
|
||||||
to_cancel = [task for task in all_tasks(loop) if not task.done()]
|
to_cancel = [task for task in asyncio.all_tasks(loop) if not task.done()]
|
||||||
if not to_cancel:
|
if not to_cancel:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -27,8 +27,7 @@
|
|||||||
try:
|
try:
|
||||||
from typed_ast import ast3
|
from typed_ast import ast3
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Either our python version is too low, or we're on pypy
|
if sys.version_info < (3, 8) and not _IS_PYPY:
|
||||||
if sys.version_info < (3, 7) or (sys.version_info < (3, 8) and not _IS_PYPY):
|
|
||||||
print(
|
print(
|
||||||
"The typed_ast package is required but not installed.\n"
|
"The typed_ast package is required but not installed.\n"
|
||||||
"You can upgrade to Python 3.8+ or install typed_ast with\n"
|
"You can upgrade to Python 3.8+ or install typed_ast with\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user