Evaluator persistence API

votelib.persist.from_dict(value)

Parse an election evaluator object from a JSON-like dictionary.

Parameters

value (Dict[str, Any]) – A dictionary created by to_dict().

Return type

Any

votelib.persist.to_dict(obj)

Serialize an election evaluator object to a JSON-ready dictionary.

Parameters

obj (Any) – An election evaluator object or similar. It should provide a to_dict() method (all the standard evaluators, converters and the like from Votelib should have it, courtesy of the simple_serialization decorator).

Return type

Dict[str, Any]