-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
STYLE: Fix Pylint Style Checks For used-before-assignment #48940
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
Conversation
@@ -883,10 +883,9 @@ def test_to_excel_unicode_filename(self, ext): | |||
with tm.ensure_clean("\u0192u." + ext) as filename: | |||
try: | |||
f = open(filename, "wb") | |||
f.close() |
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.
Maybe just:
with open(filename, "wb") as f:
pass
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.
Smart. Thanks.
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.
Nice
Looks like there's some false positives, which have been flagged to pylint
- shall we wait to see if they respond and fix this? pylint-dev/pylint#7574
I don't know what's causing the CI testing to fail now. Do I need to change anything to fix that? |
it's unrelated, don't worry about it, let's just wait a bit to see if it looks like pylint might make a release which fixes it |
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
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 @Leviob - it doesn't look like this'll be fixed in pylint anytime soon, so let's just turn the check off in those 2-3 places
I've left a couple of comments - could you fetch and merge upstream/main 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.
Thanks @Leviob !
…#48940) * STYLE: Fix Pylint Style Checks For used-before-assignment * Refactor: Use 'with open' instead of open/close * CLN: disable used-before-assignment warning * CLN: Remove used-before-assignment from pyproject.toml * CLN: disable used-before-assignment warning in-line
…#48940) * STYLE: Fix Pylint Style Checks For used-before-assignment * Refactor: Use 'with open' instead of open/close * CLN: disable used-before-assignment warning * CLN: Remove used-before-assignment from pyproject.toml * CLN: disable used-before-assignment warning in-line
dispcmd
,fd
,new_f
outside of their respective try blocks to ensure they are defined_is_scipy_sparse
,groupby
, andSeries
no_mpl_message
f.close()
to try block to ensuref
is defined if it is called