Skip to content

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

Merged

Conversation

Thextan
Copy link
Contributor

@Thextan Thextan commented Dec 7, 2022

@MarcoGorelli
Copy link
Member

you can push to the same branch, no need to open a new pull request

@Thextan
Copy link
Contributor Author

Thextan commented Dec 7, 2022

@MarcoGorelli I closed the previous pull request and merged the two sets of changes into this PR.

@MarcoGorelli
Copy link
Member

OK - in the future a single PR is fine, you can just add extra commits to it

@mroeschke mroeschke added the Code Style Code style, linting, code_checks label Dec 8, 2022
@MarcoGorelli
Copy link
Member

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

@Thextan
Copy link
Contributor Author

Thextan commented Dec 30, 2022

@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).

@Thextan Thextan marked this pull request as ready for review January 3, 2023 01:07
Copy link
Member

@MarcoGorelli MarcoGorelli left a 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?

@Thextan Thextan force-pushed the standard-library-imports-style-check branch from 2bb0ed5 to 1e9c618 Compare January 4, 2023 00:03
@Thextan
Copy link
Contributor Author

Thextan commented Jan 4, 2023

Requested changes have been made and pushed.

Copy link
Member

@MarcoGorelli MarcoGorelli left a 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
Copy link
Member

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

Copy link
Contributor Author

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,
Copy link
Member

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?

Copy link
Contributor Author

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.

Comment on lines 1 to 2
import datetime as dt
from datetime import datetime
Copy link
Member

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

Copy link
Contributor Author

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.

Comment on lines 1 to 3
""" test orc compat """
"""
test orc compat
"""
Copy link
Member

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?

Copy link
Contributor Author

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.

@Thextan Thextan requested a review from MarcoGorelli January 5, 2023 02:25
@MarcoGorelli
Copy link
Member

should be good, thanks, just pending green

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

thanks @Thextan

@MarcoGorelli MarcoGorelli merged commit 37ff082 into pandas-dev:main Jan 6, 2023
@MarcoGorelli MarcoGorelli added this to the 2.0 milestone Jan 6, 2023
@Thextan Thextan deleted the standard-library-imports-style-check branch January 6, 2023 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

STYLE place standard library imports at top of file
3 participants