Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
ENH: support reading from in-memory buffers #25
ENH: support reading from in-memory buffers #25
Changes from 1 commit
0a10bc4
60b8d28
d81a70c
dadea0c
083a32a
9b3bdf3
fa9808b
6d1aeff
719399d
1502ab1
b8f7985
bc1b4f1
792210b
3e055f3
74f12a9
41f70d4
bd68a50
dadcc40
985a1ab
332680e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Elsewhere we usually handle Python => C strings in multiple steps, I thought in part because not doing so triggers a compilation error. And we've standarded on using
"UTF-8"
to refer to unicode in Cython.So this would be
Though I'm not sure that is strictly necessary. (same for
remove_virtual_filename
too)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.
It doesn't seem to be necessary, since it is compiling here?
(but already changed utf8 to UTF-8)
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.
Here I am checking for bytes vs strings to determine whether it's a path or in-memory bytes. I don't know if that is robust enough? Or do we want a separate
read_buffer
or so?Alternatively (or in addition), we could also support "file-like" objects (objects that have a
read()
method that will return the bytes). That's eg what fiona does in theiropen()
method.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 file-like objects that have a
read()
method would provide a more general solution? For example, theis_zipped
below check is limited to a single zip format, whereas the file-like pattern would let user construct and pass in aZipFile
orGzipFile
class instance. I'm not familiar with fsspec, but it seems like the file-like pattern would support that as well.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.
minor nit: remove commented line
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.
Turned it into a small explanation why we are using pygeos here
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.
Even though there is some shared code, I'd suggest simplifying this a little bit and using
pytest.mark.parametrize
with varying driver