_algopy_testing.mutable

Module Contents

Classes

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)

Functions

set_item_on_mutate

Used to update a container-like type when an item is modified.

set_attr_on_mutate

Used to update an object-like type when an attr is modified.

add_mutable_callback

Add on_mutate callback to value, if value is mutable.

API

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)

Initialization

set_item_on_mutate(
container: object,
index: object,
value: _algopy_testing.mutable.TItem,
) _algopy_testing.mutable.TItem

Used to update a container-like type when an item is modified.

set_attr_on_mutate(
parent: object,
name: str,
value: _algopy_testing.mutable.TItem,
) _algopy_testing.mutable.TItem

Used to update an object-like type when an attr is modified.

add_mutable_callback(
on_mutate: collections.abc.Callable[[Any], None],
value: _algopy_testing.mutable.TItem,
) _algopy_testing.mutable.TItem

Add on_mutate callback to value, if value is mutable.

Returns value to simplify usage