Beispiel #1
0
 async def cli_evaluate(
         self, graph: str, command: str,
         **env: str) -> List[Tuple[ParsedCommands, List[AccessJson]]]:
     props = {"graph": graph, "section": "reported", **env}
     async with self.session.post(self.base_path + f"/cli/evaluate",
                                  data=command,
                                  params=props) as r:
         if r.status == 200:
             return [(
                 ParsedCommands(
                     from_js(json["parsed"], List[ParsedCommand]),
                     json["env"]),
                 AccessJson.wrap(json["execute"]),
             ) for json in await r.json()]
         else:
             raise AttributeError(await r.text())
Beispiel #2
0
 def format_object(obj: Any) -> str:
     return formatter.format_map(
         AccessJson.wrap(obj, "null", render_simple_property))