-
Notifications
You must be signed in to change notification settings - Fork 289
WIP/ENH: Make S3File iterable, readline #18
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
Adds a `readline` method to S3File, which is used to make them iterable via py2 style `.next` and py3 style `__next__` methods.
30bb43b
to
b1f67a4
Compare
expected = csv_files['2014-01-01.csv'].split(b'\n')[0] + b'\n' | ||
with s3.open(test_bucket_name + '/2014-01-01.csv') as f: | ||
result = next(f) | ||
assert result == expected |
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.
Might want to try __iter__
as well. Something like the following:
assert list(f) == csv_files['2014-01-01.csv'].split(b'\n')
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 think I pushed a second commit after you made this note testing something like that a27d291
b2c7150
to
d5ab2df
Compare
d5ab2df should take care of the blocksize issue. |
d5ab2df
to
2892cdf
Compare
f425eb7
to
57fd57e
Compare
The last commit added some file-like properties There are a couple more pandas issues I'm working around.
Will followup tonight hopefully. I can keep throwing changes in the PR if you want, or followup with another. |
Whatever makes you happier. I'm really quite glad that you in particular On Mon, Mar 28, 2016 at 5:38 AM, Tom Augspurger [email protected]
|
Special atention to rerely-used length parameter
Please compare with my version in PR #19. |
The need for readable, seekable, etc. are probably peculiar to pandas. We've got the C parser, and a fallback parser written in Python. For the Python parser, I needed to wrap the byte stream from here in a Close this one in favor of #19? |
If you're happy with #19, then yes. |
Readline support with pandas additions from PR #18
Adds a
readline
method to S3File, which is used to make themiterable via py2 style
.next
and py3 style__next__
methods.