Skip to content

Commit

Permalink
style: format code with Black and PHP CS Fixer
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in a20fe85 according to the output
from Black and PHP CS Fixer.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored Dec 2, 2024
1 parent a20fe85 commit dc68054
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
26 changes: 16 additions & 10 deletions pulse_xmpp_agent/connectionagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@

logger = logging.getLogger()


class MUCBot(ClientXMPP):
"""
MUCBot class inherits from ClientXMPP and handles XMPP connections and messages.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -906,15 +909,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()
Expand Down Expand Up @@ -1013,6 +1015,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.
Expand Down Expand Up @@ -1054,6 +1057,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.
Expand Down Expand Up @@ -1174,8 +1178,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()
Expand All @@ -1189,6 +1194,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")
Expand Down
7 changes: 4 additions & 3 deletions pulse_xmpp_agent/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4050,7 +4050,6 @@ def get_relayserver_reversessh_idrsa(username="reversessh"):
return file_get_contents(idrsa_key_path)



class geolocalisation_agent:
def __init__(
self,
Expand Down Expand Up @@ -4233,7 +4232,7 @@ def searchgeolocalisation(http_url_list_geo_server):
return objet
"""
serveur = ""
objip=None
objip = None
for url in http_url_list_geo_server:
serveur = url
try:
Expand All @@ -4244,7 +4243,9 @@ def searchgeolocalisation(http_url_list_geo_server):
except BaseException:
pass
if objip is not None:
logger.debug(f"geolocalisation serveur {serveur} {json.dumps(objip, indent=4)}")
logger.debug(
f"geolocalisation serveur {serveur} {json.dumps(objip, indent=4)}"
)
return objip


Expand Down

0 comments on commit dc68054

Please sign in to comment.