Commit Graph

416 Commits

Author SHA1 Message Date
Shantanu
b9ad4da2e8
Revert "confine pre-commit to stages (#3940)" (#4137)
This reverts commit 7686989fc8.
2024-01-01 16:55:25 -08:00
Shantanu
fe3376141c
Allow empty lines at beginnings of more blocks (#4130)
Fixes #4043, fixes #619

These include nested functions and methods.

I think the nested function case quite clearly improves readability. I
think the method case improves consistency, adherence to PEP 8 and
resolves a point of contention.
2024-01-01 15:46:09 -08:00
Jelle Zijlstra
db9c592967
Unify docstring detection (#4095)
Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>
2023-12-27 22:59:30 -08:00
Shantanu
bf6cabc804
Do not round cache mtimes (#4128)
Fixes #4116

This logic was introduced in #3821, I believe as a result of copying
logic inside mypy that I think isn't relevant to Black
2023-12-27 22:24:57 -08:00
cobalt
c80685f361
Treat walruses like other binary operators in subscripts (#4109)
Fixes #4078
2023-12-27 22:24:25 -08:00
Cooper Lees
1b831f214a
Add new changelog template (#4125) 2023-12-22 15:46:06 -08:00
Cooper Lees
ec91a2be3c
Prepare release 23.12.1 (#4124) 2023-12-22 15:04:32 -08:00
Bryce Willey
8fec1c3085
Adds paren to deps for hidden extra constraint (#4108)
Fix #4107
2023-12-14 00:28:28 -08:00
Jelle Zijlstra
35ce37ded7 Add new changelog template 2023-12-11 22:28:46 -08:00
Jelle Zijlstra
d9ad09a32b
Prepare release 23.12.0 (#4105) 2023-12-11 21:55:28 -08:00
Jelle Zijlstra
ebd543c0ac
Fix feature detection for parenthesized context managers (#4104) 2023-12-11 21:37:15 -08:00
Jelle Zijlstra
eb7661f8ab
Fix another case where we format dummy implementation for non-functions/classes (#4103) 2023-12-11 14:41:41 -08:00
Jelle Zijlstra
9aea9768cb
Only use dummy implementation logic for functions and classes (#4066)
Fixes #4063
2023-12-11 13:19:02 -08:00
Jelle Zijlstra
61b529b7d1
Allow empty lines at beginning of blocks (again) (#4060) 2023-12-09 18:29:09 -08:00
John Litborn
50d5756e8e
fix crash in preview mode with --line-length=1 (#4086) 2023-12-05 10:19:24 -08:00
Riyazuddin Khan
3416b2c82d
Fix: --line-ranges dedents a # fmt: off in the middle of a decorator (#4084)
Fixes #4068
2023-12-04 10:10:03 -08:00
Alex Waygood
a0e270d0f2
Build mypycified wheels for Python 3.12 (#4070) 2023-11-24 10:05:59 -08:00
Alex Waygood
69d49c5a6f
Bump mypy to 1.7.1 (#4069) 2023-11-24 06:19:54 -08:00
Henri Holopainen
fb5e5d2be6
Prefer more equal signs before a break when splitting chained assignments (#4010)
Fixes #4007
2023-11-22 19:11:49 -08:00
Yilei Yang
a8062983cd
Disable the stability check with --line-ranges for now. (#4034)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-11-20 20:45:39 -08:00
tungol
89e28ea66f
Permit standalone form feed characters at the module level (#4021)
Co-authored-by: Stephen Morton <git@tungol.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-11-20 20:44:33 -08:00
Cooper Lees
30c6bb3651
[docker ci] Split up amd64 (x86_64) and arm64 builds (#4054)
* [docker ci] Split up amd64 (x86_64) and arm64 builds

- Lets run them seperately to cut down total time
- Will also more clearly show if either arch has specific problems
- Kept amd64 (x86_64) using qemu actions so if GitHub ever offers arm64 boxes it could stay working too

Fixes #3971

* Add CHANGES entry

---------

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-11-19 10:44:00 -08:00
Cooper Lees
96faa3b469
[docker] Build with 3.12 image (#4055)
Test:
```
crl-m1:black cooper$ docker build --tag black_3_12 .
...
 => [stage-1 2/2] COPY --from=builder /opt/venv /opt/venv                                                                                                                                                  0.2s
 => exporting to image                                                                                                                                                                                     0.1s
 => => exporting layers                                                                                                                                                                                    0.1s
 => => writing image sha256:bd66acc9d76d2c40d287b0684ce6601401631e0468204c4e6a81f8f1eebaf1dd                                                                                                               0.0s
 => => naming to docker.io/library/black_3_12

crl-m1:black cooper$ docker image ls | grep black_3_12
black_3_12                     latest            bd66acc9d76d   59 seconds ago   193MB
```
2023-11-18 18:09:47 -08:00
Cooper Lees
80a166f2e1
Make black[d] install + test run with 3.12 (#4035)
* Make black[d] install + test run with 3.12

- With aiohttp >= 3.9.0 we can now install all dependencies with 3.12
- Add actions to run 3.12
- Lint still needs to be 3.11

Test:
- `python3.12 -m venv /tmp/tb --upgrade-deps`
- `/tmp/tb/bin/pip install tox`
- `/tmp/tb/bin/pip install .[d]`
- `/tmp/tb/bin/tox -e py312`
```
  py312: OK (37.61=setup[3.98]+cmd[3.83,0.36,19.54,6.46,3.00,0.44] seconds)
  congratulations :) (37.63 seconds)
```

* Move to pypy-3.9

---------

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-11-18 12:09:55 -08:00
Yilei Yang
11da02da72
Handle more huggable immediately nested parens/brackets. (#4012)
Fixes #4011
2023-11-18 11:47:05 -08:00
Alex Waygood
d93a942a79
Upgrade mypy to 1.6.1 (#4049) 2023-11-18 11:42:36 -08:00
Jelle Zijlstra
58f31a70ef Add new release template 2023-11-07 22:10:35 -08:00
Jelle Zijlstra
2a1c67e0b2
Prepare release 23.11.0 (#4032) 2023-11-07 20:44:46 -08:00
Henri Holopainen
1a7d9c2f58
Preserve visible quote types for f-string debug expressions (#4005)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-11-07 20:19:32 -08:00
Shantanu
2e4fac9d87
Apply force exclude logic before symlink resolution (#4015) 2023-11-07 11:31:44 -08:00
Henri Holopainen
66008fda5d
[563] Fix standalone comments inside complex blocks crashing Black (#4016)
Bracket depth is not an accurate indicator of standalone comment position inside more complex blocks because bracket depth can be virtual (in loops' and lambdas' parameter blocks) or from optional parens. Here we try to stop cumulating lines upon standalone comments in complex blocks, and try to make standalone comment processing more simple. The fundamental idea is, that if we have a standalone comment, it needs to go on its own line, so we always have to split.

This is not perfect, but at least a first step.
2023-11-07 11:29:24 -08:00
rdrll
50ed6221d9
Fix long case blocks not split into multiple lines (#4024)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-11-07 06:31:58 -08:00
Yilei Yang
46be1f8e54
Support formatting specified lines (#4020) 2023-11-06 18:05:25 -08:00
Shantanu
ecbd9e8cf7
Fix crash with f-string docstrings (#4019)
Python does not consider f-strings to be docstrings, so we probably
shouldn't be formatting them as such

Fixes #4018

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-06 16:58:43 -08:00
Yilei Yang
e808e61db8
Preview: Keep requiring two empty lines between module-level docstring and first function or class definition (#4028)
Fixes #4027.
2023-11-06 14:30:04 -08:00
Shantanu
9e3daa1107
Fix arm wheels on macOS (#4017) 2023-11-05 18:29:37 -08:00
Jelle Zijlstra
c54c213d6a
Fix crash on await (a ** b) (#3994) 2023-11-02 20:42:11 -07:00
Jelle Zijlstra
5758da6e3c
Fix bytes strings being treated as docstrings (#4003)
Fixes #4002
2023-10-31 17:11:28 -07:00
Henri Holopainen
e50110353a
Produce equivalent code for docstrings containing backslash followed by whitespace(s) before newline (#4008)
Fixes #3727
2023-10-31 08:27:11 -07:00
Henri Holopainen
ddfecf06c1
Hug parens also with multiline unpacking (#3992) 2023-10-30 08:35:26 -07:00
David Culley
7686989fc8
confine pre-commit to stages (#3940)
See https://pre-commit.com/#confining-hooks-to-run-at-certain-stages

> If you are authoring a tool, it is usually a good idea to provide an appropriate `stages` property. For example a reasonable setting for a linter or code formatter would be `stages: [pre-commit, pre-merge-commit, pre-push, manual]`.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-10-27 15:43:34 -07:00
Satyam Namdev
53c4278a4c
Update CHANGES.md (#3988)
Fixed a grammatical mistake
2023-10-27 13:27:19 -07:00
sth
c369e446f9
Fix matching of absolute paths in --include (#3976) 2023-10-27 00:43:51 -07:00
Surav Shrestha
7bfa35cca8
docs: fix typos in change log and documentations (#3985) 2023-10-26 21:26:47 -07:00
Henri Holopainen
878937bcc3
[2213] Add support for single line format skip with other comments on the same line (#3959) 2023-10-25 09:47:21 -07:00
Henri Holopainen
1d4c31aa58
[925] Improve multiline dictionary and list indentation for sole function parameter (#3964) 2023-10-25 08:35:37 -07:00
Cooper Lees
ef1048d5f8
Add Unreleased template to CHANGES.md (#3973)
Add Unreleased template to CHANGES.md - Did this via tool working on in another branch
2023-10-24 01:26:40 -05:00
Cooper Lees
744d23b348
Prepare release 23.10.1 (#3969)
* Prepare release 23.10.1

* Update docs/usage_and_configuration/the_basics.md

Add missed version string

We need to automate or remove this from docs ... It's painful.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

---------

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-10-23 10:59:16 -07:00
Kiyoon Kim
8de4be5168
Fix CI failing (#3957)
* Fix CI failing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* docs: update CHANGES.md

* docs: fix changelog location to unreleased

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-23 10:37:14 -07:00
Dario Curreri
a7643fac8d
Add summary parameter to action (#3958) 2023-10-23 09:40:09 -07:00