]> git.madduck.net Git - etc/vim.git/log

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

etc/vim.git
16 months agoPrepare release 23.7.0 (#3776)
Jelle Zijlstra [Tue, 11 Jul 2023 00:09:47 +0000 (17:09 -0700)]
Prepare release 23.7.0 (#3776)

16 months agoUnpin pytest-xdist (#3772)
Shantanu [Mon, 10 Jul 2023 18:49:40 +0000 (11:49 -0700)]
Unpin pytest-xdist (#3772)

16 months agoDisable coverage on pypy tests (#3777)
Shantanu [Mon, 10 Jul 2023 15:37:12 +0000 (08:37 -0700)]
Disable coverage on pypy tests (#3777)

The pypy tests are reeeeaaally slow. Maybe this will help.

16 months agoUpgrade to latest mypy (#3775)
Shantanu [Mon, 10 Jul 2023 00:04:50 +0000 (17:04 -0700)]
Upgrade to latest mypy (#3775)

16 months agoFix crash on type comment with trailing space (#3773)
Shantanu [Sun, 9 Jul 2023 23:28:26 +0000 (16:28 -0700)]
Fix crash on type comment with trailing space (#3773)

16 months agoFix removed comments in stub files (#3745)
Jelle Zijlstra [Sun, 9 Jul 2023 22:52:41 +0000 (15:52 -0700)]
Fix removed comments in stub files (#3745)

16 months agoImprove performance by skipping unnecessary normalisation (#3751)
Shantanu [Sun, 9 Jul 2023 22:24:01 +0000 (15:24 -0700)]
Improve performance by skipping unnecessary normalisation (#3751)

This speeds up black by about 40% when the cache is full

16 months agoAdd CITATION.cff file (#3723)
Kenneth Schackart [Sun, 9 Jul 2023 22:07:21 +0000 (15:07 -0700)]
Add CITATION.cff file (#3723)

16 months agoRun pyupgrade on blib2to3 and src (#3771)
Shantanu [Sun, 9 Jul 2023 22:05:01 +0000 (15:05 -0700)]
Run pyupgrade on blib2to3 and src (#3771)

16 months agoRemove click patch (#3768)
Shantanu [Sun, 9 Jul 2023 20:29:47 +0000 (13:29 -0700)]
Remove click patch (#3768)

Apparently this was only needed on Python 3.6. We've now dropped support
for 3.6 and 3.7. It's also not needed on new enough click.

16 months agoFix CI for Click typing issue (#3770)
Shantanu [Sun, 9 Jul 2023 15:14:38 +0000 (08:14 -0700)]
Fix CI for Click typing issue (#3770)

https://github.com/pallets/click/issues/2558

16 months agoDrop support for Python 3.7 (#3765)
Shantanu [Wed, 5 Jul 2023 17:08:04 +0000 (10:08 -0700)]
Drop support for Python 3.7 (#3765)

16 months agoBetter error message for invalid exclude types (#3764)
Shantanu [Wed, 5 Jul 2023 05:45:57 +0000 (22:45 -0700)]
Better error message for invalid exclude types (#3764)

16 months agoEnable `PYTHONWARNDEFAULTENCODING = 1` in CI (#3763)
Zac Hatfield-Dodds [Tue, 4 Jul 2023 23:38:39 +0000 (16:38 -0700)]
Enable `PYTHONWARNDEFAULTENCODING = 1` in CI (#3763)

16 months agoCI Test: Deprecating 'set-output' command (#3757)
rdrll [Fri, 30 Jun 2023 14:07:42 +0000 (07:07 -0700)]
CI Test: Deprecating 'set-output' command  (#3757)

17 months agoDoc: Developer reference update (#3755)
rdrll [Wed, 28 Jun 2023 20:45:56 +0000 (13:45 -0700)]
Doc: Developer reference update (#3755)

17 months agoFix a magical comment caused internal error (#3740)
rdrll [Tue, 27 Jun 2023 14:23:39 +0000 (07:23 -0700)]
Fix a magical comment caused internal error (#3740)

`is_type_comment` now specifically deals with general type comments for a leaf.
`is_type_ignore_comment` now handles type comments contains ignore annotation for a leaf
`is_type_ignore_comment_string` used to determine if a string is an ignore type comment

17 months agoDecrease cost of ipynb code path when unneeded (#3748)
Shantanu [Tue, 27 Jun 2023 00:47:55 +0000 (17:47 -0700)]
Decrease cost of ipynb code path when unneeded (#3748)

IPython is a very expensive import, like, at least 300ms. I'd also
venture that it's much more common than tokenize-rt, which is like 30ms.
I work in a repo where I use black, have IPython installed and there
happen to be a couple notebooks (that we don't want formatted). I know I
can force exclude ipynb, but this change doesn't really have a cost.

17 months agoCheck self format for the whole repo (#3750)
Shantanu [Sun, 25 Jun 2023 13:53:26 +0000 (06:53 -0700)]
Check self format for the whole repo (#3750)

`black .` is changing things in gallery and scripts for me

17 months agoIntegrate verbose logging with get_sources (#3749)
Shantanu [Sun, 25 Jun 2023 00:27:47 +0000 (17:27 -0700)]
Integrate verbose logging with get_sources (#3749)

Currently the verbose logging for "Sources to be formatted" is a little
suspect in that it is a completely different code path from
`get_sources`.

This can result in bugs like https://github.com/psf/black/pull/3216#issuecomment-1213557359
and generally limits the value of these logs.

This does change the "when" of this log, but the colours help separate
it from the even more verbose logs.

17 months agoAllow specifying `--workers` via environment variable (#3743)
Shantanu [Sat, 24 Jun 2023 23:06:12 +0000 (16:06 -0700)]
Allow specifying `--workers` via environment variable (#3743)

17 months agoBuild with mypyc 1.3 (#3697)
Stian Jensen [Fri, 23 Jun 2023 04:22:28 +0000 (06:22 +0200)]
Build with mypyc 1.3 (#3697)

Several new versions of mypyc has been released since the last upgrade, and they include some performance improvements which could make the compiled version of Black run faster.

https://mypy-lang.org/news.html

The latest version of hatch-mypyc allows being installed next the 1.x series of mypy.

17 months agoFix not honouring pyproject.toml when using stdin and calling black from parent direc...
Renan Santos [Fri, 23 Jun 2023 04:21:49 +0000 (01:21 -0300)]
Fix not honouring pyproject.toml when using stdin and calling black from parent directory (#3719)

Co-authored-by: Renan Rodrigues <renan.rodrigues@appliedbiomath.com>
17 months agoDoc: updating url link (#3739)
rdrll [Tue, 20 Jun 2023 14:06:03 +0000 (07:06 -0700)]
Doc: updating url link (#3739)

17 months agoBump myst-parser from 1.0.0 to 2.0.0 in /docs (#3738)
dependabot[bot] [Mon, 19 Jun 2023 13:58:20 +0000 (06:58 -0700)]
Bump myst-parser from 1.0.0 to 2.0.0 in /docs (#3738)

Bumps [myst-parser](https://github.com/executablebooks/MyST-Parser) from 1.0.0 to 2.0.0.
- [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/v1.0.0...v2.0.0)

---
updated-dependencies:
- dependency-name: myst-parser
  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>
17 months agoDo not add trailing commas to return type annotations using PEP 604 unions (#3735)
Yilei "Dolee" Yang [Fri, 16 Jun 2023 00:08:26 +0000 (17:08 -0700)]
Do not add trailing commas to return type annotations using PEP 604 unions (#3735)

Fix #3638: Do not add trailing commas to return type annotations using PEP 604 unions.

17 months agoMax line length with bugbear (#3731)
Alwyn Kik [Mon, 12 Jun 2023 19:20:31 +0000 (21:20 +0200)]
Max line length with bugbear (#3731)

* Make phrasing for flake8 users more concise

max-line-length should be 80 with flake8-bugbear
Fixes #3716

* Re-add rationale and an explanation for

disabling E203

* Run pre-commit

17 months agoBump peter-evans/create-or-update-comment from 3.0.1 to 3.0.2 (#3730)
dependabot[bot] [Mon, 12 Jun 2023 17:08:45 +0000 (10:08 -0700)]
Bump peter-evans/create-or-update-comment from 3.0.1 to 3.0.2 (#3730)

Bumps [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/peter-evans/create-or-update-comment/releases)
- [Commits](https://github.com/peter-evans/create-or-update-comment/compare/ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b...c6c9a1a66007646a28c153e2a8580a5bad27bcfa)

---
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>
17 months agoBump pypa/cibuildwheel from 2.13.0 to 2.13.1 (#3729)
dependabot[bot] [Mon, 12 Jun 2023 17:05:49 +0000 (10:05 -0700)]
Bump pypa/cibuildwheel from 2.13.0 to 2.13.1 (#3729)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.13.0 to 2.13.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.13.0...v2.13.1)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  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>
17 months agoUse aware datetimes to represent UTC (#3728)
Ville Skyttä [Sat, 10 Jun 2023 16:54:21 +0000 (19:54 +0300)]
Use aware datetimes to represent UTC (#3728)

Avoids a Python 3.12 deprecation warning.

Subtle difference: previously, timestamps in diff filenames had the
`+0000` separated from the timestamp by space. With this, the space is
there no more, and there is a colon, as in `+00:00`.

17 months agoAdd support for PEP 695 syntax (#3703)
Jelle Zijlstra [Fri, 2 Jun 2023 01:37:08 +0000 (18:37 -0700)]
Add support for PEP 695 syntax (#3703)

17 months agoblackd: show default values for options (#3712)
jmcb [Wed, 31 May 2023 21:29:31 +0000 (22:29 +0100)]
blackd: show default values for options (#3712)

* blackd: show default values for options

Reference: https://click.palletsprojects.com/en/8.1.x/api/#click.Option

* Fix spacing in CHANGES.md

18 months agoBump pypa/cibuildwheel from 2.12.3 to 2.13.0 (#3710)
dependabot[bot] [Mon, 29 May 2023 13:33:41 +0000 (06:33 -0700)]
Bump pypa/cibuildwheel from 2.12.3 to 2.13.0 (#3710)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.12.3 to 2.13.0.
- [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.12.3...v2.13.0)

---
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>
18 months agoFix docs formatting (#3704)
Jelle Zijlstra [Thu, 25 May 2023 04:06:08 +0000 (21:06 -0700)]
Fix docs formatting (#3704)

18 months agoDocument each configuration option in more detail (#2839)
Jelle Zijlstra [Thu, 25 May 2023 02:55:12 +0000 (19:55 -0700)]
Document each configuration option in more detail (#2839)

18 months agodocs: update note on GitHub .git-blame-ignore-revs support (#3655)
Stefaan Lippens [Thu, 25 May 2023 02:53:27 +0000 (04:53 +0200)]
docs: update note on GitHub .git-blame-ignore-revs support (#3655)

18 months agoChange example from `%%writeline` to `%%writefile` (#3673)
Deepyaman Datta [Thu, 25 May 2023 02:52:59 +0000 (22:52 -0400)]
Change example from `%%writeline` to `%%writefile` (#3673)

18 months agoBump furo from 2023.3.27 to 2023.5.20 in /docs (#3698)
dependabot[bot] [Mon, 22 May 2023 15:47:58 +0000 (11:47 -0400)]
Bump furo from 2023.3.27 to 2023.5.20 in /docs (#3698)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
18 months agoAvoid EncodingWarning in blib2to3 (#3696)
Jason R. Coombs [Fri, 19 May 2023 17:00:29 +0000 (13:00 -0400)]
Avoid EncodingWarning in blib2to3 (#3696)

18 months agoRemove blank lines before class docstring (#3692)
Jonathan Berthias [Thu, 18 May 2023 23:57:17 +0000 (01:57 +0200)]
Remove blank lines before class docstring (#3692)

18 months agoSort DEFAULT_EXCLUDES and add .vscode, .pytest_cache and .ruff_cache (#3691)
Ray Bell [Wed, 17 May 2023 02:47:45 +0000 (22:47 -0400)]
Sort DEFAULT_EXCLUDES and add .vscode, .pytest_cache and .ruff_cache (#3691)

Co-authored-by: Ray Bell <ray.bell@dtn.com>
18 months agoBump peter-evans/find-comment from 2.3.0 to 2.4.0 (#3670)
dependabot[bot] [Mon, 15 May 2023 22:41:35 +0000 (15:41 -0700)]
Bump peter-evans/find-comment from 2.3.0 to 2.4.0 (#3670)

Bumps [peter-evans/find-comment](https://github.com/peter-evans/find-comment) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/peter-evans/find-comment/releases)
- [Commits](https://github.com/peter-evans/find-comment/compare/034abe94d3191f9c89d870519735beae326f2bdb...a54c31d7fa095754bfef525c0c8e5e5674c4b4b1)

---
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>
Co-authored-by: Cooper Lees <me@cooperlees.com>
18 months ago[github action] display black result in job summary (#3688)
Matthieu Simon [Mon, 15 May 2023 21:35:39 +0000 (23:35 +0200)]
[github action] display black result in job summary (#3688)

* send output to $GITHUB_STEP_SUMMARY

* update CHANGES.md

* update CHANGES.md with PR number

* implement PR feedback

* fix pre-commit issues (prettier/trailing whitespace)

18 months agoBump peter-evans/create-or-update-comment from 2.1.1 to 3.0.1 (#3683)
dependabot[bot] [Mon, 8 May 2023 13:36:24 +0000 (06:36 -0700)]
Bump peter-evans/create-or-update-comment from 2.1.1 to 3.0.1 (#3683)

Bumps [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) from 2.1.1 to 3.0.1.
- [Release notes](https://github.com/peter-evans/create-or-update-comment/releases)
- [Commits](https://github.com/peter-evans/create-or-update-comment/compare/67dcc547d311b736a8e6c5c236542148a47adc3d...ca08ebd5dc95aa0cd97021e9708fcd6b87138c9b)

---
updated-dependencies:
- dependency-name: peter-evans/create-or-update-comment
  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>
18 months agoblib2to3: add a few annotations (#3675)
Jelle Zijlstra [Wed, 3 May 2023 17:26:57 +0000 (10:26 -0700)]
blib2to3: add a few annotations (#3675)

18 months agoFix new mypy error in blib2to3 (#3674)
Jelle Zijlstra [Wed, 3 May 2023 15:43:20 +0000 (08:43 -0700)]
Fix new mypy error in blib2to3 (#3674)

See python/mypy#15174

19 months agoDo not wrap implicitly concatenated strings used as func args in parens (#3640)
Yilei "Dolee" Yang [Fri, 28 Apr 2023 18:10:01 +0000 (11:10 -0700)]
Do not wrap implicitly concatenated strings used as func args in parens (#3640)

19 months agoBump pypa/cibuildwheel from 2.12.1 to 2.12.3 (#3657)
dependabot[bot] [Mon, 24 Apr 2023 11:46:34 +0000 (04:46 -0700)]
Bump pypa/cibuildwheel from 2.12.1 to 2.12.3 (#3657)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.12.1 to 2.12.3.
- [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.12.1...v2.12.3)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  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>
19 months agoDocument black-jupyter hook (#3650)
James Braza [Wed, 19 Apr 2023 10:24:03 +0000 (03:24 -0700)]
Document black-jupyter hook (#3650)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
19 months agoBump sphinx-copybutton from 0.5.1 to 0.5.2 in /docs (#3651)
dependabot[bot] [Mon, 17 Apr 2023 14:17:11 +0000 (07:17 -0700)]
Bump sphinx-copybutton from 0.5.1 to 0.5.2 in /docs (#3651)

Bumps [sphinx-copybutton](https://github.com/executablebooks/sphinx-copybutton) from 0.5.1 to 0.5.2.
- [Release notes](https://github.com/executablebooks/sphinx-copybutton/releases)
- [Changelog](https://github.com/executablebooks/sphinx-copybutton/blob/master/CHANGELOG.md)
- [Commits](https://github.com/executablebooks/sphinx-copybutton/compare/v0.5.1...v0.5.2)

---
updated-dependencies:
- dependency-name: sphinx-copybutton
  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>
19 months agoFix two more mypyc issues with mypyc v1.2.0. (#3648)
Yilei "Dolee" Yang [Fri, 14 Apr 2023 21:05:08 +0000 (14:05 -0700)]
Fix two more mypyc issues with mypyc v1.2.0. (#3648)

19 months agoExplicitly annotate this with `Final[str]` to make it work in mypyc 1.0.0+. (#3645)
Yilei "Dolee" Yang [Fri, 14 Apr 2023 00:12:05 +0000 (17:12 -0700)]
Explicitly annotate this with `Final[str]` to make it work in mypyc 1.0.0+. (#3645)

19 months agoFix an example for 'Improved parentheses management' in the (future of the) Black...
Harutaka Kawamura [Mon, 3 Apr 2023 13:56:59 +0000 (22:56 +0900)]
Fix an example for 'Improved parentheses management' in the (future of the) Black code style (#3635)

19 months agoBump furo from 2023.3.23 to 2023.3.27 in /docs (#3636)
dependabot[bot] [Mon, 3 Apr 2023 13:55:17 +0000 (06:55 -0700)]
Bump furo from 2023.3.23 to 2023.3.27 in /docs (#3636)

Bumps [furo](https://github.com/pradyunsg/furo) from 2023.3.23 to 2023.3.27.
- [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/2023.03.23...2023.03.27)

---
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>
20 months agoFixup the changelog (#3628)
Jelle Zijlstra [Wed, 29 Mar 2023 00:53:23 +0000 (18:53 -0600)]
Fixup the changelog (#3628)

20 months agoPrepare release 23.3.0 (#3625)
Jelle Zijlstra [Wed, 29 Mar 2023 00:46:04 +0000 (18:46 -0600)]
Prepare release 23.3.0 (#3625)

20 months agoSpecify Python exec path with minor version if available (#3508)
Ilia Lazarev [Tue, 28 Mar 2023 04:12:24 +0000 (07:12 +0300)]
Specify Python exec path with minor version if available (#3508)

Fixes #3507

20 months agoUse GH action version when version argument not specified (#3543)
Jakub Kuczys [Tue, 28 Mar 2023 01:40:27 +0000 (03:40 +0200)]
Use GH action version when version argument not specified (#3543)

20 months agoBump furo from 2022.12.7 to 2023.3.23 in /docs (#3624)
dependabot[bot] [Mon, 27 Mar 2023 11:15:43 +0000 (07:15 -0400)]
Bump furo from 2022.12.7 to 2023.3.23 in /docs (#3624)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
20 months agoLet string splitters respect `East_Asian_Width` property (#3445)
Hong Minhee (洪 民憙) [Sun, 19 Mar 2023 23:09:57 +0000 (08:09 +0900)]
Let string splitters respect `East_Asian_Width` property (#3445)

This patch changes the preview style so that string splitters respect
Unicode East Asian Width[^1] property.  If you are not familiar to CJK
languages it is not clear immediately.  Let me elaborate with some
examples.

Traditionally, East Asian characters (including punctuation) have
taken up space twice than European letters and stops when they are
rendered in monospace typeset.  Compare the following characters:

```
abcdefg.
글、字。
```

The characters at the first line are half-width, and the second line
are full-width.  (Also note that the last character with a small
circle, the East Asian period, is also full-width.)  Therefore, if we
want to prevent those full-width characters to exceed the maximum
columns per line, we need to count their *width* rather than the number
of characters.  Again, the following characters:

```
글、字。
```

These are just 4 characters, but their total width is 8.

Suppose we want to maintain up to 4 columns per line with the following
text:

```
abcdefg.
글、字。
```

How should it be then?  We want it to look like:

```
abcd
efg.
글、
字。
```

However, Black currently turns it into like this:

```
abcd
efg.
글、字。
```

It's because Black currently counts the number of characters in the line
instead of measuring their width. So, how could we measure the width?
How can we tell if a character is full- or half-width? What if half-width
characters and full-width ones are mixed in a line? That's why Unicode
defined an attribute named `East_Asian_Width`. Unicode grouped every
single character according to their width in fixed-width typeset.

This partially addresses #1197, but only for string splitters. The other
parts need to be fixed as well in future patches.

This was implemented by copying rich's own approach to handling wide
characters: generate a table using wcwidth, check it into source
control, and use in to drive helper functions in Black's logic. This
gets us the best of both worlds: accuracy and performance (and let's us
update as per our stability policy too!).

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
20 months agoBump sphinx from 5.3.0 to 6.1.3 in /docs (#3499)
dependabot[bot] [Sun, 19 Mar 2023 23:00:14 +0000 (19:00 -0400)]
Bump sphinx from 5.3.0 to 6.1.3 in /docs (#3499)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
20 months agoBump myst-parser from 0.18.1 to 1.0.0 in /docs (#3601)
dependabot[bot] [Sun, 19 Mar 2023 22:52:40 +0000 (18:52 -0400)]
Bump myst-parser from 0.18.1 to 1.0.0 in /docs (#3601)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard Si <sichard26@gmail.com>
20 months agoSupport files with type comment syntax errors (#3594)
Tushar Sadhwani [Sun, 19 Mar 2023 22:52:06 +0000 (04:22 +0530)]
Support files with type comment syntax errors (#3594)

20 months agoFix bug introduced in #3564. (#3615)
Yilei "Dolee" Yang [Sun, 19 Mar 2023 14:43:39 +0000 (07:43 -0700)]
Fix bug introduced in #3564. (#3615)

20 months agoEnforce a blank line after a nested class in stubs (#3564)
WMOkiishi [Sat, 18 Mar 2023 21:04:13 +0000 (15:04 -0600)]
Enforce a blank line after a nested class in stubs (#3564)

20 months agoUpdate documentation regarding isort compatibility (#3567)
Mitch Negus [Sat, 18 Mar 2023 20:30:02 +0000 (14:30 -0600)]
Update documentation regarding isort compatibility (#3567)

20 months agoAdd SECURITY.md (#3612)
Jelle Zijlstra [Sat, 18 Mar 2023 17:41:48 +0000 (10:41 -0700)]
Add SECURITY.md (#3612)

20 months agoBump peter-evans/create-or-update-comment from 2.1.0 to 2.1.1 (#3548)
dependabot[bot] [Sat, 18 Mar 2023 04:59:33 +0000 (21:59 -0700)]
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](https://github.com/peter-evans/create-or-update-comment/compare/5adcb0bb0f9fb3f95ef05400558bdb3f329ee808...67dcc547d311b736a8e6c5c236542148a47adc3d)

---
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>
20 months agoDo not add an extra blank line to an import line that has fmt disabled (#3610)
Yilei "Dolee" Yang [Sat, 18 Mar 2023 04:39:21 +0000 (21:39 -0700)]
Do not add an extra blank line to an import line that has fmt disabled (#3610)

20 months agoConsistently format async statements similar to their non-async version. (#3609)
Yilei "Dolee" Yang [Thu, 16 Mar 2023 20:31:27 +0000 (13:31 -0700)]
Consistently format async statements similar to their non-async version. (#3609)

20 months agoBump pypa/cibuildwheel from 2.11.4 to 2.12.1 (#3602)
dependabot[bot] [Wed, 15 Mar 2023 07:30:04 +0000 (00:30 -0700)]
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>
20 months agoCorrect spelling mistakes (#3599)
Casey Korver [Sat, 11 Mar 2023 15:43:31 +0000 (09:43 -0600)]
Correct spelling mistakes (#3599)

20 months agoConsistently wrap two context managers in parens (in --preview). (#3589)
Yilei "Dolee" Yang [Fri, 10 Mar 2023 06:01:20 +0000 (22:01 -0800)]
Consistently wrap two context managers in parens (in --preview). (#3589)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
20 months agoImprove multiline string handling (#1879)
Aneesh Agrawal [Tue, 7 Mar 2023 19:52:19 +0000 (14:52 -0500)]
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>
20 months agoBump peter-evans/find-comment from 2.2.0 to 2.3.0 (#3584)
dependabot[bot] [Mon, 27 Feb 2023 14:38:02 +0000 (06:38 -0800)]
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](https://github.com/peter-evans/find-comment/compare/81e2da3af01c92f83cb927cf3ace0e085617c556...034abe94d3191f9c89d870519735beae326f2bdb)

---
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>
21 months agoUpdate Action example to use checkout@v3 (#3563)
brucearctor [Tue, 14 Feb 2023 01:24:28 +0000 (17:24 -0800)]
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.

21 months agoFix typos in comments: assignement -> assignment (#3556)
Yilei "Dolee" Yang [Tue, 7 Feb 2023 22:48:09 +0000 (14:48 -0800)]
Fix typos in comments: assignement -> assignment (#3556)

21 months agoBump docker/build-push-action from 3 to 4 (#3549)
dependabot[bot] [Tue, 7 Feb 2023 03:56:38 +0000 (19:56 -0800)]
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>
21 months agoRename design label to style because it's clearer (#3547)
Richard Si [Sun, 5 Feb 2023 03:51:46 +0000 (22:51 -0500)]
Rename design label to style because it's clearer (#3547)

21 months agoActually add trailing commas to collection literals even if there are terminating...
mainj12 [Sun, 5 Feb 2023 03:35:43 +0000 (03:35 +0000)]
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>
21 months agoDocument the future style changes introduced in #3489 and #3440 (#3541)
Yilei "Dolee" Yang [Sun, 5 Feb 2023 03:30:47 +0000 (19:30 -0800)]
Document the future style changes introduced in #3489 and #3440 (#3541)

21 months agoFix import of blib2to3.pgen2.driver (#3546)
Yilei "Dolee" Yang [Sat, 4 Feb 2023 06:00:09 +0000 (22:00 -0800)]
Fix import of blib2to3.pgen2.driver (#3546)

21 months agoPrepare release 23.1.0 (#3536)
Jelle Zijlstra [Wed, 1 Feb 2023 02:47:11 +0000 (18:47 -0800)]
Prepare release 23.1.0 (#3536)

Co-authored-by: Richard Si <sichard26@gmail.com>
21 months agoInfer target version based on project metadata (#3219)
Stijn de Gooijer [Wed, 1 Feb 2023 02:00:17 +0000 (03:00 +0100)]
Infer target version based on project metadata (#3219)

Co-authored-by: Richard Si <sichard26@gmail.com>
21 months agoDraft for Black 2023 stable style (#3418)
Jelle Zijlstra [Tue, 31 Jan 2023 23:39:56 +0000 (15:39 -0800)]
Draft for Black 2023 stable style (#3418)

21 months agoFix unsafe cast in linegen.py w/ await yield handling (#3533)
Jelle Zijlstra [Tue, 31 Jan 2023 02:53:14 +0000 (18:53 -0800)]
Fix unsafe cast in linegen.py w/ await yield handling (#3533)

Fixes #3532.

21 months agoUpgrade isort (#3534)
Jelle Zijlstra [Tue, 31 Jan 2023 02:45:12 +0000 (18:45 -0800)]
Upgrade isort (#3534)

See PyCQA/isort#2077.

21 months agoRemove Python version in the_basics.md (#3528)
Evan Chen [Sun, 29 Jan 2023 00:12:11 +0000 (16:12 -0800)]
Remove Python version in the_basics.md (#3528)

22 months agoFix `black --help` output for `--python-cell-magics` option to be reproducible (...
Edouard Choinière [Tue, 24 Jan 2023 13:43:24 +0000 (08:43 -0500)]
Fix `black --help` output for `--python-cell-magics` option to be reproducible (#3516)

22 months agoUpdate document now that paren wrapping CMs on Python 3.9+ is implemented (#3520)
Yilei "Dolee" Yang [Tue, 24 Jan 2023 05:38:30 +0000 (21:38 -0800)]
Update document now that paren wrapping CMs on Python 3.9+ is implemented (#3520)

22 months agoFix an invalid quote escaping bug in f-string expressions (#3509)
Yilei "Dolee" Yang [Sun, 22 Jan 2023 13:27:11 +0000 (05:27 -0800)]
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."
         )
```

22 months agoFormat hex code in unicode escape sequences in string literals (#2916)
Shivansh-007 [Sun, 22 Jan 2023 13:21:09 +0000 (18:51 +0530)]
Format hex code in unicode escape sequences in string literals (#2916)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
22 months agoUse dashes for pycodestyle max line length config (#3513)
Michael Eliachevitch [Sun, 22 Jan 2023 05:20:54 +0000 (06:20 +0100)]
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
```

22 months agoReenable macOS mypyc wheel build (#3511)
Richard Si [Sat, 21 Jan 2023 07:50:00 +0000 (02:50 -0500)]
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.

22 months agoWrap multiple context managers in parentheses when targeting Python 3.9+ (#3489)
Yilei "Dolee" Yang [Fri, 20 Jan 2023 12:14:05 +0000 (04:14 -0800)]
Wrap multiple context managers in parentheses when targeting Python 3.9+ (#3489)

22 months agoFix false symlink detection claims in verbose output (#3385)
Antonio Ossa-Guerra [Thu, 19 Jan 2023 02:38:27 +0000 (23:38 -0300)]
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>
22 months agoFix crash with walrus + await + with (#3473)
Jelle Zijlstra [Wed, 18 Jan 2023 06:25:05 +0000 (22:25 -0800)]
Fix crash with walrus + await + with (#3473)

Fixes #3472

22 months agoAdd flake8-bugbear B907 to ignore list (#3503)
Bartosz Sokorski [Wed, 18 Jan 2023 02:01:03 +0000 (03:01 +0100)]
Add flake8-bugbear B907 to ignore list (#3503)

22 months agoFix two docstring crashes (#3451)
Jelle Zijlstra [Mon, 16 Jan 2023 20:26:03 +0000 (12:26 -0800)]
Fix two docstring crashes (#3451)

22 months agoAdd IntelliJ docs on external tools and file watcher (#3365)
Ruslan [Sat, 14 Jan 2023 18:32:00 +0000 (01:32 +0700)]
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>