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

Defaultdict lambdas #901

Merged
merged 1 commit into from Oct 7, 2023
Merged

Conversation

UnknownPlatypus
Copy link
Contributor

Fixes #899

I left a few comments with some questions.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
pyupgrade/_plugins/defauldict_lambda.py Outdated Show resolved Hide resolved
pyupgrade/_plugins/defauldict_lambda.py Outdated Show resolved Hide resolved
pyupgrade/_plugins/defauldict_lambda.py Outdated Show resolved Hide resolved
tests/features/defauldict_lambda_test.py Outdated Show resolved Hide resolved
Copy link
Owner

@asottile asottile left a comment

Choose a reason for hiding this comment

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

I'm just going to fix these but a heads up to you

README.md Outdated
Comment on lines 84 to 85
-defaultdict(lambda: None)
+defaultdict()
Copy link
Owner

Choose a reason for hiding this comment

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

this one actually isn't equivalent

Comment on lines 24 to 25
else:
return 'float'
Copy link
Owner

Choose a reason for hiding this comment

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

there's also 0j which is complex

@asottile asottile merged commit d1518e8 into asottile:main Oct 7, 2023
7 checks passed
@UnknownPlatypus UnknownPlatypus deleted the defaultdict-lambdas branch October 8, 2023 11:29
@adamchainz
Copy link
Sponsor Contributor

Nice feature, it just fixed seven cases on a client code base. Thanks both!

@UnknownPlatypus
Copy link
Contributor Author

Thanks Adam and thanks Anthony for the thorough review and tweaks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade defaultdict default_factory (simple lambdas)
3 participants