Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pyupgrade] Handle multiple base classes for PEP 695 generics (UP046) #15659

Merged
merged 19 commits into from
Jan 23, 2025

Conversation

ntBre
Copy link
Contributor

@ntBre ntBre commented Jan 21, 2025

Summary

Addresses the second follow up to #15565 in #15642. This was easier than expected by using this cool destructuring syntax I hadn't used before, and by assuming PYI059 (generic-not-last-base-class).

Test Plan

Using an existing test, plus two new tests combining multiple base classes and multiple generics. It looks like I deleted a relevant test, which I did, but I meant to rename this in #15565. It looks like instead I copied it and renamed the copy.

@ntBre ntBre added the rule Implementing or modifying a lint rule label Jan 21, 2025
Copy link
Contributor

github-actions bot commented Jan 21, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre force-pushed the brent/pep695-multi-base branch from 9ff1143 to fcca976 Compare January 22, 2025 15:06
Base automatically changed from brent/pep695-generics to main January 22, 2025 16:35
@ntBre ntBre force-pushed the brent/pep695-multi-base branch from fcca976 to 14c1835 Compare January 22, 2025 17:47
@AlexWaygood AlexWaygood added the preview Related to preview mode features label Jan 22, 2025
@ntBre ntBre force-pushed the brent/pep695-multi-base branch from 14c1835 to e458749 Compare January 22, 2025 18:04
@ntBre ntBre marked this pull request as ready for review January 22, 2025 18:38
@ntBre ntBre requested a review from AlexWaygood January 22, 2025 18:42
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 it!

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@ntBre ntBre merged commit ce81103 into main Jan 23, 2025
21 checks passed
@ntBre ntBre deleted the brent/pep695-multi-base branch January 23, 2025 01:19
dcreager added a commit that referenced this pull request Jan 24, 2025
* main:
  [red-knot] MDTests: Do not depend on precise public-symbol type inference (#15691)
  [red-knot] Make `infer.rs` unit tests independent of public symbol inference (#15690)
  Tidy knot CLI tests (#15685)
  [red-knot] Port comprehension tests to Markdown (#15688)
  Create Unknown rule diagnostics with a source range (#15648)
  [red-knot] Port 'deferred annotations' unit tests to Markdown (#15686)
  [red-knot] Support custom typeshed Markdown tests (#15683)
  Don't run the linter ecosystem check on PRs that only touch red-knot crates (#15687)
  Add `rules` table to configuration (#15645)
  [red-knot] Make `Diagnostic::file` optional (#15640)
  [red-knot] Add test for nested attribute access (#15684)
  [red-knot] Anchor relative paths in configurations (#15634)
  [`pyupgrade`] Handle multiple base classes for PEP 695 generics (`UP046`) (#15659)
  [`pyflakes`] Treat arguments passed to the `default=` parameter of `TypeVar` as type expressions (`F821`) (#15679)
  Upgrade zizmor to the latest version in CI (#15649)
  [`pyupgrade`] Add rules to use PEP 695 generics in classes and functions (`UP046`, `UP047`) (#15565)
  [red-knot] Ensure a gradual type can always be assigned to itself (#15675)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants