-
Notifications
You must be signed in to change notification settings - Fork 915
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
Run pyupgrade 2.31.0. #10141
Run pyupgrade 2.31.0. #10141
Conversation
This reverts commit 54b16b9.
Codecov Report
@@ Coverage Diff @@
## branch-22.04 #10141 +/- ##
================================================
+ Coverage 10.42% 10.47% +0.04%
================================================
Files 119 122 +3
Lines 20603 20500 -103
================================================
- Hits 2148 2147 -1
+ Misses 18455 18353 -102
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good to me. I made some comments, but in hindsight I think a significant chunk of them were in the versioneer files which I think we should just revert as you point out in your comment. No need to change vendored files. You should change the pre-commit hook to exclude those files when you do add it. I'm approving now because I suspect that once you remove the versioneer changes I only have 2-3 other comments and they're pretty trivial.
Regarding annotations, I like some of the changes but not all. Removing quoted types where possible is nice, but I don't really like using the pipe operator for or
everywhere. I'm not sure what best practices are as far as using built-in types for annotations vs using their aliases from the typing
module, I'd say let's see what some other projects do? But I definitely don't think we need to make these changes here
Reverted changes to versioneer. Yup, I'll exclude those files if we get to the point of adding a pre-commit hook for pyupgrade.
I agree, with your general sentiment -- pyupgrade's typing changes are the part I'm least sure about. (As an aside, I do agree with pyupgrade that replacing
The best practice is probably to use the built-in
|
This PR refactors some DataFrame tests, including [suggestions](#10141 (comment)) from @vyasr in #10141 that are not related to that PR's focus. Authors: - Bradley Dice (https://github.com/bdice) Approvers: - GALI PREM SAGAR (https://github.com/galipremsagar) URL: #10204
…data` (#10206) As pointed out in [this issue comment](#10141 (comment)), we should be good to update some of dask-cudf's parquet testing to reflect bug fixes merged in dask/dask#6047. cc @rjzamora in case you see some other tests that could be resolved here Authors: - Charles Blackmon-Luca (https://github.com/charlesbluca) Approvers: - Richard (Rick) Zamora (https://github.com/rjzamora) URL: #10206
@gpucibot merge |
This PR runs pyupgrade to modernize some syntax in the Python code base. (I am preparing a "better code" talk for our team that will reference this PR.)
The kinds of modernizing changes that pyupgrade makes are similar in purpose to those made by clang-tidy (#9860), but for Python. These include things like:
{}
and lists[]
, because they are a bit faster and more readable thandict()
orlist()
IOError
became an alias forOSError
in Python 3.3.class A(object):
with the simpler syntaxclass A:
__future__
imports that were needed for Python 2 compatibility, likeprint_function
anddivision
The pyupgrade README has a long showcase of other rules.
Notes for reviewers:
--py37-plus
to only perform changes that are compatible with Python 3.7+.versioneer.py
if desired. (It's pretty outdated anyway, it looks like we're using versioneer 0.18, released on January 1, 2017.)