Tools to extract views of dictionaries.
parselglossy.views.
view_by
(what: str, d: Dict[str, Any], *, predicate: Callable[[Any, str], bool] = <function <lambda>>, missing: Optional[Type[Exception]] = None, transformer: Callable[Any, Any] = <function <lambda>>) → Dict[str, Any][source]¶Recursive decimation of a template into an input.
what (str) – What view to extract from the dictionary. Any of type
, default
,
docstring
or predicates
is allowed.
d (JSONDict) –
predicate (Callable) – A predicate accepting two arguments.
missing (Optional[Exception]) –
transformer (Callable) –
outgoing – A dictionary with the desired view.
JSONDict
:raises exc:ValueError if what is not among the allowed views.:
parselglossy.views.
view_by_default
(d: Dict[str, Any]) → Dict[str, Any][source]¶Partial application of view_by()
for defaults.
d (JSONDict) –
outgoing – A dictionary with a view by defaults.
JSONDict
parselglossy.views.
view_by_default_keywords
(keywords: List[Dict[str, Any]]) → Dict[str, Any][source]¶View by defaults only for lists of keywords.
keywords (List[JSONDict]) –
outgoing – A dictionary with a view by defaults for the keywords.
JSONDict
parselglossy.views.
view_by_docstring
(d: Dict[str, Any]) → Dict[str, Any][source]¶Partial application of view_by()
for docstrings.
d (JSONDict) –
outgoing – A dictionary with a view by docstrings.
JSONDict