Converter
A data converter.
Usage
Converter(fmt="json")Parameters
fmt: str = "json"-
The output format.
Methods
| Name | Description |
|---|---|
| convert() | Convert data to the target format. |
| is_valid() | Return whether this converter accepts the data |
| merge() | Merge settings from another converter |
convert()
Convert data to the target format.
Usage
convert(data)Parameters
data: str-
The input data string.
Returns
str-
Converted data.
is_valid()
Return whether this converter accepts the data
Usage
is_valid(data)Parameters
data-
Data string to validate.
Returns
Whether data is non-empty.
merge()
Merge settings from another converter
Usage
merge(other)Parameters
other-
Converter whose settings to copy.
Returns
-
New converter with the copied format.
Notes
The format from other replaces the current format.