-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
STYLE enable pylint: confusing-with-statement #49789
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
STYLE enable pylint: confusing-with-statement #49789
Conversation
pandas/tests/io/test_pickle.py
Outdated
with open(src_path, "rb") as fh, f: | ||
with open(src_path, "rb") as fh: | ||
f.write(fh.read()) |
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 nest the with statements? like
with open(src_path, 'rb') as fh:
with f:
f.write(fh.read())
?
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, @MarcoGorelli, it works like a charm. I updated the commit.
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 @natmokval !
@@ -352,7 +353,6 @@ def test_read_explicit(self, compression, get_random_path): | |||
|
|||
# read compressed file | |||
df2 = pd.read_pickle(p2, compression=compression) | |||
|
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.
for the future, it's better to not delete unrelated lines, but it's fine here
* STYLE enable pylint: confusing-with-statement * STYLE enable pylint: confusing-with-statement II
Issue #48855. This PR enables pylint type "W" warning:
confusing-with-statement
After fixing the warning
confusing-with-statement
runningpandas/tests/io/test_pickle.py
raises an errorEOFError: Ran out of input
. To handle this error I check if the size of the file is not zero. Maybe there is a better way to deal with the test?