GiGaGon
e7bf7b4619
Fix CI mypyc 1.16 failure ( #4671 )
2025-05-29 14:10:29 -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
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
Shantanu
99dbf3006b
Cache executor to avoid hitting open file limits ( #4560 )
...
Fixes #4504 , fixes #3251
2025-01-25 09:28:06 -08:00
Jelle Zijlstra
c0b92f3888
Prepare the 2025 stable style ( #4558 )
2025-01-24 18:00:35 -08:00
cobalt
584d0331c8
fix: Don't remove parenthesis around long dictionary values ( #4377 )
2025-01-16 22:09:22 -08:00
Jelle Zijlstra
6e9654065c
Fix CI ( #4551 )
2025-01-16 21:21:08 -08:00
GiGaGon
e157ba4de5
Fix sus returns in strings.py ( #4546 )
2025-01-06 12:02:56 -08:00
Tony Wang
fdabd424e2
Speed up blib2to3
tokenization using startswith with a tuple ( #4541 )
2024-12-29 17:17:50 -08:00
GiGaGon
9431e98522
Fix integration between stdin filename and --force-exclude ( #4539 )
2024-12-27 16:48:23 -08:00
GiGaGon
3b00112ac5
Fix crash on formatting certain with statements ( #4538 )
...
Fixes #3678
2024-12-24 12:25:08 -08:00
cobalt
ed33205579
Fix type error ( #4537 )
2024-12-22 22:19:40 -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
Matej Aleksandrov
c98fc0c128
Update deprecated type aliases ( #4486 )
2024-10-23 07:00:55 -07:00
Matej Aleksandrov
fff747d61b
Fix formatting cells with magic methods and starting or trailing empty lines ( #4484 )
2024-10-14 06:55:59 -07:00
Jelle Zijlstra
f1a2f92bba
Include --unstable in cache key ( #4466 )
...
Fixes #4465
2024-09-27 13:41:29 -07:00
Matej Aleksandrov
8d9d18c033
Fix skipping Jupyter cells with unknown %% magic ( #4462 )
2024-09-19 19:35:46 -07:00
Shantanu
8fb2add1f7
Use builtin generics ( #4458 )
...
uvx ruff check --output-format concise src --target-version py39 --select UP006 --fix --unsafe-fixes
uvx ruff check --output-format concise src --target-version py39 --select F401 --fix
plus some manual fixups
2024-09-15 20:10:07 -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
Shantanu
b4d6d8632d
Drop Python 3.8 support ( #4452 )
2024-09-15 18:21:21 -07:00
Shantanu
ac018c16ca
Require newer aiohttp for blackd ( #4451 )
2024-09-15 18:05:23 -07:00
Shantanu
058da5f81a
Report Black version on internal error ( #4457 )
2024-09-12 15:24:56 -07:00
Sam Burnett
98a580bbdc
Added Python and grammar versions to a parser error message ( #4378 )
...
---------
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Shantanu Jain <hauntsaninja@gmail.com>
2024-09-08 14:24:54 -07:00
Matej Aleksandrov
f50aba4984
Fix broken GitHub link to black.schema.json ( #4445 )
2024-09-07 18:14:27 -07:00
Shantanu
9e13708be8
Prevent use on Python 3.12.5 ( #4447 )
...
Fixes #4446
See https://github.com/python/cpython/issues/123821
It's possible this is too strict? We could instead do this anytime the
AST safety check fails, but feels weird to have that happen
non-deterministically
2024-09-07 16:41:06 -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
Shantanu
699b45aef7
Fix type error in blackd ( #4442 )
2024-08-22 18:17:32 -07:00
Michael Eliachevitch
9ccf279a17
Document find_project_root
ignoring pyproject.toml
without [tool.black]
( #4425 )
...
Extend the docstring of black's `find_project_root` to mention that it ignores
`pyproject.toml` files without a `[tool.black]` section.
This is relevant because that function is also used by other python packages
that use black. I found that e.g. datamodel-code-generator [1] uses that
function and that there the ignoring of the pyproject.toml files lead to
a degradation [2]. I think in that case it would be better to not use black's function
for finding the pyproject.toml, but in any case this behavior should be documented.
1: https://github.com/koxudaxi/datamodel-code-generator
2: https://github.com/koxudaxi/datamodel-code-generator/issues/2052
Co-authored-by: Michael Eliachevitch <Michael.Eliachevitch@blueyonder.com>
2024-08-02 09:38:07 -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
Jelle Zijlstra
4b4ae43e8b
Fix incorrect linenos on fstring tokens with escaped newlines ( #4423 )
...
I don't think this can affect Black itself much (maybe for formatting
ranges), but I ran into this with https://github.com/JelleZijlstra/lib2toast
2024-08-01 11:54:15 -07:00
Tushar Sadhwani
721dff5493
fix: avoid formatting backslash strings inside f-strings ( #4401 )
2024-07-10 19:52:37 -07:00
Jelle Zijlstra
5e571ccbbe
Fix use of deprecated ast.Str ( #4393 )
2024-07-04 16:26:42 -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