GiGaGon
e5e5dad792
Fix await ellipses and remove async/await
soft keyword/identifier support ( #4676 )
...
* Update tokenize.py
* Update driver.py
* Update test_black.py
* Update test_black.py
* Update python37.py
* Update tokenize.py
* Update CHANGES.md
* Update CHANGES.md
* Update faq.md
* Update driver.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-06-05 18:50:42 -07:00
Pedro Mezacasa Muller
d0ff3bd6cb
Fix crash when a tuple is used as a ContextManager ( #4646 )
2025-04-08 21:42:17 -07:00
Tushar Sadhwani
950ec38c11
Disallow unwrapping tuples in an as
clause ( #4634 )
2025-04-01 07:49:37 -07:00
Tushar Sadhwani
2c135edf37
Handle # fmt: skip
followed by a comment ( #4635 )
2025-03-22 19:30:40 -07:00
Tushar Sadhwani
6144c46c6a
Fix parsing of walrus operator in complex with statements ( #4630 )
2025-03-20 14:00:11 -07:00
Tushar Sadhwani
dbb14eac93
Recursively unwrap tuples in del
statements ( #4628 )
2025-03-19 15:02:40 -07:00
Tushar Sadhwani
5342d2eeda
Replace the blib2to3 tokenizer with pytokens ( #4536 )
2025-03-15 17:41:19 -07:00
Pedro Mezacasa Muller
3e9dd25dad
Fix bug where # fmt: skip is not being respected with one-liner functions ( #4552 )
2025-03-03 15:11:21 -08:00
Jelle Zijlstra
5ae38dd370
Fix parser for TypeVar bounds ( #4602 )
2025-03-03 00:20:23 -08:00
rdrll
45cbe572ee
Add regression tests for Black’s previous inconsistent quote formatting with adjacent string literals ( #4580 )
2025-03-02 19:23:58 -08:00
cobalt
3d8129001f
Move wrap_long_dict_values_in_parens
to the preview style ( #4561 )
2025-01-27 17:46:13 -08:00
Pedro Mezacasa Muller
459562c71a
Improve function declaration wrapping when it contains generic type definitions ( #4553 )
...
---------
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2025-01-26 00:43:22 -08:00
Jelle Zijlstra
c0b92f3888
Prepare the 2025 stable style ( #4558 )
2025-01-24 18:00:35 -08:00
GiGaGon
e58baf15b9
Add test for #1187 ( #4559 )
...
Closes #1187
2025-01-23 21:20:47 -08:00
cobalt
584d0331c8
fix: Don't remove parenthesis around long dictionary values ( #4377 )
2025-01-16 22:09:22 -08:00
GiGaGon
3b00112ac5
Fix crash on formatting certain with statements ( #4538 )
...
Fixes #3678
2024-12-24 12:25:08 -08:00
GiGaGon
0aabac4fe0
Add regression test for #1765 ( #4530 )
2024-12-23 10:46:25 -08:00
GiGaGon
3fab5ade71
Prevent f-string merge quote changes with nested quotes ( #4498 )
2024-12-03 20:44:26 -08:00
Owen Christie
e54f86bae4
Two blank lines after an import should be reduced to one ( #4489 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-12-03 20:39:35 -08:00
cobalt
96ca1b6be3
fix: Remove parenthesis around sole list items ( #4312 )
2024-11-27 19:59:29 -08:00
Jelle Zijlstra
32ebb93003
Clean up Python 3.8 remnants ( #4473 )
2024-10-08 19:11:22 -07:00
Shantanu
2a45cecf29
Fix crashes with comments in parentheses ( #4453 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-15 19:34:02 -07:00
Terence Honles
823a7b0ff0
fix: fix PEP 646 support of tuple unpacking ( #4440 )
...
This change fixes unpacking a tuple or generic type when *args is a type
variable tuple.
2024-08-26 08:09:59 -07:00
Kanishk Pachauri
14b6e61970
fix: Enhace black efficiently to skip directories listed in .gitignore ( #4415 )
2024-08-02 09:24:39 -07:00
Tushar Sadhwani
b1c4dd96d7
fix: respect braces better in f-string parsing ( #4422 )
2024-08-02 09:21:39 -07:00
Tushar Sadhwani
721dff5493
fix: avoid formatting backslash strings inside f-strings ( #4401 )
2024-07-10 19:52:37 -07:00
Tushar Sadhwani
b677a643c5
tokenizer: skip lines that are just slash and whitespace ( #4343 )
2024-06-01 13:01:36 -07:00
Yilei Yang
9c1fd463e1
Make sure Black doesn't crash when fmt:off
is used before a closing paren ( #4363 )
2024-05-15 20:32:27 -04:00
Jelle Zijlstra
455de7703e
Fix another f-string regression ( #4339 )
2024-04-27 01:24:20 -07:00
Jelle Zijlstra
e4aaa8a994
Fix incorrect f-string tokenization ( #4332 )
2024-04-25 16:45:46 -07:00
Jelle Zijlstra
ba88fc372e
Simplify string tokenization regexes ( #4331 )
2024-04-24 23:11:31 -07:00
Jelle Zijlstra
3f0f8f1956
Support PEP 696 ( #4327 )
2024-04-23 22:08:37 -07:00
peterkra25
1354be2525
Add support to style function definitions with newlines before function stubs ( #4318 )
...
* Add support to style function definitions containing newlines before function stubs
* Relocated implementation for removal of newlines before function stubs with added tests for comments
---------
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-04-23 19:19:56 -07:00
Tushar Sadhwani
f4b644b82f
Prevent wrapping of multiline fstrings in parens ( #4325 )
2024-04-23 14:16:47 -07:00
Tushar Sadhwani
551ede2825
Add PEP 701 support ( #3822 )
...
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-04-22 08:19:19 -07:00
cobalt
13bd0925eb
fix: Stop moving multiline strings to a new line unless inside brackets ( #4289 )
...
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
2024-03-22 20:11:01 -06:00
rdrll
f78b15712a
Fix formatting for if
clauses in match-case
blocks ( #4269 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-03-16 07:38:07 -07:00
Samson Umezulike
7b5a657285
Fix --line-ranges behavior when ranges are at EOF ( #4273 )
...
Fixes #4264
2024-03-15 11:18:47 -07:00
cobalt
e4bfedbec2
fix: Don't move comments while splitting delimiters ( #4248 )
...
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
2024-03-01 07:02:56 -08:00
cobalt
8af439407c
fix: Don't remove comments along with parens ( #4218 )
...
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
2024-02-12 06:27:50 -08:00
Logan Hunt
dab37a6a11
Remove redundant parentheses in case
statement if
guards ( #4214 )
...
A follow up to #4024 but for `if` guards in `case` statements. I noticed this
when #4024 was made stable, and noticed I had some code that had extra parens
around the `if` guard.
2024-02-07 06:55:02 -08:00
Seung Wan Yoo
32230e6f5c
fix: bug where the doublestar operation had inconsistent formatting. ( #4154 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-02-05 05:33:11 -08:00
Brandon J
7edb50f5a0
fix: additional newline added to docstring when the previous line length is less than the line length limit minus 1 ( #4185 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-02-05 04:56:07 -08:00
Jelle Zijlstra
9728b8e9b8
Move hug_parens_with_braces_and_square_brackets into the unstable style ( #4198 )
...
Primarily because of #4036 (a crash) but also because of the feedback
in #4098 and #4099 .
2024-02-01 21:58:51 -08:00
cobalt
8bf04549ff
Consistently add trailing comma on typed parameters ( #4164 )
...
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-01-27 13:55:22 -08:00
Jelle Zijlstra
4f47cac192
Add --unstable flag ( #4096 )
2024-01-25 17:00:47 -08:00
Daniel Krzeminski
bccec8adfb
Show warning on invalid toml configuration ( #4165 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-01-25 16:41:37 -08:00
cobalt
a5196e6f1f
fix: Don't normalize whitespace before fmt:skip comments ( #4146 )
...
Signed-off-by: RedGuy12 <paul@reid-family.org>
2024-01-25 01:31:49 -08:00
Jelle Zijlstra
59b9d858a3
Create the 2024 stable style ( #4106 )
2024-01-24 17:06:14 -08:00
Shantanu
995e4ada14
Fix unnecessary nesting when wrapping long dict ( #4135 )
...
Fixes #4129
2024-01-19 17:13:26 -08:00