Skip to content
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

Look at replacing StringIO/BytesIO usage with simple Reader implementation #609

Open
robertbartel opened this issue May 10, 2024 · 4 comments
Labels
enhancement New feature or request maas MaaS Workstream

Comments

@robertbartel
Copy link
Contributor

robertbartel commented May 10, 2024

See here for original suggestion.

In short, consider moving to a custom implementation of the Reader protocol (or what Pandas would refer to as a "file-like object") in places where StringIO or BytesIO are used.

(Update: title, description, and first comment updated to include both StringIO and BytesIO.)

@robertbartel robertbartel added enhancement New feature or request maas MaaS Workstream labels May 10, 2024
@robertbartel
Copy link
Contributor Author

robertbartel commented May 10, 2024

I am at least a bit curious the degree to which this is preferable to just using StringIO/BytesIO. Wouldn't mind a bit of discussion and references here if possible before we proceed with anything.

@christophertubbs
Copy link
Contributor

This is one of those things that makes my head tilt like a dog. Why not use a BytesIO when it's a bytes object?

@robertbartel
Copy link
Contributor Author

This is one of those things that makes my head tilt like a dog. Why not use a BytesIO when it's a bytes object?

Probably only because I wasn't thinking too hard about it, and the Pandas documentation for read_csv specifically cites StringIO as an example of a file-like. So it put a valid solution in my head, and I just went with it.

I probably should change that in the #566 review (and then update the issue title and description here; I think the general question probably still applies).

@robertbartel robertbartel changed the title Look at replacing StringIO usage with simple Reader implementation Look at replacing StringIO/BytesIO usage with simple Reader implementation May 10, 2024
@aaraney
Copy link
Member

aaraney commented May 11, 2024

Yeah, I concur, @robertbartel in regard to switching to BytesIO. I must have had a one tracked mind when reviewing! BytesIO didn't come to mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request maas MaaS Workstream
Projects
None yet
Development

No branches or pull requests

3 participants