Repository navigation
[flake8-pyi] Fix PYI034 autofix for parenthesized self annotations - #30173
Merged
MichaReiser merged 2 commits intoNov 9, 2026
Merged
Conversation
mati-caliz
marked this pull request as ready for review
November 7, 2026 17:12
MichaReiser
requested changes
Nov 9, 2026
Comment on lines
+280
to
+283
| let annotation_end = | ||
| parenthesized_range(annotation.into(), first.as_parameter().into(), tokens) | ||
| .unwrap_or(annotation.range()) | ||
| .end(); |
Member
There was a problem hiding this comment.
I believe we can use first.as_parameter().end() instead of parenthesized_range(...).end() here instead
Contributor
Author
There was a problem hiding this comment.
Good call, the parameter's range already ends after the closing parentheses, so the tokens aren't needed. Done in 5b121cc.
mati-caliz
force-pushed
the
pyi034-parenthesized-self-annotation
branch
from
November 9, 2026 12:44
6681711 to
5b121cc
Compare
MichaReiser
enabled auto-merge (squash)
November 9, 2026 12:50
MichaReiser
approved these changes
Nov 9, 2026
rlichtenwalter
added a commit
to rlichtenwalter/dir2text
that referenced
this pull request
Nov 13, 2026
This PR contains the following updates: | Package | Type | Update | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [DavidAnson/markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) | repository | patch | `v0.24.0` → `v0.24.1` |  |  | | [rbubley/mirrors-prettier](https://github.com/rbubley/mirrors-prettier) | repository | minor | `v3.9.10` → `v3.10.1` |  |  | | [ruff](https://docs.astral.sh/ruff) ([source](https://github.com/astral-sh/ruff), [changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)) | dependency-groups | patch | `==0.17.3` → `==0.17.5` |  |  | Note: The `pre-commit` manager in Renovate is not supported by the `pre-commit` maintainers or community. Please do not report any problems there, instead [create a Discussion in the Renovate repository](https://github.com/renovatebot/renovate/discussions/new) if you have any questions. --- ### Release Notes <details> <summary>DavidAnson/markdownlint-cli2</summary> ### [`v0.24.1`](DavidAnson/markdownlint-cli2@v0.24.0...v0.24.1) [Compare Source](DavidAnson/markdownlint-cli2@v0.24.0...v0.24.1) </details> <details> <summary>rbubley/mirrors-prettier</summary> ### [`v3.10.1`](rbubley/mirrors-prettier@v3.10.0...v3.10.1) [Compare Source](rbubley/mirrors-prettier@v3.10.0...v3.10.1) ### [`v3.10.0`](rbubley/mirrors-prettier@v3.9.10...v3.10.0) [Compare Source](rbubley/mirrors-prettier@v3.9.10...v3.10.0) </details> <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.17.5`](https://github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#0175) [Compare Source](astral-sh/ruff@0.17.4...0.17.5) Released on 2026-11-12. ##### Preview features - Redirect renamed rules ([#​30081](astral-sh/ruff#30081)) - \[`flake8-async`] Implement `pytest-raises-exception-group` (`ASYNC401`) ([#​28772](astral-sh/ruff#28772)) - \[`flake8-logging-format`] Mark `G004` fix as unsafe ([#​30087](astral-sh/ruff#30087)) - \[`pylint`] Implement `no-method-argument` (`PLE0211`) ([#​29748](astral-sh/ruff#29748)) - \[`refurb`] Do not offer fix when `write` is nested in an expression (`FURB103`) ([#​29789](astral-sh/ruff#29789)) - \[`ruff`] Add `renamed-rule` (`RUF202`) ([#​30079](astral-sh/ruff#30079)) - \[`ruff`] Expand `redirected-noqa` to other suppression comments (`RUF101`) ([#​30078](astral-sh/ruff#30078)) ##### Bug fixes - Avoid crashing when Ruff logs to a closed stderr pipe ([#​30209](astral-sh/ruff#30209)) - Fix fixes that add or remove a keyword argument with a parenthesized value ([#​30189](astral-sh/ruff#30189)) - \[`flake8-import-conventions`] Avoid shadowing names when fixing import aliases (`ICN001`) ([#​30035](astral-sh/ruff#30035)) - \[`flake8-bugbear`] Fix `B010` autofix for parenthesized `setattr` calls ([#​30168](astral-sh/ruff#30168)) - \[`flake8-pyi`] Fix `PYI034` autofix for parenthesized `self` annotations ([#​30173](astral-sh/ruff#30173)) - \[`pyupgrade`] Fix `UP031` duplicating closing parentheses around the format string ([#​30172](astral-sh/ruff#30172)) ##### Rule changes - \[`flake8-bugbear`] Ignore frozen dataclass instantiations (`B008`) ([#​29231](astral-sh/ruff#29231)) ##### Performance - Various performance improvements ([#​30375](astral-sh/ruff#30375), [#​30211](astral-sh/ruff#30211), [#​30368](astral-sh/ruff#30368), [#​30259](astral-sh/ruff#30259), [#​30354](astral-sh/ruff#30354), [#​30115](astral-sh/ruff#30115), [#​30133](astral-sh/ruff#30133), [#​30132](astral-sh/ruff#30132), [#​30358](astral-sh/ruff#30358), [#​30135](astral-sh/ruff#30135), [#​30369](astral-sh/ruff#30369), [#​30351](astral-sh/ruff#30351), [#​30352](astral-sh/ruff#30352), [#​30347](astral-sh/ruff#30347), [#​30379](astral-sh/ruff#30379), [#​30328](astral-sh/ruff#30328), [#​30329](astral-sh/ruff#30329), [#​29446](astral-sh/ruff#29446)) ##### Other changes - Fix FreeBSD source builds with libc 0.2.190 ([#​30176](astral-sh/ruff#30176)) ##### Contributors - [@​rajveer3x](https://github.com/rajveer3x) - [@​tjkuson](https://github.com/tjkuson) - [@​hugehoo](https://github.com/hugehoo) - [@​hector2394](https://github.com/hector2394) - [@​ansh-rohilla](https://github.com/ansh-rohilla) - [@​mati-caliz](https://github.com/mati-caliz) - [@​yxshee](https://github.com/yxshee) - [@​charliermarsh](https://github.com/charliermarsh) - [@​MichaReiser](https://github.com/MichaReiser) - [@​GeorgiaPreda](https://github.com/GeorgiaPreda) - [@​G26karthik](https://github.com/G26karthik) - [@​ntBre](https://github.com/ntBre) - [@​s-cork](https://github.com/s-cork) ### [`v0.17.4`](https://github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#0174) [Compare Source](astral-sh/ruff@0.17.3...0.17.4) Released on 2026-11-05. ##### Preview features - \[`flake8-logging-format`] Avoid behavior changes and syntax errors in fixes (`G004`) ([#​27419](astral-sh/ruff#27419)) - \[`security`] Implement `tarfile-ignore-zeros-true` ([#​28680](astral-sh/ruff#28680)) ##### Bug fixes - Accept a bare raise before a semicolon ([#​29761](astral-sh/ruff#29761)) - Allow match identifiers after a semicolon ([#​29760](astral-sh/ruff#29760)) - Fix panic on BOM-prefixed files in diagnostic renderer ([#​30017](astral-sh/ruff#30017)) - \[`flake8-simplify`] Report collapsible `elif` clauses after a multi-statement `if` branch (`SIM102`) ([#​29814](astral-sh/ruff#29814)) ##### Rule changes - Show more nonprinting characters in diagnostic fix diffs ([#​30062](astral-sh/ruff#30062)) ##### Performance - Coalesce source slices when formatting attributes ([#​29841](astral-sh/ruff#29841)) - Collect return statements with a statement-only visitor ([#​29911](astral-sh/ruff#29911)) (PR body shortened for the merge commit; full text on the PR.) Reviewed-on: https://git.lichtenwalter.site/rlichten/dir2text/pulls/109
Stensel8
pushed a commit
to Stensel8/streamrip
that referenced
this pull request
Nov 14, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) ([changelog](https://pytest-asyncio.readthedocs.io/en/stable/reference/changelog.html)) | `==1.4.1.post1` → `==1.5.0` |  |  | | [ruff](https://docs.astral.sh/ruff) ([source](https://github.com/astral-sh/ruff), [changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)) | `==0.17.4` → `==0.17.5` |  |  | --- ### Release Notes <details> <summary>pytest-dev/pytest-asyncio (pytest-asyncio)</summary> ### [`v1.5.0`](https://github.com/pytest-dev/pytest-asyncio/releases/tag/v1.5.0): pytest-asyncio v1.5.0 [Compare Source](pytest-dev/pytest-asyncio@v1.4.1.post1...v1.5.0) ### [1.5.0](https://github.com/pytest-dev/pytest-asyncio/tree/1.5.0) - 2026-11-12 #### Added - A `fixture-scope` value for `asyncio_default_fixture_loop_scope`. With it, an asynchronous fixture without `loop_scope` uses its `scope` as its loop scope. This is the behavior of an unset option in pytest-asyncio 1.x. ([#​1095](pytest-dev/pytest-asyncio#1095)) #### Fixed - Invalid arguments to the `asyncio` marker, including an invalid `loop_scope`, are reported with a message that names the test instead of a traceback. ([#​1584](pytest-dev/pytest-asyncio#1584)) </details> <details> <summary>astral-sh/ruff (ruff)</summary> ### [`v0.17.5`](https://github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#0175) [Compare Source](astral-sh/ruff@0.17.4...0.17.5) Released on 2026-11-12. ##### Preview features - Redirect renamed rules ([#​30081](astral-sh/ruff#30081)) - \[`flake8-async`] Implement `pytest-raises-exception-group` (`ASYNC401`) ([#​28772](astral-sh/ruff#28772)) - \[`flake8-logging-format`] Mark `G004` fix as unsafe ([#​30087](astral-sh/ruff#30087)) - \[`pylint`] Implement `no-method-argument` (`PLE0211`) ([#​29748](astral-sh/ruff#29748)) - \[`refurb`] Do not offer fix when `write` is nested in an expression (`FURB103`) ([#​29789](astral-sh/ruff#29789)) - \[`ruff`] Add `renamed-rule` (`RUF202`) ([#​30079](astral-sh/ruff#30079)) - \[`ruff`] Expand `redirected-noqa` to other suppression comments (`RUF101`) ([#​30078](astral-sh/ruff#30078)) ##### Bug fixes - Avoid crashing when Ruff logs to a closed stderr pipe ([#​30209](astral-sh/ruff#30209)) - Fix fixes that add or remove a keyword argument with a parenthesized value ([#​30189](astral-sh/ruff#30189)) - \[`flake8-import-conventions`] Avoid shadowing names when fixing import aliases (`ICN001`) ([#​30035](astral-sh/ruff#30035)) - \[`flake8-bugbear`] Fix `B010` autofix for parenthesized `setattr` calls ([#​30168](astral-sh/ruff#30168)) - \[`flake8-pyi`] Fix `PYI034` autofix for parenthesized `self` annotations ([#​30173](astral-sh/ruff#30173)) - \[`pyupgrade`] Fix `UP031` duplicating closing parentheses around the format string ([#​30172](astral-sh/ruff#30172)) ##### Rule changes - \[`flake8-bugbear`] Ignore frozen dataclass instantiations (`B008`) ([#​29231](astral-sh/ruff#29231)) ##### Performance - Various performance improvements ([#​30375](astral-sh/ruff#30375), [#​30211](astral-sh/ruff#30211), [#​30368](astral-sh/ruff#30368), [#​30259](astral-sh/ruff#30259), [#​30354](astral-sh/ruff#30354), [#​30115](astral-sh/ruff#30115), [#​30133](astral-sh/ruff#30133), [#​30132](astral-sh/ruff#30132), [#​30358](astral-sh/ruff#30358), [#​30135](astral-sh/ruff#30135), [#​30369](astral-sh/ruff#30369), [#​30351](astral-sh/ruff#30351), [#​30352](astral-sh/ruff#30352), [#​30347](astral-sh/ruff#30347), [#​30379](astral-sh/ruff#30379), [#​30328](astral-sh/ruff#30328), [#​30329](astral-sh/ruff#30329), [#​29446](astral-sh/ruff#29446)) ##### Other changes - Fix FreeBSD source builds with libc 0.2.190 ([#​30176](astral-sh/ruff#30176)) ##### Contributors - [@​rajveer3x](https://github.com/rajveer3x) - [@​tjkuson](https://github.com/tjkuson) - [@​hugehoo](https://github.com/hugehoo) - [@​hector2394](https://github.com/hector2394) - [@​ansh-rohilla](https://github.com/ansh-rohilla) - [@​mati-caliz](https://github.com/mati-caliz) - [@​yxshee](https://github.com/yxshee) - [@​charliermarsh](https://github.com/charliermarsh) - [@​MichaReiser](https://github.com/MichaReiser) - [@​GeorgiaPreda](https://github.com/GeorgiaPreda) - [@​G26karthik](https://github.com/G26karthik) - [@​ntBre](https://github.com/ntBre) - [@​s-cork](https://github.com/s-cork) </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/Amsterdam) - 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. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4zOS4yIiwidXBkYXRlZEluVmVyIjoiNDQuMzkuMiIsInRhcmdldEJyYW5jaCI6ImRldiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJweXRob24iXX0=--> Reviewed-on: https://opencommit.eu/Stensel8/streamrip/pulls/114
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The fix deleted the
selfannotation from the end of the parameter name to the end of the annotation expression, whose range doesn't include surrounding parentheses, soself: (C)becameself). It now deletes up to the end of the parameter instead, whose range does include them, however many there are. Without parentheses the range is the same as before.Fixes #30171
Test Plan
I added a class with
__enter__(one level of parentheses) and__iadd__(two levels) to the fixture.