NativeParser¶
- class dictIO.parser.NativeParser¶
Bases:
Parser
Parser to deserialize a string in dictIO native file format into a SDict.
- __init__() None ¶
Define default configuration for NativeParser.
Methods
__init__
()Define default configuration for NativeParser.
get_parser
([source_file])Return a Parser instance matching the type of the source file to be parsed (factory method).
parse_file
(source_file[, target_dict, comments])Parse a file and deserialize it into a dict.
parse_key
(arg)Parse a single key.
parse_string
(string, target_dict, *[, comments])Parse a string in dictIO native file format and deserialize it into a SDict.
parse_value
(arg)Parse a single value.
parse_values
(arg)Parse multiple values.
remove_quotes_from_string
(arg, *[, all_quotes])Remove quotes from a string.
remove_quotes_from_strings
(arg)Remove quotes from multiple strings.
- parse_string(string: str, target_dict: SDict[K, V], *, comments: bool = True) SDict[K, V] ¶
Parse a string in dictIO native file format and deserialize it into a SDict.
- Parameters:
string (str) – the string to be parsed (i.e. the content of the file that had been read using parse_file())
target_dict (SDict) – the target dict the parsed dict file shall be merged into
comments (bool, optional) – reads comments, by default True
- Returns:
the parsed dict
- Return type: