-
Notifications
You must be signed in to change notification settings - Fork 179
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(api): Allow recovering from errors that happen during the preparation part of an aspirate command #16896
base: edge
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,6 +299,19 @@ class StateUpdate: | |
|
||
liquid_class_loaded: LiquidClassLoadedUpdate | NoChangeType = NO_CHANGE | ||
|
||
def append(self, other: Self) -> Self: | ||
"""Apply another `StateUpdate` "on top of" this one. | ||
|
||
This object is mutated in-place, taking values from `other`. | ||
If an attribute in `other` is `NO_CHANGE`, the value in this object is kept. | ||
""" | ||
fields = dataclasses.fields(other) | ||
for field in fields: | ||
other_value = other.__dict__[field.name] | ||
if other_value != NO_CHANGE: | ||
self.__dict__[field.name] = other_value | ||
return self | ||
|
||
Comment on lines
+302
to
+314
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is |
||
@classmethod | ||
def reduce(cls: typing.Type[Self], *args: Self) -> Self: | ||
"""Fuse multiple state updates into a single one. | ||
Comment on lines
315
to
317
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to self: Can probably implement |
||
|
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.
imo passthrough and union with previous successes