From 47b5f7ca73ebd0b69716a706e0474ad425d4b0d0 Mon Sep 17 00:00:00 2001 From: Bastien Le Querrec <blq@laquadrature.net> Date: Mon, 11 Nov 2024 20:18:11 +0100 Subject: [PATCH] lint --- Attrap_bot.py | 26 +++++++++++++------------- cli.py | 2 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Attrap_bot.py b/Attrap_bot.py index ad7237b..1bdd32a 100644 --- a/Attrap_bot.py +++ b/Attrap_bot.py @@ -209,18 +209,18 @@ class Attrap_bot: def get_smtp_sender(self, config_id): if self.config.get('smtp'): - if self.config['smtp'].get(config_id) and self.config['smtp'][config_id]['hostname']: - smtp_sender = Attrap_bot.SMTP_sender(self.config['smtp'][config_id]['hostname']) - if self.config['smtp'][config_id].get('username'): - smtp_sender.set_username(self.config['smtp'][config_id]['username']) - if self.config['smtp'][config_id].get('password'): - smtp_sender.set_password(self.config['smtp'][config_id]['password']) - if self.config['smtp'][config_id].get('port'): - smtp_sender.set_port(self.config['smtp'][config_id]['port']) - if self.config['smtp'][config_id].get('ssl'): - smtp_sender.set_ssl(self.config['smtp'][config_id]['ssl']) - if self.config['smtp'][config_id].get('starttls'): - smtp_sender.set_starttls(self.config['smtp'][config_id]['starttls']) - return smtp_sender + if self.config['smtp'].get(config_id) and self.config['smtp'][config_id]['hostname']: + smtp_sender = Attrap_bot.SMTP_sender(self.config['smtp'][config_id]['hostname']) + if self.config['smtp'][config_id].get('username'): + smtp_sender.set_username(self.config['smtp'][config_id]['username']) + if self.config['smtp'][config_id].get('password'): + smtp_sender.set_password(self.config['smtp'][config_id]['password']) + if self.config['smtp'][config_id].get('port'): + smtp_sender.set_port(self.config['smtp'][config_id]['port']) + if self.config['smtp'][config_id].get('ssl'): + smtp_sender.set_ssl(self.config['smtp'][config_id]['ssl']) + if self.config['smtp'][config_id].get('starttls'): + smtp_sender.set_starttls(self.config['smtp'][config_id]['starttls']) + return smtp_sender logger.warning(f"La configuration Mastodon est invalide (id: {config_id})") return None diff --git a/cli.py b/cli.py index d562c04..9baca1d 100755 --- a/cli.py +++ b/cli.py @@ -25,6 +25,7 @@ def create_config(keys, value): else: return {keys[-1]: value} + def merge_dicts(a: dict, b: dict, path=[]): for key in b: if key in a: @@ -36,6 +37,7 @@ def merge_dicts(a: dict, b: dict, path=[]): a[key] = b[key] return a + parser = argparse.ArgumentParser( prog='cli.py', description='Recherche les derniers RAA correspondant à une certaine requête et envoie les résultats par email et sur Mastodon' -- GitLab