Commit Graph

1487 Commits

Author SHA1 Message Date
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
Jelle Zijlstra
cd9fef8bab
tomli: Don't worry about specific alpha releases (#3448)
This prevents bugs due to pypa/packaging#522.

Fixes #3447.
2022-12-17 19:02:01 -08:00
Jelle Zijlstra
23b92b48a5
Fix syntax error in match test (#3426) 2022-12-17 14:51:10 -08:00
Jelle Zijlstra
159984a735
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>
2022-12-17 10:31:47 -08:00
Cooper Lees
c0089ef19d
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
2022-12-17 11:19:45 -06:00
Yilei "Dolee" Yang
78163939f1
Fix an infinite recursion error exposed by #3440 (#3444) 2022-12-16 05:02:41 -08:00
Yilei "Dolee" Yang
aafc21aa77
Prefer splitting right hand side of assignment statements. (#3368) 2022-12-15 15:58:51 -08:00
Yilei "Dolee" Yang
658c8d8d96
Improve long values in dict literals (#3440) 2022-12-15 08:25:28 -08:00
Yilei "Dolee" Yang
a2821815af
Fix a crash when a colon line is marked between # fmt: off and # fmt: on (#3439) 2022-12-14 17:56:14 -08:00
Jelle Zijlstra
7d062ecd5f
Do not put the closing quotes in a docstring on a separate line (#3430)
Fixes #3320. Followup from #3044.
2022-12-12 23:56:38 -05:00
dependabot[bot]
abd2b2556a
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>
2022-12-12 06:28:12 -08:00
dependabot[bot]
9bbe11dd7b
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>
2022-12-12 06:27:18 -08:00
Richard Si
80de2372e4
Bump mypy[c] from 0.971 to 0.991 (#3380) 2022-12-10 12:56:34 -08:00
mainj12
5f0dc862f5
Adding pyproject.toml configuration output to verbose logging (#3392) 2022-12-10 12:56:14 -08:00
Marco Edward Gorelli
16b98abca9
make black[jupyter] installation cross-shell (#3394) 2022-12-10 11:49:33 -08:00
Yilei "Dolee" Yang
96e62c57e3
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.
2022-12-10 07:58:45 -08:00
Isac Byeonghoon Yoo
1f7f6de4ab
Fix type annotation for gitignore pathspec (#3416) 2022-12-10 07:08:05 -08:00
Jelle Zijlstra
2ddea293a8
Prepare release 22.12.0 (#3413) 2022-12-09 07:49:43 -08:00
Jelle Zijlstra
5b1443aefd
release: skip bad macos wheels for now (#3411)
Workaround for #3312
2022-12-08 20:36:39 -08:00
dependabot[bot]
9ace064d85
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>
2022-12-08 23:28:29 -05:00
Jelle Zijlstra
19c5fe429e
Fix CI with latest flake8-bugbear (#3412) 2022-12-08 20:11:07 -08:00
dependabot[bot]
d4a85643a4
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>
2022-11-21 08:24:46 -08:00
sckarlin
27932494bc
Wordsmith current_style.md (#3383)
"realtime" doesn't make sense in this context.
2022-11-14 07:31:43 -08:00
Antonio Ossa-Guerra
d97b7898b3
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>
2022-11-11 20:05:36 -05:00
Maximilian Cosmo Sitter
c23a5c15aa
Clarify that Black runs with --safe by default (#3378) 2022-11-10 10:14:48 -05:00
Yilei "Dolee" Yang
8091b2503d
Correctly handle trailing commas that are inside a line's leading non-nested parens (#3370)
- Fixes #1671
- Fixes #3229
2022-11-09 15:08:51 -08:00
Antonio Ossa-Guerra
ffaaf48382
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>
2022-11-08 07:50:04 -08:00
Antonio Ossa-Guerra
0e9d29ab73
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>
2022-11-04 22:09:59 -07:00
Gerhard van Andel
2704dc796b
Update docs to include pycodestyle (#3369)
* Add pycodestyle to using_black_with_other_tools.md
2022-11-01 11:42:48 -07:00
dependabot[bot]
f67791427d
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>
2022-10-31 06:50:42 -07:00
dependabot[bot]
3179a442af
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](2b2c85d0bf...5adcb0bb0f)

---
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>
2022-10-31 06:49:52 -07:00
Corey Hickey
4bb6e4f64a
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
2022-10-27 18:55:33 -05:00
Hongbo Miao
d338de7f68
Add Archer Aviation to organizations in readme (#3361) 2022-10-27 17:22:44 -04:00
Yilei "Dolee" Yang
b73b77a9b0
Wrap concatenated strings used as function args in parens (#3307)
Fixes #3292
2022-10-26 18:03:10 -07:00
Ned Western
09d4acdcb7
Update README.md (#3284)
Minor typo
2022-10-25 19:04:31 -07:00
Jelle Zijlstra
527248b389
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.
2022-10-25 19:03:24 -07:00
Yilei "Dolee" Yang
4abc0399b5
Enforce empty lines before classes/functions with sticky leading comments. (#3302)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-25 18:03:24 -07:00
dependabot[bot]
fbc5136aa0
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](c9fcb64660...2b2c85d0bf)

---
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>
2022-10-24 11:40:19 -07:00
dependabot[bot]
26de5f91c3
Bump peter-evans/find-comment from 2.0.0 to 2.0.1 (#3353)
Bumps [peter-evans/find-comment](https://github.com/peter-evans/find-comment) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/peter-evans/find-comment/releases)
- [Commits](1769778a0c...b657a70ff1)

---
updated-dependencies:
- dependency-name: peter-evans/find-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>
2022-10-24 09:50:14 -07:00
dependabot[bot]
f22273a72b
Bump sphinx from 5.2.3 to 5.3.0 in /docs (#3333)
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:production
  update-type: version-update:semver-minor

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-17 21:12:41 -04:00
jlplenio
575220f460
Clarify check argument is needed for github action workflow (#3325)
Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2022-10-15 19:44:02 +01:00