From 2deb1b2bd5dc2680dbed71e9b71a9f07703fe149 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:32:04 +0000 Subject: [PATCH] style: format code with Black and PHP CS Fixer This commit fixes the style issues introduced in 7abbf80 according to the output from Black and PHP CS Fixer. Details: None --- pulse_xmpp_agent/connectionagent.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pulse_xmpp_agent/connectionagent.py b/pulse_xmpp_agent/connectionagent.py index 583e36e0..205dd19e 100755 --- a/pulse_xmpp_agent/connectionagent.py +++ b/pulse_xmpp_agent/connectionagent.py @@ -98,6 +98,7 @@ logger = logging.getLogger() + class MUCBot(ClientXMPP): """ MUCBot class inherits from ClientXMPP and handles XMPP connections and messages. @@ -187,9 +188,9 @@ def __init__(self, conf): # Planification d'un événement pour gérer le dépassement du délai self.schedule( "assessor_response_timeout_event", # Nom de l'événement - self.assessor_response_timeout, # Délai en secondes + self.assessor_response_timeout, # Délai en secondes self.handle_assessor_timeout, # Fonction appelée en cas de timeout - repeat=False # L'événement ne se répète pas + repeat=False, # L'événement ne se répète pas ) if self.config.syncthing_on: @@ -281,7 +282,9 @@ def handle_assessor_timeout(self): """ Handle the timeout event for the assessor response. """ - logger.error(f"Assessor timeout: No response within {self.assessor_response_timeout} seconds.") + logger.error( + f"Assessor timeout: No response within {self.assessor_response_timeout} seconds." + ) self.disconnect(wait=1) def stream_error1(self, mesg): @@ -904,15 +907,14 @@ async def register(self, iq): iq: The IQ stanza. """ resp = self.Iq() - resp['type'] = 'set' - resp['register']['username'] = self.boundjid.user - resp['register']['password'] = self.password + resp["type"] = "set" + resp["register"]["username"] = self.boundjid.user + resp["register"]["password"] = self.password try: await resp.send() logging.info("Account created for %s!" % self.boundjid) except IqError as e: - logging.debug("Could not register account: %s" % - e.iq['error']['text']) + logging.debug("Could not register account: %s" % e.iq["error"]["text"]) except IqTimeout: logging.error("Could not register account No response from server.") self.disconnect() @@ -1011,6 +1013,7 @@ def _errorhandlingstanza(self, msg, msgfrom, msgkey): # ---------------------- END analyse strophe xmpp ----------------------- # ----------------------------------------------------------------------- + def createDaemon(optstypemachine, optsconsoledebug, optsdeamon, tglevellog, tglogfile): """ Create a service/Daemon that will execute a det. task. @@ -1052,6 +1055,7 @@ def createDaemon(optstypemachine, optsconsoledebug, optsdeamon, tglevellog, tglo logger.error("\n%s" % (traceback.format_exc())) os._exit(1) + def doTask(optstypemachine, optsconsoledebug, optsdeamon, tglevellog, tglogfile): """ Execute the task. @@ -1172,8 +1176,9 @@ def doTask(optstypemachine, optsconsoledebug, optsdeamon, tglevellog, tglogfile) logging.error("RuntimeError during connection") finally: logger.debug("bye bye connecteur") - namefilebool = os.path.join(os.path.dirname(os.path.realpath(__file__)), - "BOOLCONNECTOR") + namefilebool = os.path.join( + os.path.dirname(os.path.realpath(__file__)), "BOOLCONNECTOR" + ) fichier = open(namefilebool, "w") fichier.close() # xmpp.loop.close() @@ -1187,6 +1192,7 @@ def doTask(optstypemachine, optsconsoledebug, optsdeamon, tglevellog, tglogfile) ) sys.exit(1) # Quitte le programme avec un code d'erreur + if __name__ == "__main__": if sys.platform.startswith("linux") and os.getuid() != 0: logging.error("Agent must be running as root")