snakia.property
Functions
|
Create a class property. |
|
Factory for Initonly. |
|
Create a readonly property with the given value. |
Classes
|
A property that uses a cell to store its value. |
|
Class property |
|
A property that calls a function when the property is set, get, or deleted. |
|
Property that can only be set once. |
|
A property that can be set, get, and deleted. |
|
Readonly property. |
- class snakia.property.CellProperty(fget, fset=<function func>, fdel=<function func>)[source]
Bases:
Generic[T]A property that uses a cell to store its value.
- class snakia.property.ClassProperty(fget, fset=<function func>, fdel=<function func>)[source]
Bases:
Generic[T]Class property
- class snakia.property.HookProperty(on_get, on_set=<function func>, on_del=<function func>)[source]
Bases:
PrivProperty[T],Generic[T]A property that calls a function when the property is set, get, or deleted.
- property name: str
Return the name of the variable associated with the property.
- class snakia.property.Initonly[source]
- class snakia.property.Initonly(default_value: T)
- class snakia.property.Initonly(*, default_factory: Callable[[Self], T])
Bases:
PrivProperty[T],Generic[T]Property that can only be set once.
- __init__(default_value=<class 'snakia.types.unique.Unset'>, default_factory=<class 'snakia.types.unique.Unset'>)
- property name: str
Return the name of the variable associated with the property.
- class snakia.property.PrivProperty[source]
- class snakia.property.PrivProperty(default_value: T)
- class snakia.property.PrivProperty(*, default_factory: Callable[[Self], T])
Bases:
Generic[T]- __init__(default_value=<class 'snakia.types.unique.Unset'>, default_factory=<class 'snakia.types.unique.Unset'>)[source]
- property name: str
Return the name of the variable associated with the property.
- class snakia.property.Property(fget=<function func>, fset=<function func>, fdel=<function func>)[source]
Bases:
Generic[T]A property that can be set, get, and deleted.
- property name: str
- class snakia.property.Readonly(fget, *, strict=False)[source]
Bases:
Property[T],Generic[T]Readonly property.
- property name: str
- snakia.property.classproperty(fget, fset=<function func>, fdel=<function func>)[source]
Create a class property.
- Return type:
ClassProperty[TypeVar(T)]
- Args:
fget (Callable[[Any], T], optional): The getter function. Defaults to empty.func. fset (Callable[[Any, T], None], optional): The setter function. Defaults to empty.func. fdel (Callable[[Any], None], optional): The deleter function. Defaults to empty.func.
- Returns:
Self: The class property.
- snakia.property.readonly(value, *, strict=False)[source]
Create a readonly property with the given value.
- Return type:
Readonly[TypeVar(T)]
- Args:
value (T): The value to set the readonly property to.
- Returns:
Readonly[T]: The readonly property.
Modules