-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix WithItem
ranges for parenthesized, non-as
items
#6782
Conversation
ast::ParenthesizedExpr { | ||
expr: elts.into_iter().next().unwrap(), | ||
range: (location..end_location).into(), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where the parser deals with parenthesize expressions. We return the full range, as well as the underlying expression, rather than discarding the range here as we are today.
<location:@L> "[" <e:ListLiteralValues?> "]"<end_location:@R> => { | ||
let elts = e.unwrap_or_default(); | ||
let elts = e.into_iter().flatten().map(ast::Expr::from).collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this requires another allocation unfortunately, since we have to translate Vec<ParenthesizedExpr>
to Vec<Expr>
?
orelse: Box::new(orelse), | ||
test: Box::new(test.into()), | ||
body: Box::new(body.into()), | ||
orelse: Box::new(orelse.into()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We mostly need to add these From
/Into
conversions everywhere to translate between ParenthesizedExpr
and Expr
.
I am looking for feedback on the approach prior to fixing the remaining ~150 compiler errors. |
a2a2070
to
f893965
Compare
Okay, this now compiles and does the right thing. The ranges are fixed. |
is_async: false, | ||
items: [ | ||
WithItem { | ||
range: 566..569, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is key: the length of the WithItem
is 3, while the length of the inner item is 1.
5fea24a
to
bdfc5a7
Compare
PR Check ResultsEcosystem✅ ecosystem check detected no changes. |
Note that, on with ((1), (2), 3 as x, (5)): pass The last |
AFAICT in the CPython AST the withitems don't have ranges at all so not sure it can guide us:
|
#[derive(Clone, Debug)] | ||
pub struct ParenthesizedExpr { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this type private (or pub(super) at most) and move it to parser.rs
because it is mainly an internal workaround, but by no means public api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately no -- it somehow becomes part of the public API in the generated LALRPOP code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm torn on this, mainly because of
Consensus seems to be that we don't really understand why the current grammar works (i.e., how it avoids these ambiguities as-is).
and because I believe that LR(1) or LALR(1) grammars should be able to support with statements without the need for hacks (It's LL(1) grammars that the Python PEP points out are unsupported). That's why I'm convinced that the issue is somewhere else in our grammar (but yeah, LALRPOP ambiguity messages are impossible to understand).
I'm okayish with merging this when we open an issue to follow up, ideally as part of the formatter Beta. Maybe I can get some time to play around with this.
@MichaReiser - do you have an opinion on whether the ranges should include or exclude the parentheses? I’m torn on that myself. (Either outcome requires a code change — the PR here includes the parentheses, although that’s inconsistent with some other AST nodes, like the parenthesized pattern match case.) |
I'm honestly not sure what's correct here. Given: with (a): pass We currently omit the parentheses for the range (so the withitem has the range of Given: with (a) as b: pass We use the full range of |
Those ranges look inconvenient but correct to me. It's the same if you'd see with (a):
pass
with (a) + b:
pass |
I'm leaning towards including the range similar to tuples, where the parentheses are optional. With items are different from parenthesized expressions (and patterns) in that they don't allow nesting: with (((a) as b)):
pass Isn't valid syntax However, this does raises the question of what the expected range should be for: with (a): pass Is this a with item with a parenthesized expression or is the with item parenthesized, containing an expression? We would need to take a look at the grammar to understand the precedence. Edit:
My understanding of this is that the |
I guess the with (
a,
b
): pass Meaning, it's not the with items that are parenthesized, but all of them. |
Oh, I did read the spec incorrectly. With items that cannot be parenthesized. It's either parenthesizing all with items, or the expression in the with item. I would still expect the
The range of the expression statement is 0..3, the range of the expression is |
I might be misunderstanding your comment but with (a, b): pass
with (a, b) as c: pass
with ((a, b) as c): pass
with (a as b): pass In the first case, that's two In the second case, it's a single In the third and fourth cases, that's a single |
No, it should not include the ranges in my view because WithItems can't have parentheses. It's the From ny comment aboce I studied the grammar and the precedence rules described in PEP617.
My understanding of this is that the What I meant that isn't valid is |
Ah, I see, I think I was just confused by the message you posted after that, saying that it should include the parentheses. But I assume there, when you say with ((a), b):
pass Since in this case, the outer parentheses belong to the |
yes, but we need to be careful with terminology. The parentheses belong to the expression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It hurts, but I think that's the best we can do without rewriting our parser 😭
I also don't fully understand why this is working. It could be poor luck, or even a bug, but we take it...
<location:@L> <context_expr:Test<Goal>> <end_location:@R> if Goal != "as" => ast::WithItem { | ||
context_expr: context_expr.into(), | ||
optional_vars: None, | ||
range: (location..end_location).into(), | ||
}, | ||
<location:@L> <context_expr:Test<"all">> "as" <optional_vars:Expression<"all">> <end_location:@R> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: We could probably use the range from the context_expr
directly rather than collecting another range.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is leading me down some confusing path around ranges for parenthesized named expressions in with-items 😭
}, | ||
<location:@L> "(" <elts:OneOrMore<Test<"all">>> <trailing_comma:","?> ")" <end_location:@R> if Goal != "no-withitems" => { | ||
if elts.len() == 1 && trailing_comma.is_none() { | ||
elts.into_iter().next().unwrap() | ||
ast::ParenthesizedExpr { | ||
expr: elts.into_iter().next().unwrap().into(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
into
...unwrap
...into
what 🤯
This is still getting on case wrong (sigh): with (a := 1):
pass The expression rules require that the named expression is parenthesized, so the |
db4d356
to
a5ed1ff
Compare
Okay, this is now working in all (?) cases. I had to special-case parenthesized expressions and other expressions that "require" parentheses. |
I now need to look into the formatter changes. |
a5ed1ff
to
f188605
Compare
I also want to see the CodSpeed benchmarks. |
Parse time regresses by 1-2%. Can you change the codespeed threshold to 1% to see how it goes? |
Does this mean the PR is ready to review or not? If not, can you put it back in draft state? |
No, the PR is ready to review. Or rather, to merge? I actually didn’t expect it to be re-reviewed given that it had already been reviewed and accepted. |
(The formatter changes are downstream of this, for example, #3711.) |
f188605
to
9e2aec4
Compare
CodSpeed Performance ReportMerging #6782 will degrade performances by 1.73%Comparing Summary
Benchmarks breakdown
|
9e2aec4
to
4e20c35
Compare
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://beta.ruff.rs/docs) ([source](https://togithub.com/astral-sh/ruff), [changelog](https://togithub.com/astral-sh/ruff/releases)) | `^0.0.286` -> `^0.0.287` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.0.286/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.0.286/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.0.287`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.287) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.286...v0.0.287) <!-- Release notes generated using configuration in .github/release.yml at v0.0.287 --> #### What's Changed ##### Rules - \[refurb] Implement previuew `repeated-append` rule (`FURB113`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6702](https://togithub.com/astral-sh/ruff/pull/6702) - \[refurb] Implement previuew `delete-full-slice` rule (`FURB131`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6897](https://togithub.com/astral-sh/ruff/pull/6897) - \[refurb] Implement preview `check-and-remove-from-set` rule (`FURB132`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6904](https://togithub.com/astral-sh/ruff/pull/6904) ##### Bug Fixes - Expand `PERF401` and `PERF402` with type checks by [@​qdegraaf](https://togithub.com/qdegraaf) in [https://github.com/astral-sh/ruff/pull/6994](https://togithub.com/astral-sh/ruff/pull/6994) - Insert space to avoid syntax error in RSE fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6886](https://togithub.com/astral-sh/ruff/pull/6886) - Avoid PEP 604 upgrades that lead to invalid syntax by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6888](https://togithub.com/astral-sh/ruff/pull/6888) - Fix ranges for global usages by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6917](https://togithub.com/astral-sh/ruff/pull/6917) - Avoid invalid fix for C417 with separate keys and values by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6954](https://togithub.com/astral-sh/ruff/pull/6954) - Avoid panic when `typename` is provided as a keyword argument by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6955](https://togithub.com/astral-sh/ruff/pull/6955) - Improve compatibility between multi-statement PYI rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7024](https://togithub.com/astral-sh/ruff/pull/7024) - Fixed panic in `missing_copyright_notice` by [@​WindowGenerator](https://togithub.com/WindowGenerator) in [https://github.com/astral-sh/ruff/pull/7029](https://togithub.com/astral-sh/ruff/pull/7029) - Avoid lexer infinite loop on invalid input by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/6937](https://togithub.com/astral-sh/ruff/pull/6937) - Fix `WithItem` ranges for parenthesized, non-`as` items by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6782](https://togithub.com/astral-sh/ruff/pull/6782) #### New Contributors - [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) made their first contribution in [https://github.com/astral-sh/ruff/pull/6702](https://togithub.com/astral-sh/ruff/pull/6702) - [@​Anselmoo](https://togithub.com/Anselmoo) made their first contribution in [https://github.com/astral-sh/ruff/pull/6986](https://togithub.com/astral-sh/ruff/pull/6986) - [@​njgrisafi](https://togithub.com/njgrisafi) made their first contribution in [https://github.com/astral-sh/ruff/pull/7032](https://togithub.com/astral-sh/ruff/pull/7032) - [@​WindowGenerator](https://togithub.com/WindowGenerator) made their first contribution in [https://github.com/astral-sh/ruff/pull/7029](https://togithub.com/astral-sh/ruff/pull/7029) **Full Changelog**: astral-sh/ruff@v0.0.286...v0.0.287 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ixm-one/pytest-cmake-presets). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi42OC4xIiwidXBkYXRlZEluVmVyIjoiMzYuNjguMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://beta.ruff.rs/docs) ([source](https://togithub.com/astral-sh/ruff), [changelog](https://togithub.com/astral-sh/ruff/releases)) | `0.0.286` -> `0.0.287` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.0.286/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.0.286/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.0.287`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.287) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.286...v0.0.287) <!-- Release notes generated using configuration in .github/release.yml at v0.0.287 --> #### What's Changed ##### Rules - \[refurb] Implement previuew `repeated-append` rule (`FURB113`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6702](https://togithub.com/astral-sh/ruff/pull/6702) - \[refurb] Implement previuew `delete-full-slice` rule (`FURB131`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6897](https://togithub.com/astral-sh/ruff/pull/6897) - \[refurb] Implement preview `check-and-remove-from-set` rule (`FURB132`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6904](https://togithub.com/astral-sh/ruff/pull/6904) ##### Bug Fixes - Expand `PERF401` and `PERF402` with type checks by [@​qdegraaf](https://togithub.com/qdegraaf) in [https://github.com/astral-sh/ruff/pull/6994](https://togithub.com/astral-sh/ruff/pull/6994) - Insert space to avoid syntax error in RSE fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6886](https://togithub.com/astral-sh/ruff/pull/6886) - Avoid PEP 604 upgrades that lead to invalid syntax by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6888](https://togithub.com/astral-sh/ruff/pull/6888) - Fix ranges for global usages by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6917](https://togithub.com/astral-sh/ruff/pull/6917) - Avoid invalid fix for C417 with separate keys and values by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6954](https://togithub.com/astral-sh/ruff/pull/6954) - Avoid panic when `typename` is provided as a keyword argument by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6955](https://togithub.com/astral-sh/ruff/pull/6955) - Improve compatibility between multi-statement PYI rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7024](https://togithub.com/astral-sh/ruff/pull/7024) - Fixed panic in `missing_copyright_notice` by [@​WindowGenerator](https://togithub.com/WindowGenerator) in [https://github.com/astral-sh/ruff/pull/7029](https://togithub.com/astral-sh/ruff/pull/7029) - Avoid lexer infinite loop on invalid input by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/6937](https://togithub.com/astral-sh/ruff/pull/6937) - Fix `WithItem` ranges for parenthesized, non-`as` items by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6782](https://togithub.com/astral-sh/ruff/pull/6782) #### New Contributors - [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) made their first contribution in [https://github.com/astral-sh/ruff/pull/6702](https://togithub.com/astral-sh/ruff/pull/6702) - [@​Anselmoo](https://togithub.com/Anselmoo) made their first contribution in [https://github.com/astral-sh/ruff/pull/6986](https://togithub.com/astral-sh/ruff/pull/6986) - [@​njgrisafi](https://togithub.com/njgrisafi) made their first contribution in [https://github.com/astral-sh/ruff/pull/7032](https://togithub.com/astral-sh/ruff/pull/7032) - [@​WindowGenerator](https://togithub.com/WindowGenerator) made their first contribution in [https://github.com/astral-sh/ruff/pull/7029](https://togithub.com/astral-sh/ruff/pull/7029) **Full Changelog**: astral-sh/ruff@v0.0.286...v0.0.287 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/jankatins/pr-workflow-example). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi42OC4xIiwidXBkYXRlZEluVmVyIjoiMzYuNjguMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://beta.ruff.rs/docs) ([source](https://togithub.com/astral-sh/ruff), [changelog](https://togithub.com/astral-sh/ruff/releases)) | `==0.0.286` -> `==0.0.287` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.0.286/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.0.286/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.0.287`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.287) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.286...v0.0.287) <!-- Release notes generated using configuration in .github/release.yml at v0.0.287 --> #### What's Changed ##### Rules - \[refurb] Implement previuew `repeated-append` rule (`FURB113`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6702](https://togithub.com/astral-sh/ruff/pull/6702) - \[refurb] Implement previuew `delete-full-slice` rule (`FURB131`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6897](https://togithub.com/astral-sh/ruff/pull/6897) - \[refurb] Implement preview `check-and-remove-from-set` rule (`FURB132`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6904](https://togithub.com/astral-sh/ruff/pull/6904) ##### Bug Fixes - Expand `PERF401` and `PERF402` with type checks by [@​qdegraaf](https://togithub.com/qdegraaf) in [https://github.com/astral-sh/ruff/pull/6994](https://togithub.com/astral-sh/ruff/pull/6994) - Insert space to avoid syntax error in RSE fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6886](https://togithub.com/astral-sh/ruff/pull/6886) - Avoid PEP 604 upgrades that lead to invalid syntax by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6888](https://togithub.com/astral-sh/ruff/pull/6888) - Fix ranges for global usages by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6917](https://togithub.com/astral-sh/ruff/pull/6917) - Avoid invalid fix for C417 with separate keys and values by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6954](https://togithub.com/astral-sh/ruff/pull/6954) - Avoid panic when `typename` is provided as a keyword argument by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6955](https://togithub.com/astral-sh/ruff/pull/6955) - Improve compatibility between multi-statement PYI rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7024](https://togithub.com/astral-sh/ruff/pull/7024) - Fixed panic in `missing_copyright_notice` by [@​WindowGenerator](https://togithub.com/WindowGenerator) in [https://github.com/astral-sh/ruff/pull/7029](https://togithub.com/astral-sh/ruff/pull/7029) - Avoid lexer infinite loop on invalid input by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/6937](https://togithub.com/astral-sh/ruff/pull/6937) - Fix `WithItem` ranges for parenthesized, non-`as` items by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6782](https://togithub.com/astral-sh/ruff/pull/6782) #### New Contributors - [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) made their first contribution in [https://github.com/astral-sh/ruff/pull/6702](https://togithub.com/astral-sh/ruff/pull/6702) - [@​Anselmoo](https://togithub.com/Anselmoo) made their first contribution in [https://github.com/astral-sh/ruff/pull/6986](https://togithub.com/astral-sh/ruff/pull/6986) - [@​njgrisafi](https://togithub.com/njgrisafi) made their first contribution in [https://github.com/astral-sh/ruff/pull/7032](https://togithub.com/astral-sh/ruff/pull/7032) - [@​WindowGenerator](https://togithub.com/WindowGenerator) made their first contribution in [https://github.com/astral-sh/ruff/pull/7029](https://togithub.com/astral-sh/ruff/pull/7029) **Full Changelog**: astral-sh/ruff@v0.0.286...v0.0.287 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/allenporter/flux-local). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi42OC4xIiwidXBkYXRlZEluVmVyIjoiMzYuNjguMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://beta.ruff.rs/docs) ([source](https://togithub.com/astral-sh/ruff), [changelog](https://togithub.com/astral-sh/ruff/releases)) | `==0.0.286` -> `==0.0.287` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.0.286/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.0.286/0.0.287?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.0.287`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.287) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.286...v0.0.287) <!-- Release notes generated using configuration in .github/release.yml at v0.0.287 --> #### What's Changed ##### Rules - \[refurb] Implement previuew `repeated-append` rule (`FURB113`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6702](https://togithub.com/astral-sh/ruff/pull/6702) - \[refurb] Implement previuew `delete-full-slice` rule (`FURB131`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6897](https://togithub.com/astral-sh/ruff/pull/6897) - \[refurb] Implement preview `check-and-remove-from-set` rule (`FURB132`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6904](https://togithub.com/astral-sh/ruff/pull/6904) ##### Bug Fixes - Expand `PERF401` and `PERF402` with type checks by [@​qdegraaf](https://togithub.com/qdegraaf) in [https://github.com/astral-sh/ruff/pull/6994](https://togithub.com/astral-sh/ruff/pull/6994) - Insert space to avoid syntax error in RSE fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6886](https://togithub.com/astral-sh/ruff/pull/6886) - Avoid PEP 604 upgrades that lead to invalid syntax by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6888](https://togithub.com/astral-sh/ruff/pull/6888) - Fix ranges for global usages by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6917](https://togithub.com/astral-sh/ruff/pull/6917) - Avoid invalid fix for C417 with separate keys and values by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6954](https://togithub.com/astral-sh/ruff/pull/6954) - Avoid panic when `typename` is provided as a keyword argument by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6955](https://togithub.com/astral-sh/ruff/pull/6955) - Improve compatibility between multi-statement PYI rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7024](https://togithub.com/astral-sh/ruff/pull/7024) - Fixed panic in `missing_copyright_notice` by [@​WindowGenerator](https://togithub.com/WindowGenerator) in [https://github.com/astral-sh/ruff/pull/7029](https://togithub.com/astral-sh/ruff/pull/7029) - Avoid lexer infinite loop on invalid input by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/6937](https://togithub.com/astral-sh/ruff/pull/6937) - Fix `WithItem` ranges for parenthesized, non-`as` items by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6782](https://togithub.com/astral-sh/ruff/pull/6782) #### New Contributors - [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) made their first contribution in [https://github.com/astral-sh/ruff/pull/6702](https://togithub.com/astral-sh/ruff/pull/6702) - [@​Anselmoo](https://togithub.com/Anselmoo) made their first contribution in [https://github.com/astral-sh/ruff/pull/6986](https://togithub.com/astral-sh/ruff/pull/6986) - [@​njgrisafi](https://togithub.com/njgrisafi) made their first contribution in [https://github.com/astral-sh/ruff/pull/7032](https://togithub.com/astral-sh/ruff/pull/7032) - [@​WindowGenerator](https://togithub.com/WindowGenerator) made their first contribution in [https://github.com/astral-sh/ruff/pull/7029](https://togithub.com/astral-sh/ruff/pull/7029) **Full Changelog**: astral-sh/ruff@v0.0.286...v0.0.287 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/allenporter/pyrainbird). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi42OC4xIiwidXBkYXRlZEluVmVyIjoiMzYuNjguMSIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://beta.ruff.rs/docs) ([source](https://togithub.com/astral-sh/ruff), [changelog](https://togithub.com/astral-sh/ruff/releases)) | `^0.0.286` -> `^0.0.289` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.0.289?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.0.289?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.0.286/0.0.289?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.0.286/0.0.289?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.0.289`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.289) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.288...v0.0.289) <!-- Release notes generated using configuration in .github/release.yml at v0.0.289 --> #### What's Changed ##### Bug Fixes - Invert condition for < and <= in outdated version block by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7284](https://togithub.com/astral-sh/ruff/pull/7284) - Ignore `@override` method when enforcing `bad-dunder-name` rule by [@​brendonh8](https://togithub.com/brendonh8) in [https://github.com/astral-sh/ruff/pull/7224](https://togithub.com/astral-sh/ruff/pull/7224) - Add `NotebookIndex` to the cache by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/6863](https://togithub.com/astral-sh/ruff/pull/6863) ##### Preview This release includes a new preview mode which can be used to opt-in to unstable rules and features. - Update rule selection to respect preview mode by [@​zanieb](https://togithub.com/zanieb) in [https://github.com/astral-sh/ruff/pull/7195](https://togithub.com/astral-sh/ruff/pull/7195) - Display the `--preview` option in the CLI help menu by [@​zanieb](https://togithub.com/zanieb) in [https://github.com/astral-sh/ruff/pull/7274](https://togithub.com/astral-sh/ruff/pull/7274) See the [documentation](https://beta.ruff.rs/docs/preview/) and [versioning discussion](https://togithub.com/astral-sh/ruff/discussions/6998) for more details. #### New Contributors - [@​brendonh8](https://togithub.com/brendonh8) made their first contribution in [https://github.com/astral-sh/ruff/pull/7224](https://togithub.com/astral-sh/ruff/pull/7224) **Full Changelog**: astral-sh/ruff@v0.0.288...v0.0.289 ### [`v0.0.288`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.288) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.287...v0.0.288) #### What's Changed ##### Breaking Changes - Remove emoji identifier support by [@​MichaReiser](https://togithub.com/MichaReiser) in [https://github.com/astral-sh/ruff/pull/7212](https://togithub.com/astral-sh/ruff/pull/7212) - Location agnostic GitLab fingerprints by [@​gregersn](https://togithub.com/gregersn) in [https://github.com/astral-sh/ruff/pull/7203](https://togithub.com/astral-sh/ruff/pull/7203) ##### Rules - \[`ruff`] - `RUF001`: Remove autofix for ambiguous unicode rule by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7168](https://togithub.com/astral-sh/ruff/pull/7168) ##### Settings - \[`flake8-self`] - `SLF001`: Add `extend-ignore-names` option by [@​jaap3](https://togithub.com/jaap3) in [https://github.com/astral-sh/ruff/pull/7194](https://togithub.com/astral-sh/ruff/pull/7194) ##### Bug Fixes - \[`flake8-bugbear`] - `B006`: Add newline if fix is at end-of-file by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7090](https://togithub.com/astral-sh/ruff/pull/7090) - `B006`: Fix function docstring followed by whitespace but no newline by [@​zanieb](https://togithub.com/zanieb) in [https://github.com/astral-sh/ruff/pull/7160](https://togithub.com/astral-sh/ruff/pull/7160) - `B009`: Parenthesize expressions when converting to attribute access by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7091](https://togithub.com/astral-sh/ruff/pull/7091) - `B009`, `B010`: Fix `getattr` calls on `int` literals by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/7057](https://togithub.com/astral-sh/ruff/pull/7057) - `B013`: Supported starred exceptions in length-one tuple detection by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7080](https://togithub.com/astral-sh/ruff/pull/7080) - `B013`: Insert required space when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7148](https://togithub.com/astral-sh/ruff/pull/7148) - \[`flake8-comprehensions`] - `C402`: Add required space when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7152](https://togithub.com/astral-sh/ruff/pull/7152) - `C404` Add required space when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7185](https://togithub.com/astral-sh/ruff/pull/7185) - `C416` Add required space to fix by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7204](https://togithub.com/astral-sh/ruff/pull/7204) - `C417`: Support length-2 lists in dictionary comprehension rewrites by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7081](https://togithub.com/astral-sh/ruff/pull/7081) - `C417`: Parenthesize targets if necessary by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7189](https://togithub.com/astral-sh/ruff/pull/7189) - \[`flake8-return`] - `RET504`: Add space after return when inlining number by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7116](https://togithub.com/astral-sh/ruff/pull/7116) - \[`flake8-simplify`] - `SIM105`: Avoid attempting to fix violations with multi-statement lines by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7191](https://togithub.com/astral-sh/ruff/pull/7191) - `SIM105` Avoid inserting an extra newline for fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7221](https://togithub.com/astral-sh/ruff/pull/7221) - `SIM118`: Add required space when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7150](https://togithub.com/astral-sh/ruff/pull/7150) - `SIM118`: delete `.keys()` rather than replace expression by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7223](https://togithub.com/astral-sh/ruff/pull/7223) - `SIM210`: Retain parentheses when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7118](https://togithub.com/astral-sh/ruff/pull/7118) - `SIM222`: Add parentheses when simplifying conditions by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7117](https://togithub.com/astral-sh/ruff/pull/7117) - `SIM300`: Add required space when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7167](https://togithub.com/astral-sh/ruff/pull/7167) - \[`flake8-pytest-style`] - `PT018`: Split within `not`, rather than outside of `not` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7151](https://togithub.com/astral-sh/ruff/pull/7151) - \[`flynt`] - `FLY002`: Add required space for fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7222](https://togithub.com/astral-sh/ruff/pull/7222) - \[`numpy`] - `NPY001`: Avoid attempting to fix with overridden builtins by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7187](https://togithub.com/astral-sh/ruff/pull/7187) - `NPY003`: Use symbol import for replacement by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7083](https://togithub.com/astral-sh/ruff/pull/7083) - \[`pandas-vet`] - `PD002`: Handle parenthesized calls by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7111](https://togithub.com/astral-sh/ruff/pull/7111) - \[`pep8-naming`] - `N806`: Avoid triggering on `TypeAlias` assignments by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7119](https://togithub.com/astral-sh/ruff/pull/7119) - \[`pydocstyle`] - `D204`: Fix when there's a semicolon after a docstring by [@​konstin](https://togithub.com/konstin) in [https://github.com/astral-sh/ruff/pull/7174](https://togithub.com/astral-sh/ruff/pull/7174) - `D213`, `D400`: Ignore single quote docstrings with newline escape by [@​konstin](https://togithub.com/konstin) in [https://github.com/astral-sh/ruff/pull/7173](https://togithub.com/astral-sh/ruff/pull/7173) - `D417`: Fix error with function docstrings with dashed lines by [@​eronnen](https://togithub.com/eronnen) in [https://github.com/astral-sh/ruff/pull/7251](https://togithub.com/astral-sh/ruff/pull/7251) - \[`pyflakes`] - `F401`: Avoid panic with noqa import name by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7260](https://togithub.com/astral-sh/ruff/pull/7260) - `F841`: Expand fixes to handle parenthesized targets by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7110](https://togithub.com/astral-sh/ruff/pull/7110) - \[`pylint`] - `PLW3301`: Copy the starred argument as is for autofix by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/7177](https://togithub.com/astral-sh/ruff/pull/7177) - \[`pyupgrade`] - `UP006` and `UP007`: Add required space to fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7202](https://togithub.com/astral-sh/ruff/pull/7202) - `UP007`: Avoid attempting to fix invalid `Optional` annotations by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7079](https://togithub.com/astral-sh/ruff/pull/7079) - `UP007`: Fix syntax error in autofix by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7137](https://togithub.com/astral-sh/ruff/pull/7137) - `UP021`: Avoid adding duplicate `text` keyword to `subprocess.run` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7112](https://togithub.com/astral-sh/ruff/pull/7112) - `UP022`: Avoid adding duplicate `capture_output` keyword to `subprocess.run` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7113](https://togithub.com/astral-sh/ruff/pull/7113) - `UP028`: Support parenthesized expressions by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7114](https://togithub.com/astral-sh/ruff/pull/7114) - `UP022`: Avoid fixing when `capture_output` is provided by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7149](https://togithub.com/astral-sh/ruff/pull/7149) - `UP024`: Add required space when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7171](https://togithub.com/astral-sh/ruff/pull/7171) - \[`ruff`] - `RUF017`: Avoid duplicate fixes for multi-import imports by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7063](https://togithub.com/astral-sh/ruff/pull/7063) - Fix named expression precedence in generator by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7170](https://togithub.com/astral-sh/ruff/pull/7170) - Fix precedence of annotated assignments in generator by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7115](https://togithub.com/astral-sh/ruff/pull/7115) - Update identifier Unicode character validation to match Python spec by [@​LaBatata101](https://togithub.com/LaBatata101) in [https://github.com/astral-sh/ruff/pull/7209](https://togithub.com/astral-sh/ruff/pull/7209) ##### Other Changes - Added argfile test and documentation by [@​njgrisafi](https://togithub.com/njgrisafi) in [https://github.com/astral-sh/ruff/pull/7138](https://togithub.com/astral-sh/ruff/pull/7138) #### New Contributors - [@​oliviacrain](https://togithub.com/oliviacrain) made their first contribution in [https://github.com/astral-sh/ruff/pull/7093](https://togithub.com/astral-sh/ruff/pull/7093) - [@​dalgarno](https://togithub.com/dalgarno) made their first contribution in [https://github.com/astral-sh/ruff/pull/7108](https://togithub.com/astral-sh/ruff/pull/7108) - [@​manmartgarc](https://togithub.com/manmartgarc) made their first contribution in [https://github.com/astral-sh/ruff/pull/7179](https://togithub.com/astral-sh/ruff/pull/7179) - [@​jaap3](https://togithub.com/jaap3) made their first contribution in [https://github.com/astral-sh/ruff/pull/7194](https://togithub.com/astral-sh/ruff/pull/7194) - [@​gregersn](https://togithub.com/gregersn) made their first contribution in [https://github.com/astral-sh/ruff/pull/7203](https://togithub.com/astral-sh/ruff/pull/7203) - [@​eronnen](https://togithub.com/eronnen) made their first contribution in [https://github.com/astral-sh/ruff/pull/7251](https://togithub.com/astral-sh/ruff/pull/7251) **Full Changelog**: astral-sh/ruff@v0.0.287...v0.0.288 ### [`v0.0.287`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.287) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.286...v0.0.287) <!-- Release notes generated using configuration in .github/release.yml at v0.0.287 --> #### What's Changed ##### Rules - \[refurb] Implement preview `repeated-append` rule (`FURB113`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6702](https://togithub.com/astral-sh/ruff/pull/6702) - \[refurb] Implement preview `delete-full-slice` rule (`FURB131`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6897](https://togithub.com/astral-sh/ruff/pull/6897) - \[refurb] Implement preview `check-and-remove-from-set` rule (`FURB132`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6904](https://togithub.com/astral-sh/ruff/pull/6904) ##### Bug Fixes - Expand `PERF401` and `PERF402` with type checks by [@​qdegraaf](https://togithub.com/qdegraaf) in [https://github.com/astral-sh/ruff/pull/6994](https://togithub.com/astral-sh/ruff/pull/6994) - Insert space to avoid syntax error in RSE fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6886](https://togithub.com/astral-sh/ruff/pull/6886) - Avoid PEP 604 upgrades that lead to invalid syntax by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6888](https://togithub.com/astral-sh/ruff/pull/6888) - Fix ranges for global usages by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6917](https://togithub.com/astral-sh/ruff/pull/6917) - Avoid invalid fix for C417 with separate keys and values by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6954](https://togithub.com/astral-sh/ruff/pull/6954) - Avoid panic when `typename` is provided as a keyword argument by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6955](https://togithub.com/astral-sh/ruff/pull/6955) - Improve compatibility between multi-statement PYI rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7024](https://togithub.com/astral-sh/ruff/pull/7024) - Fixed panic in `missing_copyright_notice` by [@​WindowGenerator](https://togithub.com/WindowGenerator) in [https://github.com/astral-sh/ruff/pull/7029](https://togithub.com/astral-sh/ruff/pull/7029) - Avoid lexer infinite loop on invalid input by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/6937](https://togithub.com/astral-sh/ruff/pull/6937) - Fix `WithItem` ranges for parenthesized, non-`as` items by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6782](https://togithub.com/astral-sh/ruff/pull/6782) #### New Contributors - [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) made their first contribution in [https://github.com/astral-sh/ruff/pull/6702](https://togithub.com/astral-sh/ruff/pull/6702) - [@​Anselmoo](https://togithub.com/Anselmoo) made their first contribution in [https://github.com/astral-sh/ruff/pull/6986](https://togithub.com/astral-sh/ruff/pull/6986) - [@​njgrisafi](https://togithub.com/njgrisafi) made their first contribution in [https://github.com/astral-sh/ruff/pull/7032](https://togithub.com/astral-sh/ruff/pull/7032) - [@​WindowGenerator](https://togithub.com/WindowGenerator) made their first contribution in [https://github.com/astral-sh/ruff/pull/7029](https://togithub.com/astral-sh/ruff/pull/7029) **Full Changelog**: astral-sh/ruff@v0.0.286...v0.0.287 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/fulcrum-so/ziggy-pydust). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://beta.ruff.rs/docs) ([source](https://togithub.com/astral-sh/ruff), [changelog](https://togithub.com/astral-sh/ruff/releases)) | `^0.0.286` -> `^0.0.290` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.0.290?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/ruff/0.0.290?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/ruff/0.0.286/0.0.290?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.0.286/0.0.290?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.0.290`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.290) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.289...v0.0.290) <!-- Release notes generated using configuration in .github/release.yml at v0.0.290 --> #### What's Changed ##### Rules - Update `deprecated-import` lists based on recent `typing-extensions` release by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7356](https://togithub.com/astral-sh/ruff/pull/7356) - Add support for bounds, constraints, and explicit variance on generic type variables to `UP040` by [@​nathanwhit](https://togithub.com/nathanwhit) in [https://github.com/astral-sh/ruff/pull/6749](https://togithub.com/astral-sh/ruff/pull/6749) ##### Settings - Show rule codes in shell tab completion by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7375](https://togithub.com/astral-sh/ruff/pull/7375) ##### Bug Fixes - Parenthesize single-generator arguments when adding reverse keyword by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7365](https://togithub.com/astral-sh/ruff/pull/7365) - Invert reverse argument regardless of whether it's a boolean by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7372](https://togithub.com/astral-sh/ruff/pull/7372) - Extend `C416` to catch tuple unpacking by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7363](https://togithub.com/astral-sh/ruff/pull/7363) - Allow `NURSERY` rule selctor in JSON Schema by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7374](https://togithub.com/astral-sh/ruff/pull/7374) - Avoid flagging single-quoted docstrings with continuations for multi-line rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7392](https://togithub.com/astral-sh/ruff/pull/7392) - Treat whitespace-only line as blank for `D411` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7351](https://togithub.com/astral-sh/ruff/pull/7351) ##### Preview [*What's this section?*](https://beta.ruff.rs/docs/preview/) - \[`flake8-logging`] New rule `undocumented-warn` (`LOG009`) by [@​qdegraaf](https://togithub.com/qdegraaf) in [https://github.com/astral-sh/ruff/pull/7249](https://togithub.com/astral-sh/ruff/pull/7249) - \[`flake8-logging`] New rule `direct-logger-instantiation` (`LOG001`) by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7397](https://togithub.com/astral-sh/ruff/pull/7397) - \[`flake8-logging`] New plugin `flake8_logging` (`LOG`) by [@​qdegraaf](https://togithub.com/qdegraaf) in [https://github.com/astral-sh/ruff/pull/7249](https://togithub.com/astral-sh/ruff/pull/7249) - \[`perflint`] Add `manual-dict-comprehsion` (`PERF403`) by [@​qdegraaf](https://togithub.com/qdegraaf) in [https://github.com/astral-sh/ruff/pull/6132](https://togithub.com/astral-sh/ruff/pull/6132) - \[`pylint`] New rule `too-many-public-methods` (`PLR0904`) by [@​jelly](https://togithub.com/jelly) in [https://github.com/astral-sh/ruff/pull/6179](https://togithub.com/astral-sh/ruff/pull/6179) - \[`refurb`] New rule `no-slice-copy` (`FURB145`) by [@​tjkuson](https://togithub.com/tjkuson) in [https://github.com/astral-sh/ruff/pull/7007](https://togithub.com/astral-sh/ruff/pull/7007) - Add warnings for nursery and preview rule selection by [@​zanieb](https://togithub.com/zanieb) in [https://github.com/astral-sh/ruff/pull/7210](https://togithub.com/astral-sh/ruff/pull/7210) - Remove the `PREVIEW` rule selector by [@​zanieb](https://togithub.com/zanieb) in [https://github.com/astral-sh/ruff/pull/7389](https://togithub.com/astral-sh/ruff/pull/7389) - [`pre-commit` support](https://togithub.com/astral-sh/ruff-pre-commit#using-ruffs-formatter-unstable) for the [alpha formatter](https://togithub.com/astral-sh/ruff/discussions/7310) by [@​zanieb](https://togithub.com/zanieb) in [https://github.com/astral-sh/ruff-pre-commit/pull/50](https://togithub.com/astral-sh/ruff-pre-commit/pull/50) #### New Contributors - [@​nathanwhit](https://togithub.com/nathanwhit) made their first contribution in [https://github.com/astral-sh/ruff/pull/6749](https://togithub.com/astral-sh/ruff/pull/6749) **Full Changelog**: astral-sh/ruff@v0.0.289...v0.0.290 ### [`v0.0.289`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.289) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.288...v0.0.289) <!-- Release notes generated using configuration in .github/release.yml at v0.0.289 --> #### What's Changed ##### Bug Fixes - Invert condition for < and <= in outdated version block by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7284](https://togithub.com/astral-sh/ruff/pull/7284) - Ignore `@override` method when enforcing `bad-dunder-name` rule by [@​brendonh8](https://togithub.com/brendonh8) in [https://github.com/astral-sh/ruff/pull/7224](https://togithub.com/astral-sh/ruff/pull/7224) - Add `NotebookIndex` to the cache by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/6863](https://togithub.com/astral-sh/ruff/pull/6863) ##### Preview This release includes a new preview mode which can be used to opt-in to unstable rules and features. - Update rule selection to respect preview mode by [@​zanieb](https://togithub.com/zanieb) in [https://github.com/astral-sh/ruff/pull/7195](https://togithub.com/astral-sh/ruff/pull/7195) - Display the `--preview` option in the CLI help menu by [@​zanieb](https://togithub.com/zanieb) in [https://github.com/astral-sh/ruff/pull/7274](https://togithub.com/astral-sh/ruff/pull/7274) See the [documentation](https://beta.ruff.rs/docs/preview/) and [versioning discussion](https://togithub.com/astral-sh/ruff/discussions/6998) for more details. #### New Contributors - [@​brendonh8](https://togithub.com/brendonh8) made their first contribution in [https://github.com/astral-sh/ruff/pull/7224](https://togithub.com/astral-sh/ruff/pull/7224) **Full Changelog**: astral-sh/ruff@v0.0.288...v0.0.289 ### [`v0.0.288`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.288) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.287...v0.0.288) #### What's Changed ##### Breaking Changes - Remove emoji identifier support by [@​MichaReiser](https://togithub.com/MichaReiser) in [https://github.com/astral-sh/ruff/pull/7212](https://togithub.com/astral-sh/ruff/pull/7212) - Location agnostic GitLab fingerprints by [@​gregersn](https://togithub.com/gregersn) in [https://github.com/astral-sh/ruff/pull/7203](https://togithub.com/astral-sh/ruff/pull/7203) ##### Rules - \[`ruff`] - `RUF001`: Remove autofix for ambiguous unicode rule by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7168](https://togithub.com/astral-sh/ruff/pull/7168) ##### Settings - \[`flake8-self`] - `SLF001`: Add `extend-ignore-names` option by [@​jaap3](https://togithub.com/jaap3) in [https://github.com/astral-sh/ruff/pull/7194](https://togithub.com/astral-sh/ruff/pull/7194) ##### Bug Fixes - \[`flake8-bugbear`] - `B006`: Add newline if fix is at end-of-file by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7090](https://togithub.com/astral-sh/ruff/pull/7090) - `B006`: Fix function docstring followed by whitespace but no newline by [@​zanieb](https://togithub.com/zanieb) in [https://github.com/astral-sh/ruff/pull/7160](https://togithub.com/astral-sh/ruff/pull/7160) - `B009`: Parenthesize expressions when converting to attribute access by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7091](https://togithub.com/astral-sh/ruff/pull/7091) - `B009`, `B010`: Fix `getattr` calls on `int` literals by [@​density](https://togithub.com/density) in [https://github.com/astral-sh/ruff/pull/7057](https://togithub.com/astral-sh/ruff/pull/7057) - `B013`: Supported starred exceptions in length-one tuple detection by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7080](https://togithub.com/astral-sh/ruff/pull/7080) - `B013`: Insert required space when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7148](https://togithub.com/astral-sh/ruff/pull/7148) - \[`flake8-comprehensions`] - `C402`: Add required space when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7152](https://togithub.com/astral-sh/ruff/pull/7152) - `C404` Add required space when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7185](https://togithub.com/astral-sh/ruff/pull/7185) - `C416` Add required space to fix by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7204](https://togithub.com/astral-sh/ruff/pull/7204) - `C417`: Support length-2 lists in dictionary comprehension rewrites by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7081](https://togithub.com/astral-sh/ruff/pull/7081) - `C417`: Parenthesize targets if necessary by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7189](https://togithub.com/astral-sh/ruff/pull/7189) - \[`flake8-return`] - `RET504`: Add space after return when inlining number by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7116](https://togithub.com/astral-sh/ruff/pull/7116) - \[`flake8-simplify`] - `SIM105`: Avoid attempting to fix violations with multi-statement lines by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7191](https://togithub.com/astral-sh/ruff/pull/7191) - `SIM105` Avoid inserting an extra newline for fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7221](https://togithub.com/astral-sh/ruff/pull/7221) - `SIM118`: Add required space when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7150](https://togithub.com/astral-sh/ruff/pull/7150) - `SIM118`: delete `.keys()` rather than replace expression by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7223](https://togithub.com/astral-sh/ruff/pull/7223) - `SIM210`: Retain parentheses when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7118](https://togithub.com/astral-sh/ruff/pull/7118) - `SIM222`: Add parentheses when simplifying conditions by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7117](https://togithub.com/astral-sh/ruff/pull/7117) - `SIM300`: Add required space when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7167](https://togithub.com/astral-sh/ruff/pull/7167) - \[`flake8-pytest-style`] - `PT018`: Split within `not`, rather than outside of `not` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7151](https://togithub.com/astral-sh/ruff/pull/7151) - \[`flynt`] - `FLY002`: Add required space for fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7222](https://togithub.com/astral-sh/ruff/pull/7222) - \[`numpy`] - `NPY001`: Avoid attempting to fix with overridden builtins by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7187](https://togithub.com/astral-sh/ruff/pull/7187) - `NPY003`: Use symbol import for replacement by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7083](https://togithub.com/astral-sh/ruff/pull/7083) - \[`pandas-vet`] - `PD002`: Handle parenthesized calls by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7111](https://togithub.com/astral-sh/ruff/pull/7111) - \[`pep8-naming`] - `N806`: Avoid triggering on `TypeAlias` assignments by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7119](https://togithub.com/astral-sh/ruff/pull/7119) - \[`pydocstyle`] - `D204`: Fix when there's a semicolon after a docstring by [@​konstin](https://togithub.com/konstin) in [https://github.com/astral-sh/ruff/pull/7174](https://togithub.com/astral-sh/ruff/pull/7174) - `D213`, `D400`: Ignore single quote docstrings with newline escape by [@​konstin](https://togithub.com/konstin) in [https://github.com/astral-sh/ruff/pull/7173](https://togithub.com/astral-sh/ruff/pull/7173) - `D417`: Fix error with function docstrings with dashed lines by [@​eronnen](https://togithub.com/eronnen) in [https://github.com/astral-sh/ruff/pull/7251](https://togithub.com/astral-sh/ruff/pull/7251) - \[`pyflakes`] - `F401`: Avoid panic with noqa import name by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7260](https://togithub.com/astral-sh/ruff/pull/7260) - `F841`: Expand fixes to handle parenthesized targets by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7110](https://togithub.com/astral-sh/ruff/pull/7110) - \[`pylint`] - `PLW3301`: Copy the starred argument as is for autofix by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/7177](https://togithub.com/astral-sh/ruff/pull/7177) - \[`pyupgrade`] - `UP006` and `UP007`: Add required space to fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7202](https://togithub.com/astral-sh/ruff/pull/7202) - `UP007`: Avoid attempting to fix invalid `Optional` annotations by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7079](https://togithub.com/astral-sh/ruff/pull/7079) - `UP007`: Fix syntax error in autofix by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7137](https://togithub.com/astral-sh/ruff/pull/7137) - `UP021`: Avoid adding duplicate `text` keyword to `subprocess.run` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7112](https://togithub.com/astral-sh/ruff/pull/7112) - `UP022`: Avoid adding duplicate `capture_output` keyword to `subprocess.run` by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7113](https://togithub.com/astral-sh/ruff/pull/7113) - `UP028`: Support parenthesized expressions by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7114](https://togithub.com/astral-sh/ruff/pull/7114) - `UP022`: Avoid fixing when `capture_output` is provided by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7149](https://togithub.com/astral-sh/ruff/pull/7149) - `UP024`: Add required space when fixing by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7171](https://togithub.com/astral-sh/ruff/pull/7171) - \[`ruff`] - `RUF017`: Avoid duplicate fixes for multi-import imports by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7063](https://togithub.com/astral-sh/ruff/pull/7063) - Fix named expression precedence in generator by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7170](https://togithub.com/astral-sh/ruff/pull/7170) - Fix precedence of annotated assignments in generator by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7115](https://togithub.com/astral-sh/ruff/pull/7115) - Update identifier Unicode character validation to match Python spec by [@​LaBatata101](https://togithub.com/LaBatata101) in [https://github.com/astral-sh/ruff/pull/7209](https://togithub.com/astral-sh/ruff/pull/7209) ##### Other Changes - Added argfile test and documentation by [@​njgrisafi](https://togithub.com/njgrisafi) in [https://github.com/astral-sh/ruff/pull/7138](https://togithub.com/astral-sh/ruff/pull/7138) #### New Contributors - [@​oliviacrain](https://togithub.com/oliviacrain) made their first contribution in [https://github.com/astral-sh/ruff/pull/7093](https://togithub.com/astral-sh/ruff/pull/7093) - [@​dalgarno](https://togithub.com/dalgarno) made their first contribution in [https://github.com/astral-sh/ruff/pull/7108](https://togithub.com/astral-sh/ruff/pull/7108) - [@​manmartgarc](https://togithub.com/manmartgarc) made their first contribution in [https://github.com/astral-sh/ruff/pull/7179](https://togithub.com/astral-sh/ruff/pull/7179) - [@​jaap3](https://togithub.com/jaap3) made their first contribution in [https://github.com/astral-sh/ruff/pull/7194](https://togithub.com/astral-sh/ruff/pull/7194) - [@​gregersn](https://togithub.com/gregersn) made their first contribution in [https://github.com/astral-sh/ruff/pull/7203](https://togithub.com/astral-sh/ruff/pull/7203) - [@​eronnen](https://togithub.com/eronnen) made their first contribution in [https://github.com/astral-sh/ruff/pull/7251](https://togithub.com/astral-sh/ruff/pull/7251) **Full Changelog**: astral-sh/ruff@v0.0.287...v0.0.288 ### [`v0.0.287`](https://togithub.com/astral-sh/ruff/releases/tag/v0.0.287) [Compare Source](https://togithub.com/astral-sh/ruff/compare/v0.0.286...v0.0.287) <!-- Release notes generated using configuration in .github/release.yml at v0.0.287 --> #### What's Changed ##### Rules - \[refurb] Implement preview `repeated-append` rule (`FURB113`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6702](https://togithub.com/astral-sh/ruff/pull/6702) - \[refurb] Implement preview `delete-full-slice` rule (`FURB131`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6897](https://togithub.com/astral-sh/ruff/pull/6897) - \[refurb] Implement preview `check-and-remove-from-set` rule (`FURB132`) by [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) in [https://github.com/astral-sh/ruff/pull/6904](https://togithub.com/astral-sh/ruff/pull/6904) ##### Bug Fixes - Expand `PERF401` and `PERF402` with type checks by [@​qdegraaf](https://togithub.com/qdegraaf) in [https://github.com/astral-sh/ruff/pull/6994](https://togithub.com/astral-sh/ruff/pull/6994) - Insert space to avoid syntax error in RSE fixes by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6886](https://togithub.com/astral-sh/ruff/pull/6886) - Avoid PEP 604 upgrades that lead to invalid syntax by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6888](https://togithub.com/astral-sh/ruff/pull/6888) - Fix ranges for global usages by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6917](https://togithub.com/astral-sh/ruff/pull/6917) - Avoid invalid fix for C417 with separate keys and values by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6954](https://togithub.com/astral-sh/ruff/pull/6954) - Avoid panic when `typename` is provided as a keyword argument by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6955](https://togithub.com/astral-sh/ruff/pull/6955) - Improve compatibility between multi-statement PYI rules by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/7024](https://togithub.com/astral-sh/ruff/pull/7024) - Fixed panic in `missing_copyright_notice` by [@​WindowGenerator](https://togithub.com/WindowGenerator) in [https://github.com/astral-sh/ruff/pull/7029](https://togithub.com/astral-sh/ruff/pull/7029) - Avoid lexer infinite loop on invalid input by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/astral-sh/ruff/pull/6937](https://togithub.com/astral-sh/ruff/pull/6937) - Fix `WithItem` ranges for parenthesized, non-`as` items by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/astral-sh/ruff/pull/6782](https://togithub.com/astral-sh/ruff/pull/6782) #### New Contributors - [@​SavchenkoValeriy](https://togithub.com/SavchenkoValeriy) made their first contribution in [https://github.com/astral-sh/ruff/pull/6702](https://togithub.com/astral-sh/ruff/pull/6702) - [@​Anselmoo](https://togithub.com/Anselmoo) made their first contribution in [https://github.com/astral-sh/ruff/pull/6986](https://togithub.com/astral-sh/ruff/pull/6986) - [@​njgrisafi](https://togithub.com/njgrisafi) made their first contribution in [https://github.com/astral-sh/ruff/pull/7032](https://togithub.com/astral-sh/ruff/pull/7032) - [@​WindowGenerator](https://togithub.com/WindowGenerator) made their first contribution in [https://github.com/astral-sh/ruff/pull/7029](https://togithub.com/astral-sh/ruff/pull/7029) **Full Changelog**: astral-sh/ruff@v0.0.286...v0.0.287 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/fulcrum-so/ziggy-pydust-template). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Summary
This PR attempts to address a problem in the parser related to the range's of
WithItem
nodes in certain contexts -- specifically,WithItem
nodes in parentheses that do not have anas
token after them.For example, here:
The range of the
WithItem
a
is set to the range of(a, b)
, as is the range of theWithItem
b
. In other words, when we have this kind of sequence, we use the range of the entire parenthesized context, rather than the ranges of the items themselves.Note that this also applies to cases like:
You can see the issue in the parser here:
Fixing this issue is... very tricky. The naive approach is to use the range of the
context_expr
as the range for theWithItem
, but that range will be incorrect when thecontext_expr
is itself parenthesized. For example, that solution would fail here, since the range of the firstWithItem
would be that ofa
, rather than(a)
:The
with
parsing in general is highly precarious due to ambiguities in the grammar. Changing it in any way seems to lead to an ambiguous grammar that LALRPOP fails to translate. Consensus seems to be that we don't really understand why the current grammar works (i.e., how it avoids these ambiguities as-is).The solution implemented here is to avoid changing the grammar itself, and instead change the shape of the nodes returned by various rules in the grammar. Specifically, everywhere that we return
Expr
, we instead returnParenthesizedExpr
, which includes a parenthesized range and the underlyingExpr
itself. (If anExpr
isn't parenthesized, the ranges will be equivalent.) InWithItemsNoAs
, we can then use the parenthesized range as the range for theWithItem
.