Skip to content

Force parentheses for named expressions in more contexts #6494

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

Merged
merged 1 commit into from
Aug 11, 2023

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh marked this pull request as ready for review August 11, 2023 05:03
@charliermarsh charliermarsh added the formatter Related to the formatter label Aug 11, 2023
@charliermarsh charliermarsh requested a review from konstin August 11, 2023 05:03
@github-actions
Copy link
Contributor

PR Check Results

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00      8.3±0.04ms     4.9 MB/sec    1.00      8.3±0.09ms     4.9 MB/sec
formatter/numpy/ctypeslib.py               1.00  1632.8±11.59µs    10.2 MB/sec    1.01  1645.5±30.26µs    10.1 MB/sec
formatter/numpy/globals.py                 1.00    183.9±3.00µs    16.0 MB/sec    1.00    184.4±3.59µs    16.0 MB/sec
formatter/pydantic/types.py                1.00      3.5±0.03ms     7.3 MB/sec    1.01      3.5±0.04ms     7.3 MB/sec
linter/all-rules/large/dataset.py          1.00     10.4±0.06ms     3.9 MB/sec    1.01     10.5±0.06ms     3.9 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      2.8±0.02ms     6.0 MB/sec    1.01      2.8±0.01ms     5.9 MB/sec
linter/all-rules/numpy/globals.py          1.00    395.3±2.70µs     7.5 MB/sec    1.02    402.3±2.01µs     7.3 MB/sec
linter/all-rules/pydantic/types.py         1.00      5.4±0.02ms     4.7 MB/sec    1.01      5.4±0.03ms     4.7 MB/sec
linter/default-rules/large/dataset.py      1.00      5.5±0.02ms     7.5 MB/sec    1.01      5.5±0.02ms     7.4 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.01  1230.9±30.92µs    13.5 MB/sec    1.00  1219.4±22.97µs    13.7 MB/sec
linter/default-rules/numpy/globals.py      1.00    142.9±4.69µs    20.6 MB/sec    1.01    144.1±3.22µs    20.5 MB/sec
linter/default-rules/pydantic/types.py     1.00      2.5±0.01ms    10.4 MB/sec    1.01      2.5±0.04ms    10.3 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00     10.1±0.05ms     4.0 MB/sec    1.03     10.5±0.03ms     3.9 MB/sec
formatter/numpy/ctypeslib.py               1.00  1922.2±15.05µs     8.7 MB/sec    1.04  1990.3±49.22µs     8.4 MB/sec
formatter/numpy/globals.py                 1.00    199.7±2.81µs    14.8 MB/sec    1.02    203.9±5.74µs    14.5 MB/sec
formatter/pydantic/types.py                1.00      4.3±0.03ms     5.9 MB/sec    1.03      4.4±0.04ms     5.7 MB/sec
linter/all-rules/large/dataset.py          1.01     12.8±0.08ms     3.2 MB/sec    1.00     12.7±0.05ms     3.2 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.6±0.01ms     4.7 MB/sec    1.00      3.6±0.02ms     4.7 MB/sec
linter/all-rules/numpy/globals.py          1.00    374.3±4.76µs     7.9 MB/sec    1.00    372.8±6.62µs     7.9 MB/sec
linter/all-rules/pydantic/types.py         1.01      6.6±0.06ms     3.8 MB/sec    1.00      6.6±0.03ms     3.9 MB/sec
linter/default-rules/large/dataset.py      1.01      7.0±0.05ms     5.8 MB/sec    1.00      6.9±0.05ms     5.9 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.01  1459.2±13.06µs    11.4 MB/sec    1.00  1449.4±12.14µs    11.5 MB/sec
linter/default-rules/numpy/globals.py      1.00    148.7±1.74µs    19.8 MB/sec    1.00    148.5±1.10µs    19.9 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.1±0.03ms     8.1 MB/sec    1.00      3.1±0.02ms     8.1 MB/sec

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense if these are syntax errors. I'm a bit confused of where Black is handling this because these expressions aren't part of

https://github.com/psf/black/blob/01b8d3d4095ebdb91d0d39012a517931625c63cb/src/black/linegen.py#L1385-L1398

@charliermarsh
Copy link
Member Author

I’m not sure either. Our list was based off of that source.

@charliermarsh charliermarsh merged commit 2cedb40 into main Aug 11, 2023
@charliermarsh charliermarsh deleted the charlie/named branch August 11, 2023 05:54
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.

2 participants