Commit Graph

1527 Commits

Author SHA1 Message Date
Jelle Zijlstra
c9efbf9d97
Add SECURITY.md (#3612) 2023-03-18 10:41:48 -07:00
dependabot[bot]
34a93a8d49
Bump peter-evans/create-or-update-comment from 2.1.0 to 2.1.1 (#3548)
Bumps [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) from 2.1.0 to 2.1.1.
- [Release notes](https://github.com/peter-evans/create-or-update-comment/releases)
- [Commits](5adcb0bb0f...67dcc547d3)

---
updated-dependencies:
- dependency-name: peter-evans/create-or-update-comment
  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>
2023-03-17 21:59:33 -07:00
Yilei "Dolee" Yang
268dcb677c
Do not add an extra blank line to an import line that has fmt disabled (#3610) 2023-03-17 21:39:21 -07:00
Yilei "Dolee" Yang
fc6cea0f0e
Consistently format async statements similar to their non-async version. (#3609) 2023-03-16 13:31:27 -07:00
dependabot[bot]
71a2daaacf
Bump pypa/cibuildwheel from 2.11.4 to 2.12.1 (#3602)
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.11.4 to 2.12.1.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.11.4...v2.12.1)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  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>
2023-03-15 00:30:04 -07:00
Casey Korver
6ffc5f7b01
Correct spelling mistakes (#3599) 2023-03-11 07:43:31 -08:00
Yilei "Dolee" Yang
d16a1dbd05
Consistently wrap two context managers in parens (in --preview). (#3589)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-03-09 22:01:20 -08:00
Aneesh Agrawal
4a063a9f8d
Improve multiline string handling (#1879)
Co-authored-by: Olivia Hong <ohong@lyft.com>
Co-authored-by: Olivia Hong <24500729+olivia-hong@users.noreply.github.com>
2023-03-07 11:52:19 -08:00
dependabot[bot]
25d886f52c
Bump peter-evans/find-comment from 2.2.0 to 2.3.0 (#3584)
Bumps [peter-evans/find-comment](https://github.com/peter-evans/find-comment) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/peter-evans/find-comment/releases)
- [Commits](81e2da3af0...034abe94d3)

---
updated-dependencies:
- dependency-name: peter-evans/find-comment
  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>
2023-02-27 06:38:02 -08:00
brucearctor
d9b8a6407e
Update Action example to use checkout@v3 (#3563)
Latest version of `actions/checkout` is v3 (or rather v3.3) so let's
use that in the example now.
2023-02-13 20:24:28 -05:00
Yilei "Dolee" Yang
9c8464ca7d
Fix typos in comments: assignement -> assignment (#3556) 2023-02-07 14:48:09 -08:00
dependabot[bot]
e74a05286b
Bump docker/build-push-action from 3 to 4 (#3549)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3 to 4.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3...v4)

---
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>
2023-02-06 19:56:38 -08:00
Richard Si
e506c46f7b
Rename design label to style because it's clearer (#3547) 2023-02-04 22:51:46 -05:00
mainj12
ff53fc1b97
Actually add trailing commas to collection literals even if there are terminating comments (#3393)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Richard Si <sichard26@gmail.com>
2023-02-04 19:35:43 -08:00
Yilei "Dolee" Yang
ea5293b036
Document the future style changes introduced in #3489 and #3440 (#3541) 2023-02-04 22:30:47 -05:00
Yilei "Dolee" Yang
dd0e912a6e
Fix import of blib2to3.pgen2.driver (#3546) 2023-02-03 22:00:09 -08:00
Jelle Zijlstra
b0d1fba7ac
Prepare release 23.1.0 (#3536)
Co-authored-by: Richard Si <sichard26@gmail.com>
2023-01-31 18:47:11 -08:00
Stijn de Gooijer
69ca0a4c7a
Infer target version based on project metadata (#3219)
Co-authored-by: Richard Si <sichard26@gmail.com>
2023-01-31 18:00:17 -08:00
Jelle Zijlstra
c4bd2e31ce
Draft for Black 2023 stable style (#3418) 2023-01-31 15:39:56 -08:00
Jelle Zijlstra
226cbf0226
Fix unsafe cast in linegen.py w/ await yield handling (#3533)
Fixes #3532.
2023-01-30 21:53:14 -05:00
Jelle Zijlstra
f4ebc68320
Upgrade isort (#3534)
See PyCQA/isort#2077.
2023-01-30 18:45:12 -08:00
Evan Chen
6407ebb870
Remove Python version in the_basics.md (#3528) 2023-01-28 16:12:11 -08:00
Edouard Choinière
196b1f349e
Fix black --help output for --python-cell-magics option to be reproducible (#3516) 2023-01-24 05:43:24 -08:00
Yilei "Dolee" Yang
d950f15987
Update document now that paren wrapping CMs on Python 3.9+ is implemented (#3520) 2023-01-23 21:38:30 -08:00
Yilei "Dolee" Yang
a36878eb2f
Fix an invalid quote escaping bug in f-string expressions (#3509)
Fixes #3506

We can't simply escape the quotes in a naked f-string when merging string groups, because backslashes are invalid.

The quotes in f-string expressions should be toggled (this is safe since quotes can't be reused).

This fix also means implicitly concatenated f-strings with different quotes can now be merged or quote-normalized by changing the quotes used in expressions. e.g.:

```diff
         raise sa_exc.UnboundExecutionError(
             "Could not locate a bind configured on "
-            f'{", ".join(context)} or this Session.'
+            f"{', '.join(context)} or this Session."
         )
```
2023-01-22 05:27:11 -08:00
Shivansh-007
eabff673b3
Format hex code in unicode escape sequences in string literals (#2916)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-01-22 05:21:09 -08:00
Michael Eliachevitch
1557f7d3a3
Use dashes for pycodestyle max line length config (#3513)
The option is `max-line-length` with dashes, not underscores. The config option name is given in the output of `pycodestyle -h`, which can also be checked on https://pep8.readthedocs.io/en/stable/intro.html#example-usage-and-output:
```
Configuration:
    The project options are read from the [pycodestyle] section of the
    tox.ini file or the setup.cfg file located in any parent folder of the
    path(s) being processed.  Allowed options are: exclude, filename,
    select, ignore, max-line-length, max-doc-length, hang-closing, count,
    format, quiet, show-pep8, show-source, statistics, verbose
```
2023-01-21 21:20:54 -08:00
Richard Si
c5df7b7d3c
Reenable macOS mypyc wheel build (#3511)
Hatchling implemented a workaround for the 'technically right tag but no
one understands it, including pip' issue so this should work now.
2023-01-20 23:50:00 -08:00
Yilei "Dolee" Yang
91e1e1328a
Wrap multiple context managers in parentheses when targeting Python 3.9+ (#3489) 2023-01-20 04:14:05 -08:00
Antonio Ossa-Guerra
18fb88486d
Fix false symlink detection claims in verbose output (#3385)
When trying to format a project from the outside, the verbose output
shows says that there are symbolic links that points outside of the
project, but displays the wrong project path, meaning that these
messages are false positives.

This bug is triggered when the command is executed from outside a
project on a folder inside it, causing an inconsistency between the
path to the detected project root and the relative path to the target
contents.

The fix is to normalize the target path using the project root before
processing the sources, which removes the presence of the incorrect
messages.

---

The test attemps to emulate the behavior of the CLI as closely as
posible by patching some `pathlib.Path` methods and passing certain
reference paths to the context object and `black.get_sources`.

Before the associated fix was introduced, this test failed because
some of the captured files reported the presence of a symlink due to
an incorrectly formated path. The test also asserts that only a single
file is reported as ignored, which is part of the expected behavior.

Signed-off-by: Antonio Ossa Guerra <aaossa@uc.cl>
2023-01-18 21:38:27 -05:00
Jelle Zijlstra
7e6d3fac19
Fix crash with walrus + await + with (#3473)
Fixes #3472
2023-01-17 22:25:05 -08:00
Bartosz Sokorski
24469c9bd1
Add flake8-bugbear B907 to ignore list (#3503) 2023-01-17 18:01:03 -08:00
Jelle Zijlstra
60a2e8e2c2
Fix two docstring crashes (#3451) 2023-01-16 12:26:03 -08:00
Ruslan
d4ff985853
Add IntelliJ docs on external tools and file watcher (#3365)
Revert deleted documentation on setting up Black using IntelliJ
external tool or file watcher utilities. These are still worth keeping
because some peole might not want to use a third-party plugin or
install Blackd's extra dependencies.

Co-authored-by: Richard Si <sichard26@gmail.com>
2023-01-14 13:32:00 -05:00
Yilei "Dolee" Yang
f758010340
Documentation: clarify the state of multiple context managers (#3488)
Clarify that the backslash & paren-wrapping formatting for multiple
context managers aren't yet implemented.
2023-01-14 12:51:59 -05:00
Bruno Oliveira
4bee9cca55
Remove misleading phrase in Usage and Configuration (#3492)
The CLI options were already shown in the "Command line options" in the same page.
2023-01-11 11:19:27 -08:00
Richard Si
5d0d5936db
Add email for Richard Si (#3478) 2023-01-02 06:43:48 -08:00
Richard Si
37542e6485
Fail lint CI if the PR doesn't target main (#3477)
Let's skip the check if we're running on a fork just in case someone
opens a PR against a branch on said fork as part of a PR review
upstream.
2022-12-30 22:52:35 -08:00
Jordan Ephron
4e3303fa08
Parenthesize conditional expressions (#2278)
Co-authored-by: Jordan Ephron <JEphron@users.noreply.github.com>
Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-12-29 15:13:15 -08:00
dependabot[bot]
0abe85eebb
Bump peter-evans/find-comment from 2.1.0 to 2.2.0 (#3476)
Bumps [peter-evans/find-comment](https://github.com/peter-evans/find-comment) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/peter-evans/find-comment/releases)
- [Commits](f4499a714d...81e2da3af0)

---
updated-dependencies:
- dependency-name: peter-evans/find-comment
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-29 14:00:23 -08:00
dependabot[bot]
72a3408965
Bump pypa/cibuildwheel from 2.11.3 to 2.11.4 (#3475)
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.11.3 to 2.11.4.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/v2.11.3...v2.11.4)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-26 06:32:42 -08:00
Semen Zhydenko
9b91638190
Fix some typos (#3474) 2022-12-25 18:39:51 -08:00
Yilei "Dolee" Yang
3feff21eca
Significantly speedup ESP on large expressions that contain many strings (#3467) 2022-12-23 12:13:45 -08:00
Matthew Armand
3246df89d6
Add latest_prerelease Docker Hub tag for following the latest alpha release (#3465)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-12-20 19:18:15 -08:00
Yilei "Dolee" Yang
29dd257253
Fix an issue where extra empty lines are added. (#3470) 2022-12-20 17:58:02 -08:00
Matthew Armand
59f03d1b9d
Vim plugin docs improvements (#3468)
* Organize vim plugin section with headers to separate out Installation, Usage, and Troubleshooting for readability and easy linking

* Add missing plugin configuration options, with current defaults

* Add installation note for Arch Linux, now that the plugin is shipped with the python-black package (ref: https://bugs.archlinux.org/task/73024)

* Fix vim-plug specification to follow stable releases. Moving the same tag is an antipattern that doesn't re-resolve with vim-plug, see this discussion for more detail (https://github.com/junegunn/vim-plug/pull/720\#issuecomment-1105829356). Per vim-plug's maintainer's recommendation, use the 'tag' key instead with a shell wildcard. Wildcard should be '*.*.*' as that follows Black's versioning detailed here (https://black.readthedocs.io/en/latest/contributing/release_process.html\#cutting-a-release) and doesn't include current alpha releases.
2022-12-20 15:00:06 -08:00
Yilei "Dolee" Yang
73c2d5514c
Fix a crash in ESP where a standalone comment is placed before a dict's value (#3469) 2022-12-20 14:59:38 -08:00
Yilei "Dolee" Yang
a44dc3d59e
Exclude string type annotations from ESP (#3462) 2022-12-20 13:38:35 -08:00
Yilei "Dolee" Yang
1e8217fd62
Fix an f-string crash in ESP. (#3463) 2022-12-20 06:36:42 -08:00
Cooper Lees
9ce75726fc
Do not move docker latest_release tag for Pre-Releases (#3461)
* Do not move docker `latest_release` tag for Pre-Releases

- When we do a pre-release lets not move the latest_release tag
  - This tag should only move on official real releases

Fixes #3453

* Make it prettier - TIL we format our yaml
2022-12-19 18:08:13 -08:00