reference package

Submodules

reference.IReference module

class reference.IReference.IReference(value: Any, readonly: bool = False, read_from: IReference | None = None)

Bases: object

add_hook(name: str, hook: Callable) bool

Add a function to be executed on value update. If the same hook is added with different names, or the name is already present, the hook won’t be added :param name: Unique name for the hook :param hook: Callable function that accepts 1 input :return: True if added. False if not.

as_readonly() IReference

Creates a Readonly object and shares the same values :return: Immutable copy of reference

clear() None

Clears everything from the internals and sets the value to None :return: None

logs() None

Prints all changes to the reference. :return: None

reset() None

Resets the value to the original value :return: None

value: Any

reference.Reference module

class reference.Reference.MutableReference(value: Any, readonly: bool = False, read_from: IReference | None = None)

Bases: IReference

add_hook(name: str, hook: Callable) bool

Add a function to be executed on value update. If the same hook is added with different names, or the name is already present, the hook won’t be added :param name: Unique name for the hook :param hook: Callable function that accepts 1 input :return: True if added. False if not.

as_readonly() IReference

Creates a Readonly object and shares the same values :return: Immutable copy of reference

clear() None

Clears everything from the internals and sets the value to None :return: None

logs()

Prints all changes to the reference. :return: None

reset() None

Resets the value to the original value :return: None

property value
class reference.Reference.ReadonlyReference(reference: IReference)

Bases: MutableReference

Module contents

class reference.MutableReference(value: Any, readonly: bool = False, read_from: IReference | None = None)

Bases: IReference

add_hook(name: str, hook: Callable) bool

Add a function to be executed on value update. If the same hook is added with different names, or the name is already present, the hook won’t be added :param name: Unique name for the hook :param hook: Callable function that accepts 1 input :return: True if added. False if not.

as_readonly() IReference

Creates a Readonly object and shares the same values :return: Immutable copy of reference

clear() None

Clears everything from the internals and sets the value to None :return: None

logs()

Prints all changes to the reference. :return: None

reset() None

Resets the value to the original value :return: None

property value
class reference.ReadonlyReference(reference: IReference)

Bases: MutableReference