dom_toml.config¶
Source code: dom_toml/config/__init__.py
Nested configuration parsed from a TOML file.
Attention
This module has the following additional requirements:
attrs>=23.1.0 tomli-w>=1.0.0 typing-extensions>=4.7.1
These can be installed as follows:
python -m pip install dom-toml[config]
New in version 2.2.0.
Classes:
|
Configuration parsed from a TOML file. |
Functions:
|
Attrs field for a nested table. |
|
Decorator to override the table name on a |
|
Convert the given string into |
-
class
Config[source]¶ Bases:
objectConfiguration parsed from a TOML file.
Methods:
__eq__(other)Method generated by attrs for class Config.
Automatically created by attrs.
__ne__(other)Check equality and either forward a NotImplemented or return the result negated.
__repr__()Method generated by attrs for class Config.
__setstate__(state)Automatically created by attrs.
from_dict(config)Construct a
Configfrom a dictionary or TOML table.from_json(json_string)Parse a
Configfrom a JSON string.from_toml(toml_string)Parse a
Configfrom a TOML string.to_dict()Convert a
Configto a dictionary.to_toml()Convert a
Configto a TOML string.-
__eq__(other)¶ Method generated by attrs for class Config.
-
__getstate__()¶ Automatically created by attrs.
-
__ne__(other)¶ Check equality and either forward a NotImplemented or return the result negated.
-
__repr__()¶ Method generated by attrs for class Config.
-
__setstate__(state)¶ Automatically created by attrs.
-
-
table_name(name)[source]¶ Decorator to override the table name on a
Configclass.New in version 2.3.0.
-
_C= TypeVar(_C, bound=Config)¶ Type:
TypeVarInvariant
TypeVarbound todom_toml.config.Config.
dom_toml.config.fields¶
Source code: dom_toml/config/fields.py
Primitive field types.
Classes:
|
Boolean config field type. |
|
Customisable config field type. |
|
Integer config field type. |
|
Numerical config field type. |
|
String config field type. |
-
class
Boolean(default: _FT)[source]¶ Bases:
FieldTypeBoolean config field type.
Classes:
alias of
bool
-
class
FieldType(default: _FT)[source]¶ -
Customisable config field type.
Methods:
field(default)Construct an attrs field.
on_setattr(inst, attr, value)Converts values on
__setattr__.validator(inst, attr, value)Check if a value conforms to this field’s expected datatype.
Attributes:
String name of the field.
The Python type of the object.
-
class
Integer(default: _FT)[source]¶ Bases:
FieldTypeInteger config field type.
Classes:
alias of
int
-
class
Number(default: _FT)[source]¶ Bases:
FieldTypeNumerical config field type.
Classes:
alias of
floatMethods:
validator(inst, attr, value)Check if a value is a number.