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

Always return pointer object on indexing #7

Merged
merged 2 commits into from
Jan 3, 2024
Merged

Conversation

pmrv
Copy link
Contributor

@pmrv pmrv commented Jan 3, 2024

Currently indexing to a non exiting group shows to distinct behaviors. If the file exists a new pointer object is returned and writing to it will create the group. If the file does not exist None is returned. This patch makes both cases return a pointer object which creates the underlying file/group once written to it. Imo this is more convenient for downstream users because otherwise they need to maintain separate code paths for creating new groups in existing and non existing files, since there are no methods to force creation of an empty group (what would be create_group in pyiron_base speak).

Currently indexing to a non exiting group shows to distinct behaviors.  If the file
exists a new pointer object is returned and writing to it will create the group.
If the file does not exist None is returned.  This patch makes both cases return a
pointer object which creates the underlying file/group once written to it.  Imo this
is more convenient for downstream users because otherwise they need to maintain separate
code paths for creating new groups in existing and non existing files, since there are
no methods to force creation of an empty group (what would be create_group in pyiron_base speak).
@jan-janssen
Copy link
Member

======================================================================
FAIL: test_empty_file_root (test_pointer.TestPointer)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/h5io_browser/h5io_browser/tests/test_pointer.py", line 42, in test_empty_file_root
    self.assertIsNone(p["test"])
AssertionError: <h5io_browser.pointer.Pointer object at 0x7fb8e3287a30> is not None

----------------------------------------------------------------------

@jan-janssen jan-janssen merged commit 49c715c into h5io:main Jan 3, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants