Skip to content

config ¤

Classes:

Attributes:

T module-attribute ¤

T = TypeVar('T')

PARAM_BOOLEAN module-attribute ¤

PARAM_BOOLEAN = 0

PARAM_ZINTEGER module-attribute ¤

PARAM_ZINTEGER = 1

PARAM_STRING module-attribute ¤

PARAM_STRING = 2

PARAM_ZUINTEGER module-attribute ¤

PARAM_ZUINTEGER = 3

PARAM_ENUM module-attribute ¤

PARAM_ENUM = 4

PARAM_OPTIONAL_FILENAME module-attribute ¤

PARAM_OPTIONAL_FILENAME = 5

PARAM_AUTO_BOOLEAN module-attribute ¤

PARAM_AUTO_BOOLEAN = 6

PARAM_ZUINTEGER_UNLIMITED module-attribute ¤

PARAM_ZUINTEGER_UNLIMITED = 7

PARAM_INTEGER module-attribute ¤

PARAM_INTEGER = 8

PARAM_UINTEGER module-attribute ¤

PARAM_UINTEGER = 9

PARAM_CLASSES module-attribute ¤

PARAM_CLASSES = {bool: PARAM_BOOLEAN, int: PARAM_ZINTEGER, str: PARAM_STRING}

HELP_DEFAULT_PREFIX module-attribute ¤

HELP_DEFAULT_PREFIX = 'Default:'

HELP_VALID_VALUES_PREFIX module-attribute ¤

HELP_VALID_VALUES_PREFIX = 'Valid values:'

Scope ¤

Bases: Enum

Attributes:

config class-attribute instance-attribute ¤

config = 1

theme class-attribute instance-attribute ¤

theme = 2

heap class-attribute instance-attribute ¤

heap = 3

Parameter ¤

Parameter(
    name: str,
    default: Any,
    set_show_doc: str,
    *,
    help_docstring: str = "",
    param_class: int | None = None,
    enum_sequence: Sequence[str] | None = None,
    scope: Scope = config,
)

Methods:

Attributes:

name instance-attribute ¤

name = name

default instance-attribute ¤

default = default

param_class instance-attribute ¤

param_class = param_class or PARAM_CLASSES[type(default)]

set_show_doc instance-attribute ¤

set_show_doc = set_show_doc

help_docstring instance-attribute ¤

help_docstring = help_docstring

enum_sequence instance-attribute ¤

enum_sequence = enum_sequence

scope instance-attribute ¤

scope = scope

update_listeners instance-attribute ¤

update_listeners: list[Callable[[Any], None]] = []

value property writable ¤

value: Any

is_changed property ¤

is_changed: bool

add_update_listener ¤

add_update_listener(listener: Callable[[Any], None]) -> None

revert_default ¤

revert_default() -> None

attr_name ¤

attr_name() -> str

Returns the attribute name associated with this config option, i.e. my-config has the attribute name my_config

__getattr__ ¤

__getattr__(name: str)

pretty_val ¤

pretty_val(val: Any) -> str

Convert a value this object could contain to its pretty string representation.

pretty ¤

pretty() -> str

pretty_default ¤

pretty_default() -> str

__int__ ¤

__int__() -> int

__str__ ¤

__str__() -> str

__bool__ ¤

__bool__() -> bool

__eq__ ¤

__eq__(other: object) -> bool

__lt__ ¤

__lt__(other: object) -> bool

__add__ ¤

__add__(other: int) -> int

__radd__ ¤

__radd__(other: int) -> int

__sub__ ¤

__sub__(other: int) -> int

__rsub__ ¤

__rsub__(other: int) -> int

__mul__ ¤

__mul__(other: int) -> int

__rmul__ ¤

__rmul__(other: int) -> str

__div__ ¤

__div__(other: float) -> float

__floordiv__ ¤

__floordiv__(other: int) -> int

__pow__ ¤

__pow__(other: int) -> int

__mod__ ¤

__mod__(other: int) -> int

__len__ ¤

__len__() -> int

Config ¤

Config()

Methods:

Attributes:

params instance-attribute ¤

params: dict[str, Parameter] = {}

triggers instance-attribute ¤

triggers: DefaultDict[str, list[Callable[..., Any]]] = defaultdict(list)

add_param ¤

add_param(
    name: str,
    default: Any,
    set_show_doc: str,
    *,
    help_docstring: str = "",
    param_class: int | None = None,
    enum_sequence: Sequence[str] | None = None,
    scope: Scope = config,
) -> Parameter

add_param_obj ¤

add_param_obj(p: Parameter) -> Parameter

trigger ¤

trigger(*params: Parameter) -> Callable[[Callable[..., T]], Callable[..., T]]

get_params ¤

get_params(scope: Scope) -> list[Parameter]

__getattr__ ¤

__getattr__(name: str) -> Parameter

__setattr__ ¤

__setattr__(attr, val)