Reformatted code base using black.

This commit is contained in:
Goffi 2024-06-19 18:44:57 +02:00
commit 53fdaa9d09

View file

@ -151,7 +151,7 @@ class TextCommands(object):
return data
def register_text_commands(self, instance):
""" Add a text command
"""Add a text command
@param instance: instance of a class containing text commands
"""
@ -196,12 +196,12 @@ class TextCommands(object):
def send_message_trigger(
self, client, mess_data, pre_xml_treatments, post_xml_treatments
):
"""Install SendMessage command hook """
"""Install SendMessage command hook"""
pre_xml_treatments.addCallback(self._send_message_cmd_hook, client)
return True
def _send_message_cmd_hook(self, mess_data, client):
""" Check text commands in message, and react consequently
"""Check text commands in message, and react consequently
msg starting with / are potential command. If a command is found, it is executed,
else an help message is sent.
@ -248,7 +248,7 @@ class TextCommands(object):
# looks like an actual command, we try to call the corresponding method
def ret_handling(ret):
""" Handle command return value:
"""Handle command return value:
if ret is True, normally send message (possibly modified by command)
else, abord message sending
"""
@ -381,9 +381,7 @@ class TextCommands(object):
d = defer.succeed(None)
for __, callback in self._whois:
d.addCallback(
lambda __: callback(client, whois_msg, mess_data, target_jid)
)
d.addCallback(lambda __: callback(client, whois_msg, mess_data, target_jid))
def feed_back(__):
self.feed_back(client, "\n".join(whois_msg), mess_data)
@ -464,7 +462,10 @@ class TextCommands(object):
short_help=cmd_data["doc_short_help"],
syntax=_(" " * 4 + "syntax: {}\n").format(syntax) if syntax else "",
args_help="\n".join(
[" " * 8 + "{}".format(line) for line in self._get_args_help(cmd_data)]
[
" " * 8 + "{}".format(line)
for line in self._get_args_help(cmd_data)
]
),
)