Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

small io improvements #228

Merged
merged 4 commits into from
Feb 19, 2020
Merged

small io improvements #228

merged 4 commits into from
Feb 19, 2020

Conversation

michaelpetrov
Copy link
Contributor

A few small improvements to make io scopes a bit more flexible and improve inference of data formats by allowing deeper recursion.



def _file_chunk_iterator(file_handle):
reader = partial(file_handle.read, DEFAULT_BUFFER_SIZE)
reader = partial(file_handle.read, _READ_BUFFER_SIZE)
file_iterator = iter(reader, bytes())
# TODO: once dropping Python <3.3 compat, update to `yield from ...`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you in this process also fix the TODO? We're on modern Python these days. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're dropping Python 3.3 explicitly though, so I'd like to defer this for now. I do agree that in practice our team is on modern Python these days.

@@ -20,10 +20,13 @@ def set_io_scopes(scopes):


@contextmanager
def io_scope(path):
def io_scope(path, absolute=False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed oob: let's use replace_current_scopes or similar as the kwarg. :-)

@ludwigschubert
Copy link
Contributor

LGTM!

@michaelpetrov michaelpetrov merged commit 4c25f94 into master Feb 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants