jangada.mixin.Activatable#

class jangada.mixin.Activatable#

Bases: object

Mixin that adds an activation state flag.

Provides a boolean active attribute indicating whether an object is enabled, in effect, or otherwise “active”. This is useful for objects that can be toggled on/off without destroying them.

The attribute only accepts strict boolean values (True or False), not truthy/falsy values like integers or strings.

Attributes:
activebool

Boolean flag indicating activation state. Default is True. Only accepts actual bool instances, not truthy/falsy values.

See also

SerializableProperty

Property descriptor used for active

Notes

Strict Validation

Only bool instances (True/False) are accepted. This prevents bugs from truthy/falsy values.

Use Cases
  • Enable/disable components

  • Toggle features on/off

  • Mark objects as temporarily inactive

  • Filtering active vs inactive items

State vs Deletion

Use active for temporary enable/disable. For permanent removal, delete the object instead.

Examples

Basic usage:

obj = Activatable()
print(obj.active)  # True (default)

obj.active = False
print(obj.active)  # False

Toggling state:

obj.active = not obj.active  # Toggle

Strict boolean validation:

obj = Activatable()
obj.active = True   # ✓ OK
obj.active = False  # ✓ OK
obj.active = 1      # ✗ TypeError
obj.active = 0      # ✗ TypeError
obj.active = "true" # ✗ TypeError

Conditional logic:

if obj.active:
    process(obj)
else:
    skip(obj)
__init__(*args, **kwargs)#

Methods

__delattr__(name, /)

Implement delattr(self, name).

__dir__(/)

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__getstate__(/)

Helper for pickle.

__gt__(value, /)

Return self>value.

__hash__(/)

Return hash(self).

__init__(*args, **kwargs)

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__reduce__(/)

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__(/)

Return repr(self).

__sizeof__(/)

Size of object in memory, in bytes.

__str__(/)

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

Attributes

__annotations__

active

Activation state flag.