-
-
Notifications
You must be signed in to change notification settings - Fork 301
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
[v3] Array.append #2413
[v3] Array.append #2413
Conversation
changes the Array.resize to be an inplace operation
…into feature/append-v3
return replace(self, metadata=new_metadata) | ||
|
||
# Update metadata (in place) | ||
object.__setattr__(self, "metadata", new_metadata) |
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.
@TomAugspurger - calling this out because it will impact the xarray use of resize... now in-place again :)
@pytest.mark.parametrize("store", ["memory"], indirect=True) | ||
@pytest.mark.parametrize("zarr_format", [2, 3]) | ||
def test_resize_1d(store: MemoryStore, zarr_format: int) -> None: |
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.
to fight test bloat we should find a way to parameterize over dimensionality instead of making separate 1d, 2d, etc tests. but that's not a blocker here.
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.
agree! These tests were copied over from v2 so I'm going to leave them for now.
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.
looks good! I think we just need a more informative exception here.
…into feature/append-v3
pre-commit.ci autofix |
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!
Ports the
Array.append
method over from 2.18 (plus tests for resize/append). Mostly a copy-and-paste but does come with a bit of extra behavior changes:Array
class is now a non-Frozen dataclass. This is needed to support property setters. I've added a note describing when we can go back tofrozen=True
Array.resize
is an in-place op again. As we discussed at the meeting yesterday, it really didn't make sense to have this any other way (what would you do with the old array object?)closes #2404
TODO: