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

chore: upgrade python syntax #12702

Merged
merged 3 commits into from
Dec 20, 2022
Merged

Conversation

miketheman
Copy link
Member

Not super glamorous, but updated the codebase to take advantage of Python 3.11 syntax.

Things like:

  • explicit object subclass
  • f-string syntax
  • yield from
  • set() => {}

Signed-off-by: Mike Fiedler miketheman@gmail.com

Not super glamorous, but updated the codebase to take advantage of
Python 3.11 syntax.

Things like:

- explicit `object` subclass
- f-string syntax
- `yield from`
- `set()` => `{}`

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
@miketheman miketheman requested a review from a team as a code owner December 19, 2022 23:18
Signed-off-by: Mike Fiedler <miketheman@gmail.com>
Run `pyupgrade` first so that any other lint checks have to pass on the
reformatted code.

Found a couple of stragglers in the root directory as well.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
Comment on lines -951 to +952
"The user '{0}' isn't allowed to upload to project '{1}'. "
"See {2} for more information."
"The user '{}' isn't allowed to upload to project '{}'. "
"See {} for more information."
Copy link
Member

Choose a reason for hiding this comment

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

Should this become an f-string? I'm surprised it didn't catch this use of .format.

Copy link
Member Author

Choose a reason for hiding this comment

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

I suspect it has something to do with the complex usage of request.help_url(_anchor="project-name"), and quotations - there's a test that shows this should be a noop:
https://github.com/asottile/pyupgrade/blob/ff43f9a6ab4c37d0a89a4bb5ae338c2d0233b5eb/tests/features/fstrings_test.py#L34-L37

Comment on lines +964 to +965
"The given token isn't allowed to upload to project '{}'. "
"See {} for more information."
Copy link
Member

Choose a reason for hiding this comment

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

Ditto here.

@di di merged commit 5320917 into pypi:main Dec 20, 2022
@miketheman miketheman deleted the miketheman/upgrade-python-syntax branch December 20, 2022 16:05
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.

2 participants