Commit Graph

1372 Commits

Author SHA1 Message Date
dependabot[bot]
e9e756da7a
Bump sphinx from 5.0.2 to 5.1.0 in /docs (#3183)
Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 5.0.2 to 5.1.0.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/5.x/CHANGES)
- [Commits](https://github.com/sphinx-doc/sphinx/compare/v5.0.2...v5.1.0)

---
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-26 20:51:32 -04:00
Yilei "Dolee" Yang
b4dc40bf7a
Use underscores instead of a space in a test file's name (#3180)
... for *consistency*
2022-07-19 21:33:00 -04:00
Yilei "Dolee" Yang
249c6536c4
Fix an infinite loop when using # fmt: on/off ... (#3158)
... in the middle of an expression or code block by adding a missing return.

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-07-19 20:57:23 -04:00
Yilei "Dolee" Yang
6ea4eddf93
Fix the handling of # fmt: skip when it's at a colon line (#3148)
When the Leaf node with `# fmt: skip` is a NEWLINE inside a `suite`
Node, the nodes to ignore should be from the siblings of the parent
`suite` Node.

There is a also a special case for the ASYNC token, where it expands
to the grandparent Node where the ASYNC token is.

This fixes GH-2646, GH-3126, GH-2680, GH-2421, GH-2339, and GH-2138.
2022-07-19 17:26:11 -04:00
Thomas Grainger
1b6de7b0a3
Improve warning filtering in tests (#3175) 2022-07-18 19:17:13 -07:00
Thomas Grainger
33f0d9e79a
Add pypy-3.8 to test matrix (#3174) 2022-07-16 21:55:46 -04:00
Thomas Grainger
df5a87d93b
configure strict pytest and filterwarnings=['error', ... (#3173)
* configure strict pytest

* ignore current warnings
2022-07-16 13:18:55 +01:00
onescriptkid
b0eed7c6bd
Fix typo in config docs for --extend-exclude (#3170)
The old regex in the example was invalid and caused an error on startup.
2022-07-14 19:51:18 -04:00
Richard Si
ad5c315dda
Actually disable docstring prefix normalization with -S + fix instability (#3168)
The former was a regression I introduced a long time ago. To avoid
changing the stable style too much, the regression is only fixed if
--preview is enabled

Annoyingly enough, as we currently always enforce a second format pass if
changes were made, there's no good way to prove the existence of the
docstring quote normalization instability issue. For posterity, here's
one failing example:

    --- source
    +++ first pass
    @@ -1,7 +1,7 @@
     def some_function(self):
    -    ''''<text here>
    +    """ '<text here>

         <text here, since without another non-empty line black is stable>

    -    '''
    +    """
         pass
    --- first pass
    +++ second pass
    @@ -1,7 +1,7 @@
     def some_function(self):
    -    """ '<text here>
    +    """'<text here>

         <text here, since without another non-empty line black is stable>

         """
         pass

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-07-14 19:47:33 -04:00
Cooper Lees
9aa33f467b
Move to explicitly creating a new loop (#3164)
* Move to explicitly creating a new loop

- >= 3.10 add a warning that `get_event_loop` will not automatically create a loop
- Move to explicit API

Test:
- `python3.11 -m venv --upgrade-deps /tmp/tb`
  - `/tmp/tb/bin/pip install -e .`
  - Install deps and no blackd as aiohttp + yarl can't build still with 3.11
  - https://github.com/aio-libs/aiohttp/issues/6600
- `export PYTHONWARNINGS=error`
```
cooper@l33t:~/repos/black$ /tmp/tb/bin/black .
All done!  🍰 
44 files left unchanged.
```

Fixes #3110

* Add to CHANGES.md

* Fix a cooper typo yet again

* Set default asyncio loop to our explicitly created one + unset on exit

* Update CHANGES.md

Fix my silly typo.

Co-authored-by: Thomas Grainger <tagrain@gmail.com>

Co-authored-by: Cooper Ry Lees <me@wcooperlees.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-14 15:24:34 -07:00
Nimrod
8900e3ac8a
Add warning to not run blackd publicly in docs (#3167)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-07-14 15:22:29 -04:00
Richard Si
4f0532d6f0
Don't (ever) put a single-char closing docstring quote on a new line (#3166)
Doing so is invalid. Note this only fixes the preview style since the
logic putting closing docstring quotes on their own line if they violate
the line length limit is quite new.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-07-13 22:26:05 -04:00
Richard Si
18c17bea75
Copy over comments when hugging power ops (#2874)
Otherwise they'd be deleted which was a regression in 22.1.0 (oops! my
bad!). Also type comments are now tracked in the AST safety check on all
compatible platforms to error out if this happens again.

Overall the line rewriting code has been rewritten to do "the right
thing (tm)", I hope this fixes other potential bugs in the code (fwiw I
got to drop the bugfix in blib2to3.pytree.Leaf.clone since now bracket
metadata is properly copied over).

Fixes #2873
2022-07-13 17:02:51 -07:00
Maciej Olko
05b63c4bcc
Recommend using BlackConnect in IntelliJ IDEs (#3150)
* Recommend using BlackConnect in IntelliJ IDEs

* IntelliJ IDEs integration docs: improve formatting

* Add changelog for recommending BlackConnect

* IntelliJ IDEs integration docs: improve formatting

* Apply suggestions from code review

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>

* Fix indentation

* Apply italic to Black name

Consequently with other places in the document

* Move CHANGELOG entry to Unreleased section

* IntelliJ IDEs integration docs: bring back a point with formatting a file

* IntelliJ IDEs integration docs: fix extra whitespace and linebreak

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2022-07-11 09:27:51 -07:00
Jelle Zijlstra
7af77d1cf1
Stability policy: permit exceptional changes for unformatted code (#3155) 2022-07-06 13:33:07 -04:00
Jakub Kuczys
b859a377c0
Use RTD's new build process and config (#3149)
See the deprecation notice:
https://docs.readthedocs.io/en/stable/config-file/v2.html#python-version
2022-07-03 16:47:18 -04:00
Dimitri Merejkowsky
6debce63bc
Fix typo in CHANGES.md (#3142) 2022-06-28 10:44:55 +03:00
Richard Si
f6c139c521
Prepare docs for release 22.6.0 (#3139) 2022-06-27 20:33:35 -04:00
Felix Hildén
eb5d175c9c
Update preview style docs to include recent changes (#3136)
Covers GH-2926, GH-2990, GH-2991, and GH-3035.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2022-06-27 16:24:34 -04:00
dependabot[bot]
d848209d38
Bump furo from 2022.6.4.1 to 2022.6.21 in /docs (#3138)
Bumps [furo](https://github.com/pradyunsg/furo) from 2022.6.4.1 to 2022.6.21.
- [Release notes](https://github.com/pradyunsg/furo/releases)
- [Changelog](https://github.com/pradyunsg/furo/blob/main/docs/changelog.md)
- [Commits](https://github.com/pradyunsg/furo/compare/2022.06.04.1...2022.06.21)

---
updated-dependencies:
- dependency-name: furo
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-27 09:54:49 -04:00
Yilei "Dolee" Yang
fa6caa6ca8
Only call get_future_imports when needed (#3135) 2022-06-23 12:41:05 -07:00
dependabot[bot]
6463fb874f
Bump sphinx from 5.0.1 to 5.0.2 in /docs (#3128)
Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 5.0.1 to 5.0.2.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/5.x/CHANGES)
- [Commits](https://github.com/sphinx-doc/sphinx/compare/v5.0.1...v5.0.2)

---
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-20 10:22:24 -04:00
Nate Prewitt
e3c9b0430e
Replace link to Requests documentation (#3125) 2022-06-17 12:37:33 -07:00
Sagi Shadur
6c1bd08f16
Test run black on self (#3114)
* Add run_self environment in tox

* Add run_self task as part of the lint CI flow

* Remove hard coded sources list

* Remove black from pre-commit

Co-authored-by: Cooper Lees <me@cooperlees.com>
2022-06-14 09:08:36 -07:00
Hugo van Kemenade
799adb5323
Bump actions/setup-python from 3 to 4 (#3121)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 3 to 4.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-13 07:02:39 -07:00
Marco Edward Gorelli
162ecd1d2c
Use is_number_token instead of assertion (#3069) 2022-06-11 12:04:09 -04:00
Richard Si
8c8675c62a
Update documentation dependencies (#3118)
Furo, myst-parser, and Sphinx (had to pin docutils due to sphinx breakage)
2022-06-11 11:44:01 -04:00
Sagi Shadur
4bb7bf2bdc
Remove newline after code block open (#3035)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-06-11 09:55:01 +03:00
dependabot[bot]
6d32ab02c5
Bump pre-commit/action from 2.0.3 to 3.0.0 (#3108)
Bumps [pre-commit/action](https://github.com/pre-commit/action) from 2.0.3 to 3.0.0.
- [Release notes](https://github.com/pre-commit/action/releases)
- [Commits](https://github.com/pre-commit/action/compare/v2.0.3...v3.0.0)

---
updated-dependencies:
- dependency-name: pre-commit/action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-10 20:29:32 -04:00
Vivek Vashist
f51e53726b
Fix minor typo (#3096) 2022-06-03 15:59:26 -07:00
Holger Brunn
436e12f290
Add script to ease migration to black (#3038)
* Add script to ease migration to black

* Update CHANGES.md

Co-authored-by: Cooper Lees <me@cooperlees.com>
2022-06-01 11:20:02 -07:00
Batuhan Taskaya
1e557184b0
Implement support for PEP 646 (#3071) 2022-05-26 09:45:22 -07:00
Yusuke Nishioka
9fe788d870
Add more examples to exclude files in addition to the defaults (#3070)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-26 07:44:26 -07:00
laundmo
fdb01f8622
Document new Microsoft Black Formatter extension for VSCode (#3063)
Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2022-05-21 16:18:06 -04:00
Sagi Shadur
2893c42176
Remove hard coded test cases (#3062) 2022-05-18 12:11:37 -07:00
dependabot[bot]
7f033136ac
Bump docker/setup-buildx-action from 1 to 2 (#3058)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-09 22:22:01 -04:00
dependabot[bot]
4af87d8a43
Bump docker/login-action from 1 to 2 (#3059)
Bumps [docker/login-action](https://github.com/docker/login-action) from 1 to 2.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-09 22:13:12 -04:00
dependabot[bot]
ba21a85699
Bump docker/build-push-action from 2 to 3 (#3057)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 2 to 3.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-09 22:11:29 -04:00
dependabot[bot]
5d5b7316db
Bump docker/setup-qemu-action from 1 to 2 (#3056)
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-09 22:08:56 -04:00
Sagi Shadur
fc2a16433e
Read simple data cases automatically (#3034)
Co-authored-by: Felix Hildén <felix.hilden@gmail.com>
2022-05-08 12:27:40 -07:00
Iain Dorrington
20d8ccb542
Put closing quote on a separate line if docstring is too long (#3044)
Fixes #1632

Co-authored-by: Felix Hildén <felix.hilden@gmail.com>
2022-05-07 21:34:28 -07:00
Felix Hildén
62c2b167bc
Docs: clarify fmt:on/off requirements (#2985) (#3048) 2022-05-07 17:58:10 -07:00
Zac Hatfield-Dodds
9ce100ba61
Move imports of ThreadPoolExecutor into reformat_many(), allowing Black-in-the-browser (#3046)
This is a slight perf win for use-cases that don't invoke `reformat_many()`, but more importantly to me today it means I can use Black in pyscript.
2022-05-06 07:06:27 -07:00
Naveen
c940f75d5b
chore: Set permissions for GitHub actions (#3043)
Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
2022-05-03 07:08:33 -06:00
dependabot[bot]
9d5edd3020
Bump myst-parser from 0.16.1 to 0.17.2 in /docs (#3019)
Bumps [myst-parser](https://github.com/executablebooks/MyST-Parser) from 0.16.1 to 0.17.2.
- [Release notes](https://github.com/executablebooks/MyST-Parser/releases)
- [Changelog](https://github.com/executablebooks/MyST-Parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/executablebooks/MyST-Parser/compare/v0.16.1...v0.17.2)

---
updated-dependencies:
- dependency-name: myst-parser
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-02 11:12:23 -06:00
Cooper Lees
fb8dfdeec5
Stop pinning lark-parser (#3041)
- Latest version works more

Test: `tox -e fuzz`
2022-04-28 10:27:16 -06:00
Vadim Nikolaev
c6800e0c65
Fix strtobool function (#3025)
* Fix strtobool function for vim plugin
* Update CHANGES.md

Co-authored-by: Cooper Lees <me@cooperlees.com>
2022-04-28 09:17:23 -06:00
JiriKr
8ed3e3d07e
Updated Black Docker Hub link in docs (#3023)
Fixes #3022
2022-04-21 12:55:56 -07:00
Batuhan Taskaya
7f7673d941
Support 3.11 / PEP 654 syntax (#3016) 2022-04-15 12:25:07 -04:00
Marco Edward Gorelli
712f8b37fb
Make ipynb tests compatible with ipython 8.3.0+ (#3008) 2022-04-13 19:13:33 -04:00