Skip to content

Commit b322aea

Browse files
authored
Merge branch 'master' into ki-in-new-task
2 parents 5028426 + 15facd9 commit b322aea

File tree

95 files changed

+1182
-1349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1182
-1349
lines changed

.style.yapf

Lines changed: 0 additions & 185 deletions
This file was deleted.

check.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ python ./trio/_tools/gen_exports.py --test \
1313
# see https://forum.bors.tech/t/pre-test-and-pre-merge-hooks/322)
1414
# autoflake --recursive --in-place .
1515
# pyupgrade --py3-plus $(find . -name "*.py")
16-
yapf -rpd setup.py trio \
16+
black --diff setup.py trio \
1717
|| EXIT_STATUS=$?
1818

1919
# Run flake8 without pycodestyle and import-related errors
@@ -31,7 +31,7 @@ Problems were found by static analysis (listed above).
3131
To fix formatting and see remaining errors, run
3232
3333
pip install -r test-requirements.txt
34-
yapf -rpi setup.py trio
34+
black setup.py trio
3535
./check.sh
3636
3737
in your local checkout.

docs/source/contributing.rst

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ in separate sections below:
133133
adding a test to make sure it stays fixed.
134134

135135
* :ref:`pull-request-formatting`: If you changed Python code, then did
136-
you run ``yapf -rpi setup.py trio``? (Or for other packages, replace
136+
you run ``black setup.py trio``? (Or for other packages, replace
137137
``trio`` with the package name.)
138138

139139
* :ref:`pull-request-release-notes`: If your change affects
@@ -285,31 +285,30 @@ of eyes can be helpful when trying to come up with devious tricks.
285285
Code formatting
286286
~~~~~~~~~~~~~~~
287287

288-
Instead of wasting time arguing about code formatting, we use `yapf
289-
<https://github.com/google/yapf>`__ to automatically format all our
288+
Instead of wasting time arguing about code formatting, we use `black
289+
<https://github.com/psf/black>`__ to automatically format all our
290290
code to a standard style. While you're editing code you can be as
291291
sloppy as you like about whitespace; and then before you commit, just
292292
run::
293293

294-
pip install -U yapf
295-
yapf -rpi setup.py trio
294+
pip install -U black
295+
black setup.py trio
296296

297297
to fix it up. (And don't worry if you forget – when you submit a pull
298298
request then we'll automatically check and remind you.) Hopefully this
299299
will let you focus on more important style issues like choosing good
300300
names, writing useful comments, and making sure your docstrings are
301-
nicely formatted. (Yapf doesn't reformat comments or docstrings.)
301+
nicely formatted. (black doesn't reformat comments or docstrings.)
302302

303-
Very occasionally, yapf will generate really ugly and unreadable
304-
formatting (usually for large literal structures like dicts nested
305-
inside dicts). In these cases, you can add a ``# yapf: disable``
306-
comment to tell it to leave that particular statement alone.
303+
Very occasionally, you'll want to override black formatting. To do so,
304+
you can can add ``# fmt: off`` and ``# fmt: on`` comments.
307305

308-
If you want to see what changes yapf will make, you can use::
306+
If you want to see what changes black will make, you can use::
309307

310-
yapf -rpd setup.py trio
308+
black --diff setup.py trio
311309

312-
(``-d`` displays a diff, versus ``-i`` which fixes files in-place.)
310+
(``--diff`` displays a diff, versus the default mode which fixes files
311+
in-place.)
313312

314313

315314
.. _pull-request-release-notes:

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[tool.black]
2+
target-version = ['py36']
3+
4+
15
[tool.towncrier]
26
# Usage:
37
# - PRs should drop a file like "issuenumber.feature" in newsfragments

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
# cffi 1.14 fixes memory leak inside ffi.getwinerror()
9090
# cffi is required on Windows, except on PyPy where it is built-in
9191
"cffi>=1.14; os_name == 'nt' and implementation_name != 'pypy'",
92-
"contextvars>=2.1; python_version < '3.7'"
92+
"contextvars>=2.1; python_version < '3.7'",
9393
],
9494
# This means, just install *everything* you see under trio/, even if it
9595
# doesn't look like a source file, so long as it appears in MANIFEST.in:

test-requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pylint # for pylint finding all symbols tests
88
jedi # for jedi code completion tests
99

1010
# Tools
11-
yapf ==0.30.0 # formatting
11+
black; implementation_name == "cpython"
1212
flake8
1313
astor # code generation
1414

test-requirements.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,24 @@
44
#
55
# pip-compile --output-file test-requirements.txt test-requirements.in
66
#
7+
appdirs==1.4.4 # via black
8+
appnope==0.1.0 # via ipython
79
astor==0.8.1 # via -r test-requirements.in
810
astroid==2.4.1 # via pylint
911
async-generator==1.10 # via -r test-requirements.in
10-
attrs==19.3.0 # via -r test-requirements.in, outcome, pytest
12+
attrs==19.3.0 # via -r test-requirements.in, black, outcome, pytest
1113
backcall==0.1.0 # via ipython
14+
black==19.10b0 ; implementation_name == "cpython" # via -r test-requirements.in
1215
cffi==1.14.0 # via cryptography
16+
click==7.1.2 # via black
17+
contextvars==2.4 ; python_version < "3.7" # via -r test-requirements.in, sniffio
1318
coverage==5.1 # via pytest-cov
1419
cryptography==2.9.2 # via pyopenssl, trustme
1520
decorator==4.4.2 # via ipython, traitlets
1621
flake8==3.8.1 # via -r test-requirements.in
1722
idna==2.9 # via -r test-requirements.in, trustme
18-
immutables==0.14 # via -r test-requirements.in
23+
immutables==0.14 # via -r test-requirements.in, contextvars
24+
importlib-metadata==1.6.0 # via flake8, pluggy, pytest
1925
ipython-genutils==0.2.0 # via traitlets
2026
ipython==7.14.0 # via -r test-requirements.in
2127
isort==4.3.21 # via pylint
@@ -26,6 +32,7 @@ more-itertools==8.3.0 # via pytest
2632
outcome==1.0.1 # via -r test-requirements.in
2733
packaging==20.4 # via pytest
2834
parso==0.7.0 # via jedi
35+
pathspec==0.8.0 # via black
2936
pexpect==4.8.0 # via ipython
3037
pickleshare==0.7.5 # via ipython
3138
pluggy==0.13.1 # via pytest
@@ -41,12 +48,14 @@ pyopenssl==19.1.0 # via -r test-requirements.in
4148
pyparsing==2.4.7 # via packaging
4249
pytest-cov==2.8.1 # via -r test-requirements.in
4350
pytest==5.4.2 # via -r test-requirements.in, pytest-cov
51+
regex==2020.5.14 # via black
4452
six==1.15.0 # via astroid, cryptography, packaging, pyopenssl, traitlets
4553
sniffio==1.1.0 # via -r test-requirements.in
4654
sortedcontainers==2.1.0 # via -r test-requirements.in
47-
toml==0.10.1 # via pylint
55+
toml==0.10.1 # via black, pylint
4856
traitlets==4.3.3 # via ipython
4957
trustme==0.6.0 # via -r test-requirements.in
58+
typed-ast==1.4.1 ; python_version < "3.8" and implementation_name == "cpython" # via -r test-requirements.in, astroid, black
5059
wcwidth==0.1.9 # via prompt-toolkit, pytest
5160
wrapt==1.12.1 # via astroid
52-
yapf==0.30.0 # via -r test-requirements.in
61+
zipp==3.1.0 # via importlib-metadata

0 commit comments

Comments
 (0)