-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 pre-commit on s3transfer #9385
base: v2
Are you sure you want to change the base?
Conversation
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.
a couple small requested changes.
One overarching concern I have is, will some of these cause us to deviate from boto/s3transfer? Do we want to match our formatting options to be identical to the ones used in that repo? For whitespaces it may not be a big deal, but for reordering imports and swapping interchangeable exceptions I wonder if this becomes a concern
@@ -56,7 +57,7 @@ def test_non_file_like_obj(self): | |||
def test_non_seekable_ioerror(self): |
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.
nit: rename to test_non_seekable_oserror
since we're switching to raise OSError here
non-blocking.
@@ -329,7 +329,7 @@ def test_allocate(self): | |||
|
|||
@mock.patch('s3transfer.utils.fallocate') | |||
def test_allocate_with_io_error(self, mock_fallocate): | |||
mock_fallocate.side_effect = IOError() | |||
mock_fallocate.side_effect = OSError() | |||
with self.assertRaises(IOError): |
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.
should be worth (and safe) swapping this IoError for oserror too. And also renaming to reflect 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.
Sure; raising an IOError
or OSError
result in identical behavior.
>>> try:
... raise OSError
... except IOError:
... print("hooray")
...
...
hooray
>>> try:
... raise IOError
... except OSError:
... print("hooray")
...
...
hooray
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 agree, I just figured if we're replacing the deprecated IOError in line 332, that we may as well also do a similar swap on 333.
I understand they're functionally equivalent.
Also non-blocking, feel free to resolve if you disagree
Regarding https://docs.astral.sh/ruff/rules/os-error-alias/ Also, just to check its really an alias (confirmed this back to Python 3.8):
|
In the short term, yes, only because we enabled Ruff to do the import sorting (instead of See discussion when enabling ruff import sorting on the CLI repository here: |
f025b4a
to
b98f13d
Compare
Force-pushed to pull in latest |
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.
LGTM. Have a couple non-blocking unresolved comments if you agree with them, otherwise I'm good with merging this
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.