Mercurial > libervia-backend
diff libervia/cli/xml_tools.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 47401850dec6 |
children |
line wrap: on
line diff
--- a/libervia/cli/xml_tools.py Tue Jun 18 12:06:45 2024 +0200 +++ b/libervia/cli/xml_tools.py Wed Jun 19 18:44:57 2024 +0200 @@ -20,6 +20,7 @@ from libervia.backend.core.i18n import _ from libervia.cli.constants import Const as C + def etree_parse(cmd, raw_xml, reraise=False): """import lxml and parse raw XML @@ -46,11 +47,10 @@ except Exception as e: if reraise: raise e - cmd.parser.error( - _("Can't parse the payload XML in input: {msg}").format(msg=e) - ) + cmd.parser.error(_("Can't parse the payload XML in input: {msg}").format(msg=e)) return element, etree + def get_payload(cmd, element): """Retrieve payload element and exit with and error if not found @@ -59,8 +59,9 @@ """ if element.tag in ("item", "{http://jabber.org/protocol/pubsub}item"): if len(element) > 1: - cmd.disp(_("<item> can only have one child element (the payload)"), - error=True) + cmd.disp( + _("<item> can only have one child element (the payload)"), error=True + ) cmd.host.quit(C.EXIT_DATA_ERROR) element = element[0] return element