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

Remove Parse trait #6235

Merged
merged 1 commit into from
Aug 1, 2023
Merged

Remove Parse trait #6235

merged 1 commit into from
Aug 1, 2023

Conversation

MichaReiser
Copy link
Member

Summary

This PR removes the Parse trait in favour of parse_program, parse_expression and parse_suite.

The motivation for this change is that Parse is a lot of boilerplate and the three functions above are suffucient for almost all use cases. The few other use cases
should use parse_suite and then extract the node manually. This has the added benefit that it doesn't give the users the false safety that the operation cannot fail (e.g. IfStatement::parse paniced if you passed anything other than an if statement).

Test Plan

cargo test

@MichaReiser
Copy link
Member Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

Base automatically changed from remove-unused-modes to main August 1, 2023 11:10
@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2023

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.01      8.3±0.15ms     4.9 MB/sec    1.00      8.2±0.16ms     5.0 MB/sec
formatter/numpy/ctypeslib.py               1.01  1661.5±43.60µs    10.0 MB/sec    1.00  1641.5±44.69µs    10.1 MB/sec
formatter/numpy/globals.py                 1.01    183.1±3.94µs    16.1 MB/sec    1.00    181.2±4.56µs    16.3 MB/sec
formatter/pydantic/types.py                1.00      3.5±0.04ms     7.2 MB/sec    1.00      3.6±0.14ms     7.2 MB/sec
linter/all-rules/large/dataset.py          1.00     11.0±0.06ms     3.7 MB/sec    1.00     11.1±0.11ms     3.7 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      2.8±0.03ms     5.9 MB/sec    1.00      2.8±0.01ms     5.9 MB/sec
linter/all-rules/numpy/globals.py          1.00    381.2±2.63µs     7.7 MB/sec    1.01    386.4±2.69µs     7.6 MB/sec
linter/all-rules/pydantic/types.py         1.01      5.0±0.10ms     5.1 MB/sec    1.00      5.0±0.02ms     5.1 MB/sec
linter/default-rules/large/dataset.py      1.00      5.8±0.07ms     7.0 MB/sec    1.01      5.9±0.08ms     6.9 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1221.3±21.75µs    13.6 MB/sec    1.01  1237.2±30.20µs    13.5 MB/sec
linter/default-rules/numpy/globals.py      1.00    132.2±2.01µs    22.3 MB/sec    1.05    138.2±7.28µs    21.4 MB/sec
linter/default-rules/pydantic/types.py     1.01      2.6±0.07ms     9.7 MB/sec    1.00      2.6±0.04ms     9.8 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00     10.3±0.27ms     4.0 MB/sec    1.06     10.9±0.28ms     3.7 MB/sec
formatter/numpy/ctypeslib.py               1.00  1984.9±77.31µs     8.4 MB/sec    1.03      2.0±0.06ms     8.2 MB/sec
formatter/numpy/globals.py                 1.00    217.0±8.99µs    13.6 MB/sec    1.04   225.7±14.63µs    13.1 MB/sec
formatter/pydantic/types.py                1.00      4.4±0.14ms     5.8 MB/sec    1.03      4.5±0.16ms     5.7 MB/sec
linter/all-rules/large/dataset.py          1.03     14.3±0.31ms     2.9 MB/sec    1.00     13.8±0.29ms     2.9 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.7±0.07ms     4.5 MB/sec    1.00      3.7±0.14ms     4.6 MB/sec
linter/all-rules/numpy/globals.py          1.03   453.4±13.30µs     6.5 MB/sec    1.00   439.6±11.35µs     6.7 MB/sec
linter/all-rules/pydantic/types.py         1.02      6.3±0.12ms     4.0 MB/sec    1.00      6.2±0.13ms     4.1 MB/sec
linter/default-rules/large/dataset.py      1.00      7.7±0.16ms     5.3 MB/sec    1.00      7.7±0.14ms     5.3 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1563.3±31.17µs    10.7 MB/sec    1.00  1559.0±43.50µs    10.7 MB/sec
linter/default-rules/numpy/globals.py      1.02    175.6±3.91µs    16.8 MB/sec    1.00    171.5±5.54µs    17.2 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.4±0.07ms     7.5 MB/sec    1.01      3.4±0.13ms     7.4 MB/sec

@zanieb zanieb added the internal An internal refactor or improvement label Aug 1, 2023
@MichaReiser MichaReiser merged commit debfca3 into main Aug 1, 2023
17 checks passed
@MichaReiser MichaReiser deleted the remove-parse-trait branch August 1, 2023 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal An internal refactor or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants