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

Dirs, files, and key-dependent value transformation #77

Open
thorwhalen opened this issue Oct 1, 2020 · 0 comments
Open

Dirs, files, and key-dependent value transformation #77

thorwhalen opened this issue Oct 1, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@thorwhalen
Copy link
Member

See ZipReader in slib.s_zipfile.py. This store has two value categories: Directories and Files. Both categories are distinguishable by the keys, through the "ends with slash" convention.

When a file, the value return is bytes, as usual.

When a directory, the value returned is a ZipReader itself, with all params the same, except for the prefix which serves to specify the subfolder (that is, prefix acts as a filter).

See filesys.py. It has some file stores and some dir stores. Separate. In what ways could we make stores that do both, like ZipReader does (but not necessarily how it does -- perhaps there's a better way, a more specifically appropriate one, or on the other hand, a more general (and reusable) pattern.

See new_s3.py. Same question/task.

Read misc.py and understand how it works. Perhaps this is a better approach to the problem.
It fits since it solves the general problem of returning a different kind of object as a function of a property of the key (in misc.py that property is the extension -- but a more general setup is present there already).

Perhaps the approach that misc takes should be generalized to a general pattern/utility/decorator that can be used to solve the dir vs. file problem for zip, local files, and s3.

@thorwhalen thorwhalen added the enhancement New feature or request label Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant