Skip to content

type_bridge.attribute.boolean

boolean

Boolean attribute type for TypeDB.

Boolean

Boolean(value)

Bases: Attribute

Boolean attribute type that accepts bool values.

Example

class IsActive(Boolean): pass

class IsVerified(Boolean): pass

Initialize Boolean attribute with a bool value.

Parameters:

Name Type Description Default
value bool

The boolean value to store

required
Source code in type_bridge/attribute/boolean.py
def __init__(self, value: bool):
    """Initialize Boolean attribute with a bool value.

    Args:
        value: The boolean value to store
    """
    super().__init__(value)

value property

value

Get the stored boolean value.

__bool__

__bool__()

Convert to bool.

Source code in type_bridge/attribute/boolean.py
def __bool__(self) -> bool:
    """Convert to bool."""
    return bool(self.value)