module parsers
function parse_json
parse_json(
json_in: Union[IO[str], IO[bytes], str, bytes],
encoding: str = 'utf-8',
ignore_empty_fields: bool = True
) → Any
parse_json Parses the JSON string using a JSON 5 compliant decoder
Any empty JSON will be removed from decoded output. See remove_empty_json
Args:
json_in
(JsonDataIn): the json to decodeencoding
(str, optional): the character encoding to use. Defaults to "utf-8"ignore_empty_fields
(bool): Whether to ignore empty fields. Defaults to True
Returns:
Any
: the decoded output
function parse_xml_filter
parse_xml_filter(element: _Element, *_) → Optional[Dict[str, Any]]
parse_xml_filter Determines if the element should be filtered or not
Args:
element
(XmlElement): the current element
Returns:
Optional[ParsedXml]
: An empty dict if the element should be filtered or None
function parse_xml
parse_xml(
xml_in: Union[IO[str], IO[bytes], PathLike, str, bytes],
parse_opts: ParseXmlOpts = ParseXmlOpts(cdata_key='_', encoding='utf-8'),
parse_filter: Callable[[_Element, Optional[_Element], ParseXmlOpts], Optional[Dict[str, Any]]] = <function parse_xml_filter at 0x7f5bc0126710>,
after_parse_xml: Callable[[Dict[str, Any], _ElementTree, ParseXmlOpts], Dict[str, Any]] = <function <lambda> at 0x7f5bc01267a0>
) → Dict[str, Any]
parse_xml Parses the xml imput string or text/binary IO to a dict
Args:
xml_in
(DataIn): the xml input. May be path like, any string, or file likeparse_opts
(ParseXmlOpts, optional): the parser options. See ParseXmlOpts for defaultsparse_filter
(ParseXmlFilter, optional): the parse filter to use while parsing the provided xml. Filters should return ParsedXml, an empty dict or None. None indicates the current element is not filtered and parsing should continue down the elements tree. See parse_xml_filter for additional informationafter_parse_xml
(AfterParseXml, optional): the post processing logic to apply to the parsed dict after all processing has completed. Noop by default
Returns:
ParsedXml
: the parsed xml dict
class ParseXmlOpts
ParseXmlOpts(cdata_key: str = '_', encoding: str = 'utf-8')
method __init__
__init__(cdata_key: str = '_', encoding: str = 'utf-8') → None
This file was automatically generated via lazydocs.