betty.serde.dump module¶
Provide a serialization API.
- betty.serde.dump.DictDump¶
A dump which is a dictionary whose keys are strings and values are serialized dumps.
- betty.serde.dump.Dump¶
A serialized dump.
alias of
bool
|int
|float
|str
|None
|Sequence
[Dump
] |Mapping
[str
,Dump
]
- betty.serde.dump.DumpType: TypeAlias = bool | int | float | str | None | list['Dump'] | dict[str, 'Dump']¶
The Python types that define a serialized dump.
- class betty.serde.dump.Dumpable[source]¶
Bases:
object
Instances can be dumped to serializable data.
- dump() bool | int | float | str | None | Sequence[bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | Mapping[str, bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | type[betty.typing.Void] [source]¶
Dump this instance to a portable format.
- Return type:
typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],typing.Mapping
[str
,typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],type
[betty.typing.Void
]]
- betty.serde.dump.ListDump¶
A dump which is a list whose values are serialized dumps.
alias of
list
[_DumpT
]
- betty.serde.dump.VoidableDictDump¶
A dump which is a dictionary whose keys are strings and values are serialized dumps, or that may be
betty.serde.dump.Void
- betty.serde.dump.VoidableDump¶
A serialized dump that may be
betty.serde.dump.Void
.alias of
bool
|int
|float
|str
|None
|Sequence
[Dump
] |Mapping
[str
,Dump
] |type
[Void
]
- betty.serde.dump.VoidableListDump¶
A dump which is a list whose values are serialized dumps, or that may be
betty.serde.dump.Void
alias of
list
[_VoidableDumpU
]
- betty.serde.dump.dump_default(dump, key, default_type)[source]¶
Add a key and value to a dump, if the key does not exist yet.
- betty.serde.dump.minimize(dump: bool | int | float | str | None | Sequence[bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | Mapping[str, bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | type[betty.typing.Void] | list[bool | int | float | str | None | Sequence[bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | Mapping[str, bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | type[betty.typing.Void]] | dict[str, bool | int | float | str | None | Sequence[bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | Mapping[str, bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | type[betty.typing.Void]], voidable: bool = True) bool | int | float | str | None | Sequence[bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | Mapping[str, bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | type[betty.typing.Void] [source]¶
Minimize a configuration dump by removing any Void configurationfrom sequences and mappings.
- Parameters:
dump (
typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],typing.Mapping
[str
,typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],type
[betty.typing.Void
],list
[typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],typing.Mapping
[str
,typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],type
[betty.typing.Void
]]],dict
[str
,typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],typing.Mapping
[str
,typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],type
[betty.typing.Void
]]]])voidable (
bool
)
- Return type:
typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],typing.Mapping
[str
,typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],type
[betty.typing.Void
]]
- betty.serde.dump.none_void(value: bool | int | float | str | None | Sequence[bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | Mapping[str, bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | type[betty.typing.Void]) bool | int | float | str | None | Sequence[bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | Mapping[str, bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | type[betty.typing.Void] [source]¶
Passthrough a value, but convert None to Void.
- Parameters:
value (
typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],typing.Mapping
[str
,typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],type
[betty.typing.Void
]])- Return type:
typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],typing.Mapping
[str
,typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],type
[betty.typing.Void
]]
- betty.serde.dump.void_none(value: bool | int | float | str | None | Sequence[bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | Mapping[str, bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | type[betty.typing.Void]) bool | int | float | str | None | Sequence[bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | Mapping[str, bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | type[betty.typing.Void] [source]¶
Passthrough a value, but convert Void to None.
- Parameters:
value (
typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],typing.Mapping
[str
,typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],type
[betty.typing.Void
]])- Return type:
typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],typing.Mapping
[str
,typing.Union
[bool
,int
,float
,str
,None
,typing.Sequence
[Dump],typing.Mapping
[str
, Dump]]],type
[betty.typing.Void
]]