John Litborn
e4ae213f06
test preview cases with line-length 1 unless explicitly skipped ( #4087 )
...
* Add new flag for tests, --no-preview-line-length-1, to be used for test cases known to not work in preview mode with line-length=1. Also split out the problematic cases in three cases to separate files. Removed now redundant file which explicitly tested preview annotations with line-length=1
* mode.preview -> preview_mode, mark pep_572_remove_parens as failing with ll1
2023-12-06 07:17:33 -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
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
Yilei Yang
11da02da72
Handle more huggable immediately nested parens/brackets. ( #4012 )
...
Fixes #4011
2023-11-18 11:47:05 -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
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
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
Jelle Zijlstra
5edd99312a
Regression test for match variable inside match ( #3993 )
2023-10-28 11:05:53 -07:00
Shantanu
c712d57ca9
Add trailing comma test case for hugging parens ( #3991 )
2023-10-27 12:17:54 -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
Henri Holopainen
2db5ab0a7b
Allow empty line after block open before a comment or compound statement ( #3967 )
2023-10-23 07:38:36 -07:00
Henri Holopainen
882d8795c6
Fix merging implicit multiline strings that have inline comments ( #3956 )
...
* Fix test behaviour
* Add new test cases
* Skip merging strings that have inline comments
* Don't merge lines with multiline strings with inline comments
* Changelog entry
* Document implicit multiline string merging rules
* Fix PR number
2023-10-19 20:09:33 -07:00
Jelle Zijlstra
bb588073ab
Fix parser bug where "type" was misinterpreted as a keyword inside a match ( #3950 )
...
Fixes #3790
Slightly hacky, but I think this is correct and it should also improve performance somewhat.
2023-10-17 00:59:15 -07:00
Jelle Zijlstra
722735d20e
Fix grammar for type alias support ( #3949 )
...
Fixes #3948
2023-10-16 10:53:38 -07:00
Henri Holopainen
1648ac5180
Fix long lines with power operator(s) getting splitted before line length ( #3942 )
...
Fixes #3889
2023-10-16 07:08:21 -07:00
Jelle Zijlstra
935f303a0a
Fix test that was not being run ( #3939 )
2023-10-09 20:02:27 -07:00
Daniël van Noord
b7717c3f1e
Standardise newlines after module-level docstrings ( #3932 )
...
Co-authored-by: jpy-git <josephyoung.jpy@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-10-09 19:34:26 -07:00
Jelle Zijlstra
a69bda3b9b
Use inline flags for test cases ( #3931 )
...
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-10-09 18:43:47 -07:00