]> 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
20 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>
21 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>
21 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>
21 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>
21 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)

21 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)

21 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)

21 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)

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

21 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>
21 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)

21 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)

21 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>
21 months agoCorrect spelling mistakes (#3599)
Casey Korver [Sat, 11 Mar 2023 15:43:31 +0000 (09:43 -0600)]
Correct spelling mistakes (#3599)

21 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>
21 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>
21 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>
22 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.

22 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)

22 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>
22 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)

22 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>
22 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)

22 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)

22 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>
22 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>
22 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)

22 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.

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

See PyCQA/isort#2077.

22 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>
23 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

23 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)

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

23 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>
23 months agoDocumentation: clarify the state of multiple context managers (#3488)
Yilei "Dolee" Yang [Sat, 14 Jan 2023 17:51:59 +0000 (09:51 -0800)]
Documentation: clarify the state of multiple context managers (#3488)

Clarify that the backslash & paren-wrapping formatting for multiple
context managers aren't yet implemented.

23 months agoRemove misleading phrase in Usage and Configuration (#3492)
Bruno Oliveira [Wed, 11 Jan 2023 19:19:27 +0000 (16:19 -0300)]
Remove misleading phrase in Usage and Configuration (#3492)

The CLI options were already shown in the "Command line options" in the same page.

23 months agoAdd email for Richard Si (#3478)
Richard Si [Mon, 2 Jan 2023 14:43:48 +0000 (09:43 -0500)]
Add email for Richard Si (#3478)

23 months agoFail lint CI if the PR doesn't target main (#3477)
Richard Si [Sat, 31 Dec 2022 06:52:35 +0000 (01:52 -0500)]
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.

23 months agoParenthesize conditional expressions (#2278)
Jordan Ephron [Thu, 29 Dec 2022 23:13:15 +0000 (18:13 -0500)]
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>
23 months agoBump peter-evans/find-comment from 2.1.0 to 2.2.0 (#3476)
dependabot[bot] [Thu, 29 Dec 2022 22:00:23 +0000 (14:00 -0800)]
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](https://github.com/peter-evans/find-comment/compare/f4499a714d59013c74a08789b48abe4b704364a0...81e2da3af01c92f83cb927cf3ace0e085617c556)

---
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>
23 months agoBump pypa/cibuildwheel from 2.11.3 to 2.11.4 (#3475)
dependabot[bot] [Mon, 26 Dec 2022 14:32:42 +0000 (06:32 -0800)]
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>
23 months agoFix some typos (#3474)
Semen Zhydenko [Mon, 26 Dec 2022 02:39:51 +0000 (03:39 +0100)]
Fix some typos (#3474)

23 months agoSignificantly speedup ESP on large expressions that contain many strings (#3467)
Yilei "Dolee" Yang [Fri, 23 Dec 2022 20:13:45 +0000 (12:13 -0800)]
Significantly speedup ESP on large expressions that contain many strings (#3467)

23 months agoAdd latest_prerelease Docker Hub tag for following the latest alpha release (#3465)
Matthew Armand [Wed, 21 Dec 2022 03:18:15 +0000 (22:18 -0500)]
Add latest_prerelease Docker Hub tag for following the latest alpha release (#3465)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
23 months agoFix an issue where extra empty lines are added. (#3470)
Yilei "Dolee" Yang [Wed, 21 Dec 2022 01:58:02 +0000 (17:58 -0800)]
Fix an issue where extra empty lines are added. (#3470)

23 months agoVim plugin docs improvements (#3468)
Matthew Armand [Tue, 20 Dec 2022 23:00:06 +0000 (18:00 -0500)]
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.

23 months agoFix a crash in ESP where a standalone comment is placed before a dict's value (#3469)
Yilei "Dolee" Yang [Tue, 20 Dec 2022 22:59:38 +0000 (14:59 -0800)]
Fix a crash in ESP where a standalone comment is placed before a dict's value (#3469)

23 months agoExclude string type annotations from ESP (#3462)
Yilei "Dolee" Yang [Tue, 20 Dec 2022 21:38:35 +0000 (13:38 -0800)]
Exclude string type annotations from ESP (#3462)

23 months agoFix an f-string crash in ESP. (#3463)
Yilei "Dolee" Yang [Tue, 20 Dec 2022 14:36:42 +0000 (06:36 -0800)]
Fix an f-string crash in ESP. (#3463)

23 months agoDo not move docker `latest_release` tag for Pre-Releases (#3461)
Cooper Lees [Tue, 20 Dec 2022 02:08:13 +0000 (18:08 -0800)]
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

2 years agotomli: Don't worry about specific alpha releases (#3448)
Jelle Zijlstra [Sun, 18 Dec 2022 03:02:01 +0000 (19:02 -0800)]
tomli: Don't worry about specific alpha releases (#3448)

This prevents bugs due to pypa/packaging#522.

Fixes #3447.

2 years agoFix syntax error in match test (#3426)
Jelle Zijlstra [Sat, 17 Dec 2022 22:51:10 +0000 (14:51 -0800)]
Fix syntax error in match test (#3426)

2 years agoCheck stability for both preview and non-preview styles (#3423)
Jelle Zijlstra [Sat, 17 Dec 2022 18:31:47 +0000 (10:31 -0800)]
Check stability for both preview and non-preview styles (#3423)

And fix parens-related test failures this found.

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2 years agoRemove separate 3.11 CI now deps support 3.11 (#3446)
Cooper Lees [Sat, 17 Dec 2022 17:19:45 +0000 (09:19 -0800)]
Remove separate 3.11 CI now deps support 3.11 (#3446)

* Remove separate 3.11 CI now deps support 3.11

- We can run everything now like all other stable versions of Python
- test in a 3.11 vent: `/tmp/tb/bin/tox -e py311,ci-py311`

```
  py311: OK (28.99=setup[7.90]+cmd[5.29,0.66,6.94,6.08,1.89,0.24] seconds)
  ci-py311: OK (30.33=setup[3.20]+cmd[3.66,0.31,17.43,4.60,0.90,0.23] seconds)
  congratulations :) (59.35 seconds)
```

* Add to CHANGES.md

* Add fuzz run in 3.11

2 years agoFix an infinite recursion error exposed by #3440 (#3444)
Yilei "Dolee" Yang [Fri, 16 Dec 2022 13:02:41 +0000 (05:02 -0800)]
Fix an infinite recursion error exposed by #3440 (#3444)

2 years agoPrefer splitting right hand side of assignment statements. (#3368)
Yilei "Dolee" Yang [Thu, 15 Dec 2022 23:58:51 +0000 (15:58 -0800)]
Prefer splitting right hand side of assignment statements. (#3368)

2 years agoImprove long values in dict literals (#3440)
Yilei "Dolee" Yang [Thu, 15 Dec 2022 16:25:28 +0000 (08:25 -0800)]
Improve long values in dict literals (#3440)

2 years agoFix a crash when a colon line is marked between `# fmt: off` and `# fmt: on` (#3439)
Yilei "Dolee" Yang [Thu, 15 Dec 2022 01:56:14 +0000 (17:56 -0800)]
Fix a crash when a colon line is marked between `# fmt: off` and `# fmt: on` (#3439)

2 years agoDo not put the closing quotes in a docstring on a separate line (#3430)
Jelle Zijlstra [Tue, 13 Dec 2022 04:56:38 +0000 (20:56 -0800)]
Do not put the closing quotes in a docstring on a separate line (#3430)

Fixes #3320. Followup from #3044.

2 years agoBump furo from 2022.9.29 to 2022.12.7 in /docs (#3433)
dependabot[bot] [Mon, 12 Dec 2022 14:28:12 +0000 (06:28 -0800)]
Bump furo from 2022.9.29 to 2022.12.7 in /docs (#3433)

Bumps [furo](https://github.com/pradyunsg/furo) from 2022.9.29 to 2022.12.7.
- [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.09.29...2022.12.07)

---
updated-dependencies:
- dependency-name: furo
  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>
2 years agoBump pypa/cibuildwheel from 2.11.2 to 2.11.3 (#3434)
dependabot[bot] [Mon, 12 Dec 2022 14:27:18 +0000 (06:27 -0800)]
Bump pypa/cibuildwheel from 2.11.2 to 2.11.3 (#3434)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.11.2 to 2.11.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.11.2...v2.11.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>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoBump mypy[c] from 0.971 to 0.991 (#3380)
Richard Si [Sat, 10 Dec 2022 20:56:34 +0000 (15:56 -0500)]
Bump mypy[c] from 0.971 to 0.991 (#3380)

2 years agoAdding pyproject.toml configuration output to verbose logging (#3392)
mainj12 [Sat, 10 Dec 2022 20:56:14 +0000 (20:56 +0000)]
Adding pyproject.toml configuration output to verbose logging (#3392)

2 years agomake black[jupyter] installation cross-shell (#3394)
Marco Edward Gorelli [Sat, 10 Dec 2022 19:49:33 +0000 (19:49 +0000)]
make black[jupyter] installation cross-shell (#3394)

2 years agoFix a crash in preview style with assert + parenthesized string. (#3415)
Yilei "Dolee" Yang [Sat, 10 Dec 2022 15:58:45 +0000 (07:58 -0800)]
Fix a crash in preview style with assert + parenthesized string. (#3415)

The bug is in the `get_leaves_inside_matching_brackets` on the third line below:

```python
assert xxxxxxxxx.xxxxxxxxx.xxxxxxxxx(
    xxxxxxxxx
).xxxxxxxxxxxxxxxxxx(), (
    "xxx {xxxxxxxxx} xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)
```

Including the invisible paren, third line is `).xxxxxxxxxxxxxxxxxx()), (`, that it has a matched pair then an unmatched closing paren afterwards. This PR ensures the returned leaves are actually matched.

Fixes #3414.

2 years agoFix type annotation for gitignore pathspec (#3416)
Isac Byeonghoon Yoo [Sat, 10 Dec 2022 15:08:05 +0000 (00:08 +0900)]
Fix type annotation for gitignore pathspec (#3416)

2 years agoPrepare release 22.12.0 (#3413)
Jelle Zijlstra [Fri, 9 Dec 2022 15:49:43 +0000 (07:49 -0800)]
Prepare release 22.12.0 (#3413)

2 years agorelease: skip bad macos wheels for now (#3411)
Jelle Zijlstra [Fri, 9 Dec 2022 04:36:39 +0000 (20:36 -0800)]
release: skip bad macos wheels for now (#3411)

Workaround for #3312

2 years agoBump peter-evans/find-comment from 2.0.1 to 2.1.0 (#3404)
dependabot[bot] [Fri, 9 Dec 2022 04:28:29 +0000 (23:28 -0500)]
Bump peter-evans/find-comment from 2.0.1 to 2.1.0 (#3404)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoFix CI with latest flake8-bugbear (#3412)
Jelle Zijlstra [Fri, 9 Dec 2022 04:11:07 +0000 (20:11 -0800)]
Fix CI with latest flake8-bugbear (#3412)

2 years agoBump sphinx-copybutton from 0.5.0 to 0.5.1 in /docs (#3390)
dependabot[bot] [Mon, 21 Nov 2022 16:24:46 +0000 (08:24 -0800)]
Bump sphinx-copybutton from 0.5.0 to 0.5.1 in /docs (#3390)

Bumps [sphinx-copybutton](https://github.com/executablebooks/sphinx-copybutton) from 0.5.0 to 0.5.1.
- [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.0...v0.5.1)

---
updated-dependencies:
- dependency-name: sphinx-copybutton
  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>
2 years agoWordsmith current_style.md (#3383)
sckarlin [Mon, 14 Nov 2022 15:31:43 +0000 (10:31 -0500)]
Wordsmith current_style.md (#3383)

"realtime" doesn't make sense in this context.

2 years agoRemove whitespaces of whitespace-only files (#3348)
Antonio Ossa-Guerra [Sat, 12 Nov 2022 01:05:36 +0000 (22:05 -0300)]
Remove whitespaces of whitespace-only files (#3348)

Currently, empty and whitespace-only (with or without newlines) are
not modified. In some discussions (issues and pull requests) consensus
was to reformat whitespace-only files to empty or single-character
files, preserving line endings when possible. With that said, this
commit introduces the following behaviors:

* Empty files are left as is
* Whitespace-only files (no newline) reformat into empty files
* Whitespace-only files (1 or more newlines) reformat into a single
newline character

To implement these changes, we moved the initial check at
`format_file_contents` that raises `NothingChanged` if the source
(with no whitespaces) is an empty string. In the case of *.ipynb
files, `format_ipynb_string` checks a similar condition and removed
whitespaces. In the case of Python files, `format_str_once` includes a
check on the output that returns the correct newline character if
possible or an empty string otherwise.

Signed-off-by: Antonio Ossa Guerra <aaossa@uc.cl>
2 years agoClarify that Black runs with --safe by default (#3378)
Maximilian Cosmo Sitter [Thu, 10 Nov 2022 15:03:19 +0000 (16:03 +0100)]
Clarify that Black runs with --safe by default (#3378)

2 years agoCorrectly handle trailing commas that are inside a line's leading non-nested parens...
Yilei "Dolee" Yang [Wed, 9 Nov 2022 23:08:51 +0000 (15:08 -0800)]
Correctly handle trailing commas that are inside a line's leading non-nested parens (#3370)

- Fixes #1671
- Fixes #3229

2 years agoCompare each .gitignore found with an appropiate relative path (#3338)
Antonio Ossa-Guerra [Tue, 8 Nov 2022 15:50:04 +0000 (12:50 -0300)]
Compare each .gitignore found with an appropiate relative path (#3338)

* Apply .gitignore files considering their location

When a .gitignore file contains the special rule to ignore every
subfolder content (`*/*`) and the file is located in a subfolder
relative to where the command is executed (root), the rule is
incorrectly applied and ignores every file at the same level of the
.gitignore file.

The reason for this is that the `gitignore` variable accumulates the
rules found in each .gitignore while traversing files and directories
recursively. This makes sense and, in general, works as expected. The
problem is that the gitignore rules are applied using as the relative
path from root to target directory as a reference. This is the cause
of the bug.

The implemented solution keeps track of every .gitignore file found
while traversing the targets and the absolute location of each
.gitignore file. Then, when matching files to the .gitignore rules,
compare each set of rules with the appropiate relative path to the
candidate target file.

To make this possible, we changed the single `gitignore` object with a
dictionary of similar objects, where the corresponding key is the
absolute path to the folder that contains that .gitignore file. This
required changing the signature of the `get_sources` function. Also, we
introduce a `is_ignored` function that compares a file with every set
of rules. Finally, some tests required an update to pass the gitignore
object in the new format.

Signed-off-by: Antonio Ossa Guerra <aaossa@uc.cl>
* Test .gitignore with `*/*` is applied correctly

The test contains three cases: 1) when the .gitignore with the special
rule to ignore every subfolder and its contents (*/*) is in the root,
2) when the file is inside a subfolder relative to root (nested), and
3) when the target folder contains the .gitignore and root is a parent
folder of the target. In all of these cases, we compare the files that
are visible by Black with a known list of paths containing the
expected values.

Before the fix introduced in the previous commit, these tests failed
when the .gitignore file was nested (second case). Now, the test is
passed for all cases.

Signed-off-by: Antonio Ossa Guerra <aaossa@uc.cl>
* Update CHANGES.md

Add entry about fixed bug and changes introduced: ignore files by
considering the location of each .gitignore file and the relative path
of each target

Signed-off-by: Antonio Ossa Guerra <aaossa@uc.cl>
* Small refactor to improve code readability

These changes are small improvements to improve code readability:
rename a variable to a more descriptive name (from `exclude_is_None`
to `using_default_exclude`), use a better syntax to include the type
annotation for `gitignore` variable (from typing comment to
Python-style typing annotation), and replace an if-else block with a
single dictionary definition (in this case, we need to compare keys
instead of values, meaning that the change works)

Signed-off-by: Antonio Ossa Guerra <aaossa@uc.cl>
* Make nested function a top-level function

The function to match a given path with every discovered .gitignore
file does not need to be a nested function and can be a top-level
function. The arguments did not change, but the naming of local
variables was improved for readability.

Signed-off-by: Antonio Ossa Guerra <aaossa@uc.cl>
Signed-off-by: Antonio Ossa Guerra <aaossa@uc.cl>
2 years agoApply .gitignore correctly in every source entry (#3336)
Antonio Ossa-Guerra [Sat, 5 Nov 2022 05:09:59 +0000 (02:09 -0300)]
Apply .gitignore correctly in every source entry (#3336)

When passing multiple src directories, the root gitignore was only
applied to the first processed source. The reason is that, in the
first source, exclude is `None`, but then the value gets overridden by
`re_compile_maybe_verbose(DEFAULT_EXCLUDES)`, so in the next iteration
where the source is a directory, the condition is not met and sets the
value of `gitignore` to `None`.

To fix this problem, we store a boolean indicating if `exclude` is
`None` and set the value of `exclude` to its default value if that's
the case. This makes sure that the flow enters the correct condition on
following iterations and also keeps the original value if the condition
is not met.

Also, the value of `gitignore` is initialized as `None` and overriden
if necessary. The value of `root_gitignore` is always calculated to
avoid using additional variables (at the small cost of additional
computations).

Signed-off-by: Antonio Ossa Guerra <aaossa@uc.cl>
2 years agoUpdate docs to include pycodestyle (#3369)
Gerhard van Andel [Tue, 1 Nov 2022 18:42:48 +0000 (12:42 -0600)]
Update docs to include pycodestyle (#3369)

* Add pycodestyle to using_black_with_other_tools.md

2 years agoBump pypa/cibuildwheel from 2.10.2 to 2.11.2 (#3367)
dependabot[bot] [Mon, 31 Oct 2022 13:50:42 +0000 (06:50 -0700)]
Bump pypa/cibuildwheel from 2.10.2 to 2.11.2 (#3367)

Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.10.2 to 2.11.2.
- [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.10.2...v2.11.2)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  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>
2 years agoBump peter-evans/create-or-update-comment from 2.0.1 to 2.1.0 (#3366)
dependabot[bot] [Mon, 31 Oct 2022 13:49:52 +0000 (06:49 -0700)]
Bump peter-evans/create-or-update-comment from 2.0.1 to 2.1.0 (#3366)

Bumps [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) from 2.0.1 to 2.1.0.
- [Release notes](https://github.com/peter-evans/create-or-update-comment/releases)
- [Commits](https://github.com/peter-evans/create-or-update-comment/compare/2b2c85d0bf1b8a7b4e7e344bd5c71dc4b9196e9f...5adcb0bb0f9fb3f95ef05400558bdb3f329ee808)

---
updated-dependencies:
- dependency-name: peter-evans/create-or-update-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>
2 years agoVim plugin: allow using system black rather than virtualenv (#3309)
Corey Hickey [Thu, 27 Oct 2022 23:55:33 +0000 (16:55 -0700)]
Vim plugin: allow using system black rather than virtualenv (#3309)

Provide a configuration parameter to the Vim plugin which will allow the
plugin to skip setting up a virtualenv. This is useful when there is a
system installation of black (e.g. from a Linux distribution) which the
user prefers to use.

Using a virtualenv remains the default.

- Fixes #3308

2 years agoAdd Archer Aviation to organizations in readme (#3361)
Hongbo Miao [Thu, 27 Oct 2022 21:22:44 +0000 (14:22 -0700)]
Add Archer Aviation to organizations in readme (#3361)

2 years agoWrap concatenated strings used as function args in parens (#3307)
Yilei "Dolee" Yang [Thu, 27 Oct 2022 01:03:10 +0000 (18:03 -0700)]
Wrap concatenated strings used as function args in parens (#3307)

Fixes #3292

2 years agoUpdate README.md (#3284)
Ned Western [Wed, 26 Oct 2022 02:04:31 +0000 (13:04 +1100)]
Update README.md (#3284)

Minor typo

2 years agoExclude pytest-xdist 3.0.2 (#3356)
Jelle Zijlstra [Wed, 26 Oct 2022 02:03:24 +0000 (19:03 -0700)]
Exclude pytest-xdist 3.0.2 (#3356)

We're getting warnings like https://github.com/psf/black/actions/runs/3325521041/jobs/5498291478 and I'm not sure how to fix them. I'll open an issue for a long-term solution, but for now avoid 3.0.2 to unbreak CI.

2 years agoEnforce empty lines before classes/functions with sticky leading comments. (#3302)
Yilei "Dolee" Yang [Wed, 26 Oct 2022 01:03:24 +0000 (18:03 -0700)]
Enforce empty lines before classes/functions with sticky leading comments. (#3302)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agoBump peter-evans/create-or-update-comment from 2.0.0 to 2.0.1 (#3354)
dependabot[bot] [Mon, 24 Oct 2022 18:40:19 +0000 (11:40 -0700)]
Bump peter-evans/create-or-update-comment from 2.0.0 to 2.0.1 (#3354)

Bumps [peter-evans/create-or-update-comment](https://github.com/peter-evans/create-or-update-comment) from 2.0.0 to 2.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/c9fcb64660bc90ec1cc535646af190c992007c32...2b2c85d0bf1b8a7b4e7e344bd5c71dc4b9196e9f)

---
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>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>