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

Apply pyupgrade to update code style #662

Merged
merged 2 commits into from
Apr 6, 2023

Conversation

rossbar
Copy link
Contributor

@rossbar rossbar commented Apr 6, 2023

What

This PR applies pyupgrade (via ruff) to automatically modernize some coding patterns. The way this works: you tell pyupgrade what minimum version of Python you support (3.7 in our case), then it automatically applies linting patterns based on language features in the minimum supported version.

The changes here generally fall in the following categories:

  • Stop inheriting from object
  • Remove from __future__ imports
  • Remove super() args in cases of single inheritance
  • Automatically convert older-style string formatting to fstrings.

Why

The main improvement is removing cruft related to old Python versions - perhaps the most notable is the removal of the from __future__ imports and related dels in the __init__.py files. The automatic switch to f-strings is also (IMO) a nice improvement.

Automatically apply pyupgrade updates. Major changes include:
 * Stop inheriting from object
 * Remove from __future__ imports
 * Remove super() args in cases of single inheritance
 * Automatically convert older-style string formatting to fstrings.
@rossbar rossbar added the chore Maintenance label Apr 6, 2023
Copy link
Member

@msschwartz21 msschwartz21 left a comment

Choose a reason for hiding this comment

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

Nice upgrade!

@rossbar rossbar merged commit 427b2a4 into vanvalenlab:master Apr 6, 2023
@rossbar rossbar deleted the pyupgrade-3.7 branch April 6, 2023 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants