yatel.yio package¶
Submodules¶
yatel.yio.core module¶
Base structure for Yatel parsers.
- class yatel.yio.core.BaseParser[source]¶
Bases: object
Base class for parsers.
- dump(nw, fp, *args, **kwargs)[source]¶
Abstract Method.
Serializes data from a yatel network to a file.
Raises: NotImplementedError
- dumps(nw, *args, **kwargs)[source]¶
Serializes a yatel db to a formatted string.
Parameters: Network source of data.
Returns: string : str
Json formatted string.
- load(nw, fp, *args, **kwargs)[source]¶
Abstract Method.
Deserializes data from a file and adds it to the yatel network.
Raises: NotImplementedError
- yatel.yio.core.YF_STR_VERSION = '0.5'¶
Parser version number (string).
- yatel.yio.core.YF_VERSION = ('0', '5')¶
Parser version number (tuple).
yatel.yio.yjf module¶
Persists Yatel databases in json format.
- class yatel.yio.yjf.JSONParser[source]¶
Bases: yatel.yio.core.BaseParser
JSON parser to serialize and deserialize data.
- dump(nw, fp, *args, **kwargs)[source]¶
Serializes data from a Yatel network to a JSON file-like stream.
Parameters: Network source of data.
fp : file-like object
Target for serialization.
yatel.yio.yxf module¶
Persists Yatel databases in XML format.
- class yatel.yio.yxf.XMLParser[source]¶
Bases: yatel.yio.core.BaseParser
XML parser to serialize and deserialize data.
- dump(nw, fp, *args, **kwargs)[source]¶
Serializes data from a Yatel network to a XML file-like stream.
Parameters: Network source of data.
fp : file-like object
Target for serialization.
Module contents¶
Utilities to persist yatel into diferent file formats.
- yatel.yio.PARSERS = {'xml': <class 'yatel.yio.yxf.XMLParser'>, 'json': <class 'yatel.yio.yjf.JSONParser'>, 'yxf': <class 'yatel.yio.yxf.XMLParser'>, 'yjf': <class 'yatel.yio.yjf.JSONParser'>}¶
Container of the different parsers supported by Yatel.
- yatel.yio.SYNONYMS = frozenset([('json', 'yjf'), ('xml', 'yxf')])¶
Synonyms of the names used by the parser.
- yatel.yio.dump(ext, nw, stream=None, *args, **kwargs)[source]¶
Serializes from a Yatel network to a file or string.
Parameters: ext : str
Extension of target data.
Source database.
stream : file or str
Target of data, can be string or a file.