API Reference¶
This is the API reference generated from the source code.
Yes, another config lang
- class modcfg.Module(name, contents)¶
- property contents¶
Alias for field number 1
- property name¶
Alias for field number 0
- modcfg.dumps(objects: Union[List[T], Dict[str, T], Module]) str ¶
Converts objects to str that can be loadsed back.
Basically json.dumps but for ModCFG.
- Parameters
objects (Union[List[Any], Dict[str, Any], components.Module]) – The objects to dump.
- Returns
Returns the dumped str.
- Return type
str
- Raises
errors.DumpError – Invalid object (couldn’t dump it)
- Canonical
modcfg.parser
- modcfg.loads(s: str, enums: Optional[List[Enum]] = None, enum_resolve_fail_silently: bool = False, enum_ambiguity_check: bool = True, inline: bool = False) Union[Module, List[Any], Dict[str, Any], List[Union[Module, List[Any], Dict[str, Any]]]] ¶
Serializes the document, s, to Python objects.
- Parameters
s (str) – The ModCFG document to parse and evaluate.
enums (Optional[List[enum.Enum]]) – The list of Python enums that should be serialized from in the document. Defaults to None.
enum_resolve_fail_silently (bool) – Implicitly convert enum values to str if couldn’t resolve the enum. Defaults to True.
enum_ambiguity_check (bool) – Fail if the enums given are ambigous. Defaults to True.
inline (bool) – Inline the output. See docs for more details. Defaults to False.
- Returns
The serialized Python object.
- Return type
Union[Union[components.Module, List[Any], Dict[str, Any]],List[Union[components.Module, List[Any], Dict[str, Any]]]]
- Raises
errors.ModCFGError – There was an error processing your document
- Canonical
modcfg.parser
All errors will be subclassing the modcfg.errors.ModCFGError
exception.
- exception modcfg.errors.BadIndentation¶
- exception modcfg.errors.BadKeyChar¶
- exception modcfg.errors.BadName¶
- exception modcfg.errors.DumpError¶
Failed to dump
- exception modcfg.errors.EmptyBody¶
- exception modcfg.errors.EnumResolveError¶
There was an error when resolving enumeration(s)
- class modcfg.errors.Error(desc, help_text)¶
- property desc¶
Alias for field number 0
- property help_text¶
Alias for field number 1
- exception modcfg.errors.InvalidDateFormat¶
Your date(time)s cannot be parsed
- exception modcfg.errors.InvalidEscape¶
You used an invalid escape sequence
- exception modcfg.errors.InvalidKeyChar¶
- exception modcfg.errors.MixedModuleContents¶
- exception modcfg.errors.ModCFGError¶
Base error class for ModCFG.
- exception modcfg.errors.ModCFGSyntaxError¶
There was an error parsing the ModCFG document
- exception modcfg.errors.Y_U_NO_TEXT¶