config.basic.number

数值类型配置数据实现

在 0.2.0 版本加入.

Classes

BoolConfigData

布尔值配置数据

NumberConfigData

数值配置数据

Module Contents

class BoolConfigData(data: D | None = None)

Bases: NumberConfigData[BoolConfigData.D]

布尔值配置数据

在 0.1.5 版本加入.

在 0.2.0 版本发生变更: 直接对参数调用 bool

参数:

data (D | None) -- 布尔值数据

__abs__() D
__add__(other: Any) Self
__and__(other: Any) Self
__bool__() bool
__ceil__() Any
__deepcopy__(memo: dict[str, Any]) Self
__eq__(other: Any) bool
__float__() float
__floor__() Any
__floordiv__(other: Any) Self
__format__(format_spec: str) str
__index__() Any
__int__() int
__invert__() Any
__lshift__(other: Any) Self
__matmul__(other: Any) Self
__mod__(other: Any) Self
__mul__(other: Any) Self
__neg__() Any
__or__(other: Any) Self
__pos__() Any
__pow__(other: Any) Self
__radd__(other: Any) Self
__rand__(other: Any) Self
__repr__() str
__rfloordiv__(other: Any) Self
__rlshift__(other: Any) Self
__rmatmul__(other: Any) Self
__rmod__(other: Any) Self
__rmul__(other: Any) Self
__ror__(other: Any) Self
__round__(ndigits: int | None = None) Any
__rpow__(other: Any) Self
__rrshift__(other: Any) Self
__rshift__(other: Any) Self
__rsub__(other: Any) Self
__rtruediv__(other: Any) Self
__rxor__(other: Any) Self
__str__() str
__sub__(other: Any) Self
__truediv__(other: Any) Self
__trunc__() Any
__xor__(other: Any) Self
freeze(freeze: bool | None = None) Self

冻结配置数据 (切换只读模式)

参数:

freeze (bool | None) -- 是否冻结配置数据, 为 None 时进行切换

返回:

返回当前实例便于链式调用

返回类型:

Self

在 0.1.5 版本加入.

classmethod from_data(*args: Any, **kwargs: Any) Self

提供创建同类型配置数据的快捷方式

返回:

新的配置数据

返回类型:

Self

备注

套壳 __init__ 主要是为了方便内部快速创建与传入的ABCConfigData同类型的对象

例如:

type(instance)(data)

可以简写为

instance.from_data(data)

在 0.2.0 版本发生变更: 现在会自适应初始化参数

__hash__ = None
__slots__ = ()
_data: BoolConfigData.D
_read_only: bool | None = False
data: BoolConfigData.D

配置的原始数据

小心

未默认做深拷贝,可能导致非预期的行为

在 0.3.0 版本发生变更: 现在是可写属性

property data_read_only: False

配置数据是否为只读

返回:

配置数据是否为只读

返回类型:

Literal[False]

备注

该配置数据类始终认为配置数据非只读,使其能正确作为配置数据容器使用

property read_only: bool | None

配置数据是否为 只读模式

返回:

配置数据是否为 只读模式

返回类型:

bool | None

class NumberConfigData(data: D | None = None)

Bases: config.basic.core.BasicSingleConfigData[NumberConfigData.D]

数值配置数据

在 0.1.5 版本加入.

参数:

data (D | None) -- 数值数据

__abs__() D
__add__(other: Any) Self
__and__(other: Any) Self
__bool__() bool
__ceil__() Any
__deepcopy__(memo: dict[str, Any]) Self
__eq__(other: Any) bool
__float__() float
__floor__() Any
__floordiv__(other: Any) Self
__format__(format_spec: str) str
__index__() Any
__int__() int
__invert__() Any
__lshift__(other: Any) Self
__matmul__(other: Any) Self
__mod__(other: Any) Self
__mul__(other: Any) Self
__neg__() Any
__or__(other: Any) Self
__pos__() Any
__pow__(other: Any) Self
__radd__(other: Any) Self
__rand__(other: Any) Self
__repr__() str
__rfloordiv__(other: Any) Self
__rlshift__(other: Any) Self
__rmatmul__(other: Any) Self
__rmod__(other: Any) Self
__rmul__(other: Any) Self
__ror__(other: Any) Self
__round__(ndigits: int | None = None) Any
__rpow__(other: Any) Self
__rrshift__(other: Any) Self
__rshift__(other: Any) Self
__rsub__(other: Any) Self
__rtruediv__(other: Any) Self
__rxor__(other: Any) Self
__str__() str
__sub__(other: Any) Self
__truediv__(other: Any) Self
__trunc__() Any
__xor__(other: Any) Self
freeze(freeze: bool | None = None) Self

冻结配置数据 (切换只读模式)

参数:

freeze (bool | None) -- 是否冻结配置数据, 为 None 时进行切换

返回:

返回当前实例便于链式调用

返回类型:

Self

在 0.1.5 版本加入.

classmethod from_data(*args: Any, **kwargs: Any) Self

提供创建同类型配置数据的快捷方式

返回:

新的配置数据

返回类型:

Self

备注

套壳 __init__ 主要是为了方便内部快速创建与传入的ABCConfigData同类型的对象

例如:

type(instance)(data)

可以简写为

instance.from_data(data)

在 0.2.0 版本发生变更: 现在会自适应初始化参数

__hash__ = None
__slots__ = ()
_data: NumberConfigData.D
_read_only: bool | None = False
property data: D

配置的原始数据

小心

未默认做深拷贝,可能导致非预期的行为

在 0.3.0 版本发生变更: 现在是可写属性

property data_read_only: False

配置数据是否为只读

返回:

配置数据是否为只读

返回类型:

Literal[False]

备注

该配置数据类始终认为配置数据非只读,使其能正确作为配置数据容器使用

property read_only: bool | None

配置数据是否为 只读模式

返回:

配置数据是否为 只读模式

返回类型:

bool | None