-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Standard library imports style check #50116
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
Standard library imports style check #50116
Conversation
you can push to the same branch, no need to open a new pull request |
@MarcoGorelli I closed the previous pull request and merged the two sets of changes into this PR. |
OK - in the future a single PR is fine, you can just add extra commits to it |
there's a few pylint failures: https://github.com/pandas-dev/pandas/actions/runs/3791678410/jobs/6447285304 I'm thinking it might not be worth introducing this lint check, sorry - if you want to clean up the import changes in the tests (such that pylint still passes), then we could take that |
@MarcoGorelli please look at this PR. I have two code tests failing that I can't seem to fix without making it worse. Code Checks/Docstring: I am not sure how to get around the duplication between xml.etree... (line 13) and lxml.etree... (lines 517/590). |
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.
I don't think the check is worth adding anymore, sorry (I hadn't realised at the start how expensive some of them were, nor that it would conflict with the more important pylint check) - but the cleanups in the test folder are nice
How about
git fetch upstream
git merge upstream/main
git reset upstream/main
git add pandas/tests
git checkout -- .
git commit -a -m 'put stdlib imports in pandas/tests at top of file'
git push origin HEAD -f
and then we can get that in?
2bb0ed5
to
1e9c618
Compare
Requested changes have been made and pushed. |
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.
getting there 💪
) | ||
from collections import namedtuple # GH11181 |
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.
this comment should stay with the test
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.
Moved comment back to test.
""" | ||
from datetime import ( | ||
datetime, | ||
timedelta as dttd, |
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.
does it work to just import timedelta
, without an alias?
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.
Used timedelta without the alias.
import datetime as dt | ||
from datetime import datetime |
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.
there shouldn't be any need for both, just use dt.datetime
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.
Removed second import and used dt.datetime. I renamed variable dt to mydt.
pandas/tests/io/test_orc.py
Outdated
""" test orc compat """ | ||
""" | ||
test orc compat | ||
""" |
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.
could you revert unrelated changes (such as this one) please?
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.
git reset on this file.
Removed ^pandas/core/generic\.py from .pre-commit-config.yaml
…ports-style-check
…lated docstring change.
…xtan/pandas into standard-library-imports-style-check
should be good, thanks, just pending green |
…ports-style-check
…xtan/pandas into standard-library-imports-style-check
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.
thanks @Thextan
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.