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
Allowing boto keys to be passed directly to smart_open (#35) #38
Conversation
* Updated `smart_open` to accept an instance of boto.s3.key.Key as the `uri` parameter. * Refactored `S3OpenRead` and `S3OpenWrite` to require only a boto.s3.key.Key instance to work, and get the bucket directly from its properties. *This is not backwards compatible*. * Commented out test `SmartOpenReadTest.test_s3_boto` temporarily.
I commented out one of the tests since I'm not very familiar with moto and I'm probably doing something wrong. This is the output I get:
|
Thanks @asieira ! The PR looks great. That's a weird error, not sure what's going on. Will have to check in more detail. |
🙇 |
smart_open_object.__iter__() | ||
mock_boto.connect_s3().get_bucket.assert_called_with("mybucket") | ||
mock_boto.connect_s3().get_bucket().lookup.assert_called_with("mykey") | ||
self.assertTrue(mock_s3_iter_lines.called) |
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.
Please uncomment the test as we need to merge them in.
@asieira Thanks for the quick response. Waiting for the commit - going to release today. |
Implemented @tmylk ’s recommendations: * Fixed `test_s3_boto` by replacing usage of `lookup` with `get_key` and re-enabled it; * Fixed type checking in the constructors of `HdfsOpenRead` and `HdfsOpenWrite`; * Updated doctoring to reflect new usage of `smart_open`; * Updated CHANGELOG to reflect this change.
There you go, @tmylk ! |
Allowing boto keys to be passed directly to smart_open (#35)
I see the new version was released as 1.3.1. I would suggest that in the future the project follow the semantic versioning guidelines, which IMHO is what most developers expect these days. Under these guidelines, since new functionality was introduced by my PR, I believe the release version would have been 1.4.0. No crisis, just a suggestion for future releases. :) Thanks again for the wonderful project! |
smart_open
to accept an instance of boto.s3.key.Key as theuri
parameter.S3OpenRead
andS3OpenWrite
to require only aboto.s3.key.Key instance to work, and get the bucket directly from its
properties. This is not backwards compatible.
SmartOpenReadTest.test_s3_boto
temporarily.