-
-
Notifications
You must be signed in to change notification settings - Fork 29
feat: add support for .b2z, .b2d, .b2e files and update related tests #541
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
feat: add support for .b2z, .b2d, .b2e files and update related tests #541
Conversation
FrancescAlted
left a comment
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.
Sounds good for a first iteration. I wonder why you did not include TreeStore here.
Also, it would be nice to overhaul the docs and use this new handy capability where it would be applicable. A specific section in some tutorial about this would be fine too.
Thanks for your time!
|
Thank you for your feedback, and thank you for taking the time to review my PR. The I'm not sure as to how I should decide when to open it as a
What do you think is a better fit? Or perhaps you have another perspective on how to approach this? |
|
Oh, I was expecting to associate each file extension with a different class. So:
In the future me may want to add a specific metainfo for that, but for now I think the above would be enough. |
|
I've added support for Please do let me know if you feel I've missed something, or can add to this further! |
FrancescAlted
left a comment
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.
LGTM
|
Thanks @bossbeagle1509 ! BTW, I have been thinking on a better way to improve this work, and I am providing hints in #546. |
Support special stores in
blosc2.open()and add context managersThis PR enhances
blosc2.open()to support openingDictStoreandEmbedStorefiles directly via file extensions. It also implements context manager support for these stores and refactors theopen()function to improve code maintainability.Key Changes:
Unified
blosc2.open()API:DictStorefiles with extensions.b2zand.b2dEmbedStorefiles with extension.b2eblosc2.open("data.b2z")instead of importing specific store classesRefactoring (Code Quality):
src/blosc2/schunk.py:open()to address high cyclomatic complexity (Ruff C901) triggered by changes introduced by this commit_open_special_store(): Handles extension-based dispatch for special stores_set_default_dparams(): Centralizes default decompression parameter logic_process_opened_object(): Handles post-open logic forProxyandLazyArrayContext Manager Support:
__enter__(),__exit__(), andclose()methods forDictStoreandEmbedStorewithstatement for safer resource management (e.g.,with blosc2.open("file.b2z") as store:)Bug Fixes:
DictStoreandEmbedStoreinternally calledblosc2.open(), creating a loop. These now use the lower-levelblosc2_ext.open()Testing:
test_open_context_manager()totests/test_dict_store.pyandtests/test_embed_store.pyto verify the new functionality