Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format ExpressionStarred nodes #5654

Merged
merged 1 commit into from
Jul 11, 2023
Merged

Format ExpressionStarred nodes #5654

merged 1 commit into from
Jul 11, 2023

Conversation

MichaReiser
Copy link
Member

Summary

This PR implements formatting of ExprStarred nodes (call(*args)).

We deviate from black when formatting a trailing * comment. I opted for the "easiest" solution which is to simply make the comment a leading comment of the whole expression (requires no special handling in the formatter).
We can revisit the formatting if this happens to come up frequently (I hope no-one puts a comment there).

Test Plan

Increases the Jaccard index for django from 0.915 to 0.920

@MichaReiser MichaReiser linked an issue Jul 10, 2023 that may be closed by this pull request
@MichaReiser
Copy link
Member Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@MichaReiser MichaReiser added the formatter Related to the formatter label Jul 10, 2023
@MichaReiser MichaReiser requested a review from konstin July 10, 2023 15:03
@github-actions
Copy link
Contributor

github-actions bot commented Jul 10, 2023

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00      9.4±0.30ms     4.3 MB/sec    1.02      9.6±0.42ms     4.2 MB/sec
formatter/numpy/ctypeslib.py               1.02      2.2±0.11ms     7.4 MB/sec    1.00      2.2±0.11ms     7.6 MB/sec
formatter/numpy/globals.py                 1.03   251.4±17.07µs    11.7 MB/sec    1.00   244.8±11.72µs    12.1 MB/sec
formatter/pydantic/types.py                1.08      5.0±0.22ms     5.1 MB/sec    1.00      4.6±0.21ms     5.5 MB/sec
linter/all-rules/large/dataset.py          1.02     16.9±0.60ms     2.4 MB/sec    1.00     16.5±0.59ms     2.5 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.02      4.1±0.17ms     4.1 MB/sec    1.00      4.0±0.17ms     4.2 MB/sec
linter/all-rules/numpy/globals.py          1.00   524.1±25.26µs     5.6 MB/sec    1.01   528.8±25.03µs     5.6 MB/sec
linter/all-rules/pydantic/types.py         1.01      7.2±0.23ms     3.5 MB/sec    1.00      7.1±0.27ms     3.6 MB/sec
linter/default-rules/large/dataset.py      1.00      8.0±0.22ms     5.1 MB/sec    1.03      8.3±0.55ms     4.9 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1691.3±63.43µs     9.8 MB/sec    1.04  1760.3±60.30µs     9.5 MB/sec
linter/default-rules/numpy/globals.py      1.00    205.1±8.68µs    14.4 MB/sec    1.02   209.5±10.99µs    14.1 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.6±0.15ms     7.1 MB/sec    1.01      3.6±0.13ms     7.0 MB/sec

Windows

group                                      main                                    pr
-----                                      ----                                    --
formatter/large/dataset.py                 1.00      8.6±0.31ms     4.7 MB/sec     1.02      8.7±0.28ms     4.7 MB/sec
formatter/numpy/ctypeslib.py               1.00  1966.2±138.90µs     8.5 MB/sec    1.05      2.1±0.18ms     8.1 MB/sec
formatter/numpy/globals.py                 1.00   219.3±19.28µs    13.5 MB/sec     1.08   236.3±26.80µs    12.5 MB/sec
formatter/pydantic/types.py                1.00      4.3±0.26ms     5.9 MB/sec     1.00      4.3±0.23ms     5.9 MB/sec
linter/all-rules/large/dataset.py          1.00     14.7±0.51ms     2.8 MB/sec     1.02     14.9±0.57ms     2.7 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      4.0±0.18ms     4.2 MB/sec     1.00      3.9±0.17ms     4.2 MB/sec
linter/all-rules/numpy/globals.py          1.00   472.2±22.13µs     6.2 MB/sec     1.04   489.7±35.11µs     6.0 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.6±0.24ms     3.9 MB/sec     1.02      6.7±0.44ms     3.8 MB/sec
linter/default-rules/large/dataset.py      1.00      7.6±0.23ms     5.4 MB/sec     1.01      7.6±0.19ms     5.3 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1613.7±87.03µs    10.3 MB/sec     1.07  1719.1±72.91µs     9.7 MB/sec
linter/default-rules/numpy/globals.py      1.04   193.8±12.08µs    15.2 MB/sec     1.00    187.2±8.57µs    15.8 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.4±0.16ms     7.5 MB/sec     1.00      3.4±0.13ms     7.5 MB/sec

@MichaReiser MichaReiser enabled auto-merge (squash) July 11, 2023 06:02
@MichaReiser MichaReiser merged commit 987111f into main Jul 11, 2023
15 checks passed
@MichaReiser MichaReiser deleted the format-starred-expression branch July 11, 2023 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatter: Starred
2 participants