helpers

ntc_rosetta.helpers.json_helpers.query(query: str, data: Dict[str, Any], force_list: bool = False, default: Optional[Any] = None) → Any

Query a nested dictionary using jmespath <http://jmespath.org>

Parameters:
  • query – jmespath query
  • data – data to query
  • force_list – return a list even if the object is not a list
  • default – return this if the query returns None
ntc_rosetta.helpers.xml_helpers.find_or_create(root: lxml.etree.Element, xpath: str) → lxml.etree.Element

Return a subelement or create if it doesn’t exist.

Parameters:
  • root – Root of the object
  • xpath – xpath to apply to the root object