Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Add ability to open Raw from file or blob #42

Open
SamWhited opened this issue May 31, 2015 · 0 comments
Open

Add ability to open Raw from file or blob #42

SamWhited opened this issue May 31, 2015 · 0 comments
Assignees
Milestone

Comments

@SamWhited
Copy link
Member

Possibly add the ability to open a file from a blob or a filehandle that is already open.

If we do want to do this, what does the API look like? Wand uses a somewhat un-Pythonic solution:

Raw(filename=None, file=None, blob=None)

and then does some aweful iteration to decide if any two arguments are set and throw a TypeError if so. This looks fairly terrible, but it does lead to a nice clean API.

The more Pythonic way to do this would probably be to just have a single method and just see what works (or even do a type check and attempt to open a file if a string is passed in, open a raw if bytes or a huge string is passed in, or read from the file if a file object is passed in). That would effectively keep the method signature the same:

Raw(data=None)

where data replaces file and can either be a string, blob, or file object.

@SamWhited SamWhited self-assigned this Jun 2, 2015
@SamWhited SamWhited added this to the v1.0.0 milestone Jun 2, 2015
@SamWhited SamWhited modified the milestones: v0.6.0, v1.0.0 Aug 14, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant