Skip to content

[pyupgrade] Implement unnecessary-default-type-args (UP043)#12371

Merged
charliermarsh merged 5 commits intoastral-sh:mainfrom
cake-monotone:implement-up043-unnecessary-default-type-args
Jul 17, 2024
Merged

[pyupgrade] Implement unnecessary-default-type-args (UP043)#12371
charliermarsh merged 5 commits intoastral-sh:mainfrom
cake-monotone:implement-up043-unnecessary-default-type-args

Conversation

@cake-monotone
Copy link
Copy Markdown
Contributor

Summary

Add new rule and implement for unnecessary default type arguments under the UP category (UP043).

// < py313
Generator[int, None, None] 

// >= py313
Generator[int]

I think that as Python 3.13 develops, there might be more default type arguments added besides Generator and AsyncGenerator. So, I made this more flexible to accommodate future changes.

related issue: #12286

Test Plan

snapshot included..!

@cake-monotone cake-monotone changed the title [pyupgrade] Implement unnecessary default type args (UP043) [pyupgrade] Implement unnecessary-default-type-args (UP043) Jul 17, 2024
@charliermarsh
Copy link
Copy Markdown
Member

Nice, thank you! Will review.

@charliermarsh charliermarsh added rule Implementing or modifying a lint rule preview Related to preview mode features labels Jul 17, 2024
Copy link
Copy Markdown
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

This is great, thank you. I just made some minor tweaks to formatting and docs.

@charliermarsh charliermarsh enabled auto-merge (squash) July 17, 2024 19:39
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