| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| pub fn expr_parenthesized(mut self, expr: &Expr) -> String { | ||
| self.unparse_expr(expr, precedence::MAX); | ||
| self.generate() | ||
| } |
There was a problem hiding this comment.
I've added this method to be able to generate an expression with parentheses. I didn't find a way to ensure it is parenthesized. Using expr to generate source code for Tuple, I got
tuple_expr = "([1], 2)" .expr(tuple_expr) # -> "[1], 2", but expected ([1], 2)
I am not sure about this, would be appreciated for more sophisticated solution.
Sorry, something went wrong.
ruff-ecosystem resultsLinter (stable)✅ ecosystem check detected no linter changes. Linter (preview)✅ ecosystem check detected no linter changes. |
Sorry, something went wrong.
There was a problem hiding this comment.
This is great thank you, and sorry for the delay! Can we experiment a bit with the fix?
Also, we should be gating this behind preview - both the expansion of detected expressions and the new fix. If you'd like, you can make these two separate functions in preview.rs since we may stabilize them independently.
Sorry, something went wrong.
There was a problem hiding this comment.
@dylwil3 Thanks for your review! I've pushed some changes according to your points:
Sorry, something went wrong.
…ld be simple to support - tuples containing mutable expressions - generator expressions - assignment expressions containing mutable expressions
…ld be simple to support - tuples containing mutable expressions - generator expressions - assignment expressions containing mutable expressions
|
@dylwil3 Could you please review the PR again? |
Sorry, something went wrong.
Yes! Sorry for the delay - I will not be able to get to this till the end of the week, but I have not forgotten! |
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you for your patience and for the great contribution!
Sorry, something went wrong.
* origin/main: [`flake8-bugbear`] Include certain guaranteed-mutable expressions: tuples, generators, and assignment expressions (`B006`) (#20024) [`flake8-comprehensions`] Clarify fix safety documentation (`C413`) (#20640) [ty] improve base conda distinction from child conda (#20675) [`ruff`] Extend FA102 with listed PEP 585-compatible APIs (#20659) [`ruff`] Handle argfile expansion errors gracefully (#20691) [`flynt`] Fix f-string quoting for mixed quote joiners (`FLY002`) (#20662) [ty] Fix file root matching for `/` [ruff,ty] Enable tracing's `log` feature [`flake8-annotations`] Fix return type annotations to handle shadowed builtin symbols (`ANN201`, `ANN202`, `ANN204`, `ANN205`, `ANN206`) (#20612) Bump 0.13.3 (#20685) Update benchmarking CI for cargo-codspeed v4 (#20686) [ty] Support single-starred argument for overload call (#20223) [ty] `~T` should never be assignable to `T` (#20606) [`pylint`] Clarify fix safety to include left-hand hashability (`PLR6201`) (#20518) [ty] No union with `Unknown` for module-global symbols (#20664) [`ty`] Reject renaming files to start with slash in Playground (#20666) [ty] Enums: allow multiple aliases to point to the same member (#20669)
Preview feature: #20024 Rule documentation: https://docs.astral.sh/ruff/rules/mutable-argument-default/
Preview feature: #20024 Rule documentation: https://docs.astral.sh/ruff/rules/mutable-argument-default/
…(`B006`) Preview feature: #20024 Rule documentation: https://docs.astral.sh/ruff/rules/mutable-argument-default/ This is currently stacked on #26950. They were technically separate preview features, but to fix some of the expanded mutable expressions requires the source-preserving fix.
| Back | FazBrowse Home | New Git URL |
Summary
Resolves #20004
The implementation now supports guaranteed-mutable expressions in the following cases:
Preserves original formatting for assignment value:
The expansion of detected expressions and the new fixes gated behind previews.
Test Plan