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

Implement DerefMut for WithNodeLevel #6443

Merged
merged 2 commits into from
Aug 11, 2023
Merged

Conversation

konstin
Copy link
Member

@konstin konstin commented Aug 9, 2023

Summary Implement DerefMut for WithNodeLevel so it can be used in the same way as PyFormatter. I want this for my WIP upstack branch to enable .fmt(f) on WithNodeLevel context. We could extend this to remove the other two method from WithNodeLevel.

@konstin
Copy link
Member Author

konstin commented Aug 9, 2023

@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

PR Check Results

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.01      8.2±0.03ms     5.0 MB/sec    1.00      8.1±0.02ms     5.0 MB/sec
formatter/numpy/ctypeslib.py               1.02  1671.4±55.66µs    10.0 MB/sec    1.00  1636.3±28.02µs    10.2 MB/sec
formatter/numpy/globals.py                 1.04    192.8±8.24µs    15.3 MB/sec    1.00    185.2±2.94µs    15.9 MB/sec
formatter/pydantic/types.py                1.00      3.5±0.12ms     7.2 MB/sec    1.00      3.5±0.11ms     7.2 MB/sec
linter/all-rules/large/dataset.py          1.00     10.2±0.02ms     4.0 MB/sec    1.00     10.2±0.10ms     4.0 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      2.8±0.01ms     6.0 MB/sec    1.00      2.8±0.03ms     6.0 MB/sec
linter/all-rules/numpy/globals.py          1.00    391.7±1.09µs     7.5 MB/sec    1.00    392.6±4.68µs     7.5 MB/sec
linter/all-rules/pydantic/types.py         1.00      5.3±0.01ms     4.8 MB/sec    1.00      5.3±0.01ms     4.8 MB/sec
linter/default-rules/large/dataset.py      1.00      5.4±0.01ms     7.5 MB/sec    1.00      5.4±0.01ms     7.5 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1196.1±7.65µs    13.9 MB/sec    1.02  1216.5±23.81µs    13.7 MB/sec
linter/default-rules/numpy/globals.py      1.00    140.8±0.61µs    21.0 MB/sec    1.08    151.9±5.61µs    19.4 MB/sec
linter/default-rules/pydantic/types.py     1.00      2.5±0.01ms    10.4 MB/sec    1.00      2.5±0.05ms    10.3 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00     10.4±0.15ms     3.9 MB/sec    1.01     10.5±0.18ms     3.9 MB/sec
formatter/numpy/ctypeslib.py               1.00  1962.5±20.37µs     8.5 MB/sec    1.00  1966.7±21.37µs     8.5 MB/sec
formatter/numpy/globals.py                 1.00    214.2±4.30µs    13.8 MB/sec    1.02    217.5±8.05µs    13.6 MB/sec
formatter/pydantic/types.py                1.00      4.4±0.06ms     5.8 MB/sec    1.00      4.4±0.07ms     5.9 MB/sec
linter/all-rules/large/dataset.py          1.00     13.2±0.13ms     3.1 MB/sec    1.01     13.3±0.18ms     3.1 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.5±0.04ms     4.7 MB/sec    1.01      3.6±0.04ms     4.7 MB/sec
linter/all-rules/numpy/globals.py          1.00    445.1±5.73µs     6.6 MB/sec    1.01    448.0±7.31µs     6.6 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.8±0.09ms     3.8 MB/sec    1.03      7.0±0.13ms     3.7 MB/sec
linter/default-rules/large/dataset.py      1.00      7.1±0.07ms     5.7 MB/sec    1.01      7.2±0.12ms     5.6 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1510.5±22.72µs    11.0 MB/sec    1.00  1513.5±16.49µs    11.0 MB/sec
linter/default-rules/numpy/globals.py      1.00    176.3±3.40µs    16.7 MB/sec    1.00    176.7±3.62µs    16.7 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.2±0.07ms     8.0 MB/sec    1.00      3.2±0.03ms     8.0 MB/sec

@konstin konstin mentioned this pull request Aug 9, 2023
@konstin konstin marked this pull request as ready for review August 9, 2023 19:36
@konstin konstin added internal An internal refactor or improvement formatter Related to the formatter labels Aug 10, 2023
@MichaReiser
Copy link
Member

Do you want to remove the other two methods?

@konstin konstin force-pushed the impl_deref_mut_for_WithNodeLevel branch from 9da5459 to 23af0a6 Compare August 10, 2023 16:32
@konstin konstin force-pushed the impl_deref_mut_for_WithNodeLevel branch from 23af0a6 to 39611cc Compare August 11, 2023 10:32
@konstin konstin enabled auto-merge (squash) August 11, 2023 10:32
@konstin konstin merged commit 0ef6af8 into main Aug 11, 2023
@konstin konstin deleted the impl_deref_mut_for_WithNodeLevel branch August 11, 2023 10:41
durumu pushed a commit to durumu/ruff that referenced this pull request Aug 12, 2023
**Summary** Implement `DerefMut` for `WithNodeLevel` so it can be used
in the same way as `PyFormatter`. I want this for my WIP upstack branch
to enable `.fmt(f)` on `WithNodeLevel` context. We could extend this to
remove the other two method from `WithNodeLevel`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter internal An internal refactor or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants