Clean up Python 3.8 remnants (#4473)
This commit is contained in:
parent
1b2427a2b7
commit
32ebb93003
@ -38,7 +38,7 @@ Try it out now using the [Black Playground](https://black.vercel.app). Watch the
|
|||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
_Black_ can be installed by running `pip install black`. It requires Python 3.8+ to run.
|
_Black_ can be installed by running `pip install black`. It requires Python 3.9+ to run.
|
||||||
If you want to format Jupyter Notebooks, install with `pip install "black[jupyter]"`.
|
If you want to format Jupyter Notebooks, install with `pip install "black[jupyter]"`.
|
||||||
|
|
||||||
If you can't wait for the latest _hotness_ and want to install from GitHub, use:
|
If you can't wait for the latest _hotness_ and want to install from GitHub, use:
|
||||||
|
@ -76,7 +76,7 @@ def _initialize_black_env(upgrade=False):
|
|||||||
|
|
||||||
pyver = sys.version_info[:3]
|
pyver = sys.version_info[:3]
|
||||||
if pyver < (3, 8):
|
if pyver < (3, 8):
|
||||||
print("Sorry, Black requires Python 3.8+ to run.")
|
print("Sorry, Black requires Python 3.9+ to run.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
11
docs/faq.md
11
docs/faq.md
@ -84,16 +84,17 @@ See [Using _Black_ with other tools](labels/why-pycodestyle-warnings).
|
|||||||
|
|
||||||
## Which Python versions does Black support?
|
## Which Python versions does Black support?
|
||||||
|
|
||||||
Currently the runtime requires Python 3.8-3.11. Formatting is supported for files
|
_Black_ generally supports all Python versions supported by CPython (see
|
||||||
containing syntax from Python 3.3 to 3.11. We promise to support at least all Python
|
[the Python devguide](https://devguide.python.org/versions/) for current information).
|
||||||
versions that have not reached their end of life. This is the case for both running
|
We promise to support at least all Python versions that have not reached their end of
|
||||||
_Black_ and formatting code.
|
life. This is the case for both running _Black_ and formatting code.
|
||||||
|
|
||||||
Support for formatting Python 2 code was removed in version 22.0. While we've made no
|
Support for formatting Python 2 code was removed in version 22.0. While we've made no
|
||||||
plans to stop supporting older Python 3 minor versions immediately, their support might
|
plans to stop supporting older Python 3 minor versions immediately, their support might
|
||||||
also be removed some time in the future without a deprecation period.
|
also be removed some time in the future without a deprecation period.
|
||||||
|
|
||||||
Runtime support for 3.7 was removed in version 23.7.0.
|
Runtime support for 3.6 was removed in version 22.10.0, for 3.7 in version 23.7.0, and
|
||||||
|
for 3.8 in version 24.10.0.
|
||||||
|
|
||||||
## Why does my linter or typechecker complain after I format my code?
|
## Why does my linter or typechecker complain after I format my code?
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ Also, you can try out _Black_ online for minimal fuss on the
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
_Black_ can be installed by running `pip install black`. It requires Python 3.8+ to run.
|
_Black_ can be installed by running `pip install black`. It requires Python 3.9+ to run.
|
||||||
If you want to format Jupyter Notebooks, install with `pip install "black[jupyter]"`.
|
If you want to format Jupyter Notebooks, install with `pip install "black[jupyter]"`.
|
||||||
|
|
||||||
If you use pipx, you can install Black with `pipx install black`.
|
If you use pipx, you can install Black with `pipx install black`.
|
||||||
|
@ -236,7 +236,7 @@ Configuration:
|
|||||||
|
|
||||||
#### Installation
|
#### Installation
|
||||||
|
|
||||||
This plugin **requires Vim 7.0+ built with Python 3.8+ support**. It needs Python 3.8 to
|
This plugin **requires Vim 7.0+ built with Python 3.9+ support**. It needs Python 3.9 to
|
||||||
be able to run _Black_ inside the Vim process which is much faster than calling an
|
be able to run _Black_ inside the Vim process which is much faster than calling an
|
||||||
external command.
|
external command.
|
||||||
|
|
||||||
|
@ -70,17 +70,17 @@ See also [the style documentation](labels/line-length).
|
|||||||
|
|
||||||
Python versions that should be supported by Black's output. You can run `black --help`
|
Python versions that should be supported by Black's output. You can run `black --help`
|
||||||
and look for the `--target-version` option to see the full list of supported versions.
|
and look for the `--target-version` option to see the full list of supported versions.
|
||||||
You should include all versions that your code supports. If you support Python 3.8
|
You should include all versions that your code supports. If you support Python 3.11
|
||||||
through 3.11, you should write:
|
through 3.13, you should write:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ black -t py38 -t py39 -t py310 -t py311
|
$ black -t py311 -t py312 -t py313
|
||||||
```
|
```
|
||||||
|
|
||||||
In a [configuration file](#configuration-via-a-file), you can write:
|
In a [configuration file](#configuration-via-a-file), you can write:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
target-version = ["py38", "py39", "py310", "py311"]
|
target-version = ["py311", "py312", "py313"]
|
||||||
```
|
```
|
||||||
|
|
||||||
By default, Black will infer target versions from the project metadata in
|
By default, Black will infer target versions from the project metadata in
|
||||||
|
@ -21,7 +21,7 @@ endif
|
|||||||
|
|
||||||
if v:version < 700 || !has('python3')
|
if v:version < 700 || !has('python3')
|
||||||
func! __BLACK_MISSING()
|
func! __BLACK_MISSING()
|
||||||
echo "The black.vim plugin requires vim7.0+ with Python 3.6 support."
|
echo "The black.vim plugin requires vim7.0+ with Python 3.9 support."
|
||||||
endfunc
|
endfunc
|
||||||
command! Black :call __BLACK_MISSING()
|
command! Black :call __BLACK_MISSING()
|
||||||
command! BlackUpgrade :call __BLACK_MISSING()
|
command! BlackUpgrade :call __BLACK_MISSING()
|
||||||
@ -72,12 +72,11 @@ endif
|
|||||||
|
|
||||||
function BlackComplete(ArgLead, CmdLine, CursorPos)
|
function BlackComplete(ArgLead, CmdLine, CursorPos)
|
||||||
return [
|
return [
|
||||||
\ 'target_version=py27',
|
|
||||||
\ 'target_version=py36',
|
|
||||||
\ 'target_version=py37',
|
|
||||||
\ 'target_version=py38',
|
|
||||||
\ 'target_version=py39',
|
\ 'target_version=py39',
|
||||||
\ 'target_version=py310',
|
\ 'target_version=py310',
|
||||||
|
\ 'target_version=py311',
|
||||||
|
\ 'target_version=py312',
|
||||||
|
\ 'target_version=py313',
|
||||||
\ ]
|
\ ]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# flags: --minimum-version=3.8
|
|
||||||
with \
|
with \
|
||||||
make_context_manager1() as cm1, \
|
make_context_manager1() as cm1, \
|
||||||
make_context_manager2() as cm2, \
|
make_context_manager2() as cm2, \
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# flags: --minimum-version=3.9
|
|
||||||
with \
|
with \
|
||||||
make_context_manager1() as cm1, \
|
make_context_manager1() as cm1, \
|
||||||
make_context_manager2() as cm2, \
|
make_context_manager2() as cm2, \
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# flags: --minimum-version=3.9
|
|
||||||
# This file uses parenthesized context managers introduced in Python 3.9.
|
# This file uses parenthesized context managers introduced in Python 3.9.
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# flags: --minimum-version=3.8
|
|
||||||
def positional_only_arg(a, /):
|
def positional_only_arg(a, /):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# flags: --minimum-version=3.8
|
|
||||||
(a := 1)
|
(a := 1)
|
||||||
(a := a)
|
(a := a)
|
||||||
if (match := pattern.search(data)) is None:
|
if (match := pattern.search(data)) is None:
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# flags: --minimum-version=3.9
|
|
||||||
# Unparenthesized walruses are now allowed in set literals & set comprehensions
|
# Unparenthesized walruses are now allowed in set literals & set comprehensions
|
||||||
# since Python 3.9
|
# since Python 3.9
|
||||||
{x := 1, 2, 3}
|
{x := 1, 2, 3}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# flags: --minimum-version=3.8
|
|
||||||
if (foo := 0):
|
if (foo := 0):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
# flags: --minimum-version=3.7
|
|
||||||
|
|
||||||
|
|
||||||
def f():
|
def f():
|
||||||
return (i * 2 async for i in arange(42))
|
return (i * 2 async for i in arange(42))
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
# flags: --minimum-version=3.8
|
|
||||||
|
|
||||||
|
|
||||||
def starred_return():
|
def starred_return():
|
||||||
my_list = ["value2", "value3"]
|
my_list = ["value2", "value3"]
|
||||||
return "value1", *my_list
|
return "value1", *my_list
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
# flags: --minimum-version=3.9
|
|
||||||
|
|
||||||
@relaxed_decorator[0]
|
@relaxed_decorator[0]
|
||||||
def f():
|
def f():
|
||||||
...
|
...
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# flags: --minimum-version=3.9
|
|
||||||
with (open("bla.txt")):
|
with (open("bla.txt")):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user