algopy_testing.mutable
Module Contents
Section titled “Module Contents”Classes
Section titled “Classes”MutableBytes | Helper class to ensure mutable algopy types (currently ARC4 array, tuple and |
|---|
Functions
Section titled “Functions”set_item_on_mutate(→ TItem) | Used to update a container-like type when an item is modified. |
|---|---|
set_attr_on_mutate(→ TItem) | Used to update an object-like type when an attr is modified. |
add_mutable_callback(→ TItem) | Add on_mutate callback to value, if value is mutable. |
TKey | |
|---|---|
TItem |
class MutableBytes
Section titled “class MutableBytes”Helper class to ensure mutable algopy types (currently ARC4 array, tuple and structs) cascade their changes to parent container types (global/local state, boxes, ARC4 array, tuple and structs)
copy() → Self
Section titled “copy() → Self”set_item_on_mutate(container: object, index: object, value: TItem) → TItem
Section titled “set_item_on_mutate(container: object, index: object, value: TItem) → TItem”Used to update a container-like type when an item is modified.
set_attr_on_mutate(parent: object, name: str, value: TItem) → TItem
Section titled “set_attr_on_mutate(parent: object, name: str, value: TItem) → TItem”Used to update an object-like type when an attr is modified.
add_mutable_callback(on_mutate: Callable[[Any], None], value: TItem) → TItem
Section titled “add_mutable_callback(on_mutate: Callable[[Any], None], value: TItem) → TItem”Add on_mutate callback to value, if value is mutable.
Returns value to simplify usage