Reformatted code base using black.
This commit is contained in:
parent
56319cbad3
commit
53fdaa9d09
1 changed files with 12604 additions and 8966 deletions
|
|
@ -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 @@ def etree_parse(cmd, raw_xml, reraise=False):
|
|||
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 @@ def get_payload(cmd, element):
|
|||
"""
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue