Mercurial > libervia-backend
diff libervia/backend/plugins/plugin_exp_command_export.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 4b842c1fb686 |
children |
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_exp_command_export.py Tue Jun 18 12:06:45 2024 +0200 +++ b/libervia/backend/plugins/plugin_exp_command_export.py Wed Jun 19 18:44:57 2024 +0200 @@ -41,7 +41,7 @@ class ExportCommandProtocol(protocol.ProcessProtocol): - """ Try to register an account with prosody """ + """Try to register an account with prosody""" def __init__(self, parent, client, target, options): self.parent = parent @@ -73,10 +73,10 @@ self.transport.write(message.encode("utf-8")) def bool_option(self, key): - """ Get boolean value from options + """Get boolean value from options @param key: name of the option @return: True if key exists and set to "true" (case insensitive), - False in all other cases """ + False in all other cases""" value = self.options.get(key, "") return value.lower() == "true" @@ -92,7 +92,9 @@ log.info(_("Plugin command export initialization")) self.host = host self.spawned = {} # key = entity - host.trigger.add("message_received", self.message_received_trigger, priority=10000) + host.trigger.add( + "message_received", self.message_received_trigger, priority=10000 + ) host.bridge.add_method( "command_export", ".plugin", @@ -102,19 +104,19 @@ ) def removeProcess(self, entity, process): - """ Called when the process is finished + """Called when the process is finished @param entity: jid.JID attached to the process @param process: process to remove""" try: processes_set = self.spawned[(entity, process.client.profile)] processes_set.discard(process) if not processes_set: - del (self.spawned[(entity, process.client.profile)]) + del self.spawned[(entity, process.client.profile)] except ValueError: pass def message_received_trigger(self, client, message_elt, post_treat): - """ Check if source is linked and repeat message, else do nothing """ + """Check if source is linked and repeat message, else do nothing""" from_jid = jid.JID(message_elt["from"]) spawned_key = (from_jid.userhostJID(), client.profile) @@ -140,7 +142,7 @@ return True def _export_command(self, command, args, targets, options, profile_key): - """ Export a commands to authorised targets + """Export a commands to authorised targets @param command: full path of the command to execute @param args: list of arguments, with command name as first one @param targets: list of allowed entities