konstin
d4cfe1f2a7
Break before slice colon
**Summary** Break slices at the colon first, since the colon is separator with the lowest precedence and we're in a parenthesized context.
**Input**
```python
section_header_data = byte_array[byte_begin_index + byte_step_index * event_index : byte_begin_index + byte_step_index * (event_index + 1)]
```
**Black**
```python
section_header_data = byte_array[
byte_begin_index
+ byte_step_index * event_index : byte_begin_index
+ byte_step_index * (event_index + 1)
]
```
**Current formatting**
```python
section_header_data = byte_array[
byte_begin_index + byte_step_index * event_index : byte_begin_index
+ byte_step_index * (event_index + 1)
]
```
**Proposed formatting**
```python
section_header_data = byte_array[
byte_begin_index + byte_step_index * event_index
: byte_begin_index + byte_step_index * (event_index + 1)
]
```
This is another intentional black deviation, but i find it a clear style improvement.
This is consistent with adding a step:
```python
section_header_data2 = byte_array[
byte_begin_index + byte_step_index * event_index
: byte_begin_index + byte_step_index
: section_size
]
```
As-is, this regresses trailing colon comments:
**in**
```python
c1 = "c"[
1: # e
# f
2
]
```
**out**
```python
c1 = "c"[
1
: # e
# f
2
]
```
Fixes #7316
**Test Plan** Added the fixtures above.
2023-09-13 12:11:53 +02:00
..
2023-09-13 09:01:49 +00:00
2023-09-13 12:11:53 +02:00
2023-09-11 08:03:59 +00:00
2023-09-13 09:01:49 +00:00
2023-09-02 10:05:47 +02:00
2023-07-18 18:27:46 +00:00
2023-09-13 09:01:49 +00:00
2023-09-02 10:05:47 +02:00
2023-09-02 10:05:47 +02:00
2023-09-08 09:25:06 +00:00
2023-08-11 10:41:48 +00:00
2023-08-26 14:45:44 +00:00
2023-09-08 12:04:28 +02:00
2023-08-04 11:52:26 +00:00
2023-09-08 12:04:28 +02:00
2023-06-20 16:49:21 +00:00
2023-09-06 07:10:13 +00:00