Skip to content

Commit b60b85b

Browse files
authored
Remove redundant 3.6 code and bump mypy's python_version to 3.7 (#3313)
1 parent 27d2014 commit b60b85b

File tree

5 files changed

+7
-17
lines changed

5 files changed

+7
-17
lines changed

autoload/black.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def _get_virtualenv_site_packages(venv_path, pyver):
5757

5858
def _initialize_black_env(upgrade=False):
5959
pyver = sys.version_info[:3]
60-
if pyver < (3, 6, 2):
61-
print("Sorry, Black requires Python 3.6.2+ to run.")
60+
if pyver < (3, 7):
61+
print("Sorry, Black requires Python 3.7+ to run.")
6262
return False
6363

6464
from pathlib import Path

mypy.ini

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Specify the target platform details in config, so your developers are
33
# free to run mypy on Windows, Linux, or macOS and get consistent
44
# results.
5-
python_version=3.6
5+
python_version=3.7
66

77
mypy_path=src
88

@@ -19,11 +19,6 @@ no_implicit_reexport = False
1919
# to avoid 'em in the first place.
2020
warn_unreachable=True
2121

22-
[mypy-black]
23-
# The following is because of `patch_click()`. Remove when
24-
# we drop Python 3.6 support.
25-
warn_unused_ignores=False
26-
2722
[mypy-blib2to3.driver.*]
2823
ignore_missing_imports = True
2924

src/black/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,9 +1382,9 @@ def patch_click() -> None:
13821382

13831383
for module in modules:
13841384
if hasattr(module, "_verify_python3_env"):
1385-
module._verify_python3_env = lambda: None # type: ignore
1385+
module._verify_python3_env = lambda: None
13861386
if hasattr(module, "_verify_python_env"):
1387-
module._verify_python_env = lambda: None # type: ignore
1387+
module._verify_python_env = lambda: None
13881388

13891389

13901390
def patched_main() -> None:

src/black/concurrency.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,8 @@ def cancel(tasks: Iterable["asyncio.Task[Any]"]) -> None:
4747
def shutdown(loop: asyncio.AbstractEventLoop) -> None:
4848
"""Cancel all pending tasks on `loop`, wait for them, and close the loop."""
4949
try:
50-
if sys.version_info[:2] >= (3, 7):
51-
all_tasks = asyncio.all_tasks
52-
else:
53-
all_tasks = asyncio.Task.all_tasks
5450
# This part is borrowed from asyncio/runners.py in Python 3.7b2.
55-
to_cancel = [task for task in all_tasks(loop) if not task.done()]
51+
to_cancel = [task for task in asyncio.all_tasks(loop) if not task.done()]
5652
if not to_cancel:
5753
return
5854

src/black/parsing.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
try:
2828
from typed_ast import ast3
2929
except ImportError:
30-
# Either our python version is too low, or we're on pypy
31-
if sys.version_info < (3, 7) or (sys.version_info < (3, 8) and not _IS_PYPY):
30+
if sys.version_info < (3, 8) and not _IS_PYPY:
3231
print(
3332
"The typed_ast package is required but not installed.\n"
3433
"You can upgrade to Python 3.8+ or install typed_ast with\n"

0 commit comments

Comments
 (0)