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

Use PyUpgrade to upgrade to Python 3.8 syntax #6

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

moi15moi
Copy link
Owner

Run: pre-commit run pyupgrade --all-files

With this .pre-commit-config.yaml file:

repos:
-   repo: https://github.com/asottile/pyupgrade
    rev: v3.19.1
    hooks:
    -   id: pyupgrade
        args: [--py38-plus]

Run: pre-commit run pyupgrade --all-files

With this .pre-commit-config.yaml file:
```
repos:
-   repo: https://github.com/asottile/pyupgrade
    rev: v3.19.1
    hooks:
    -   id: pyupgrade
        args: [--py38-plus]
```
@moi15moi
Copy link
Owner Author

@junkmd Do you think this could be merged easily?

junkmd added a commit to junkmd/pywinauto that referenced this pull request Jan 28, 2025
@junkmd
Copy link

junkmd commented Jan 29, 2025

@moi15moi

I appreciate the work done in this PR.
However, to make the review process smoother, I’d like to suggest splitting it into more focused changes.

I believe it would be ideal to group files by topic—meaning each PR should focus on a specific review point that spans multiple files.

The major updates in this PR can be grouped into three categories:

  1. Removing (object) from class definitions (e.g.: class Foo(object): -> class Foo:)
  2. Updating super() calls to use the modern style (e.g.: super(Foo, self).mth_or_attr -> super().mth_or_attr)
  3. Standardizing OSError aliases (e.g. except WindowsError: / except IOError: -> except OSError:)

There are also updates related to string formatting, but I think it would be more beneficial to advance the f-string migration discussed in enthought#657 (You can feel free to address that issue).

Other minor fixes are also included, but for now, I think it’s fine to keep them together in one PR.

Let’s first focus on these three PRs plus the f-string issue, and then we can consider how to handle the remaining fixes.

Would you be open to restructuring the PR this way?

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