Skip to content
Snippets Groups Projects
Commit 22a5005c authored by me5na7qbjqbrp's avatar me5na7qbjqbrp
Browse files

A bit of linting

parent c7d953bd
No related branches found
No related tags found
No related merge requests found
Pipeline #4051 passed with warnings with stages
in 4 minutes and 45 seconds
...@@ -19,4 +19,6 @@ if platform.uname().system == 'Linux': ...@@ -19,4 +19,6 @@ if platform.uname().system == 'Linux':
gettext.textdomain('messages') gettext.textdomain('messages')
_ = gettext.gettext _ = gettext.gettext
else: else:
_ = lambda s: s # Do not support translation under MacOS and Windows
def _(s):
return s
...@@ -12,7 +12,6 @@ import base64 ...@@ -12,7 +12,6 @@ import base64
import json import json
import logging import logging
import re import re
from configparser import ConfigParser
from functools import lru_cache from functools import lru_cache
from getpass import getpass, getuser from getpass import getpass, getuser
from hashlib import sha1, sha256 from hashlib import sha1, sha256
...@@ -130,7 +129,7 @@ def create_ssh_client(host, password=None): ...@@ -130,7 +129,7 @@ def create_ssh_client(host, password=None):
m = include_regex.match(line) m = include_regex.match(line)
if m: if m:
config_files.append(Path(m.group(1))) config_files.append(Path(m.group(1)))
username=None username = None
for conf in config_files: for conf in config_files:
try: try:
config = SSHConfig() config = SSHConfig()
......
...@@ -108,6 +108,7 @@ class ServerCommand(object): ...@@ -108,6 +108,7 @@ class ServerCommand(object):
self.decorated = fun self.decorated = fun
return fun return fun
# Fonction exposées par le serveur # Fonction exposées par le serveur
@ServerCommand('keep-alive') @ServerCommand('keep-alive')
def keepalive(): def keepalive():
...@@ -190,7 +191,7 @@ def restorefiles(): ...@@ -190,7 +191,7 @@ def restorefiles():
line_dict = json.loads(line) line_dict = json.loads(line)
if ('-----BEGIN PGP MESSAGE-----' in line_dict["contents"]): if ('-----BEGIN PGP MESSAGE-----' in line_dict["contents"]):
backup = line backup = line
except: except Exception:
pass pass
line = f.readline() line = f.readline()
if not (backup == ''): if not (backup == ''):
...@@ -315,7 +316,8 @@ def _list_to_replicate(data): ...@@ -315,7 +316,8 @@ def _list_to_replicate(data):
servers = getattr(serverconfig, 'BACKUP_SERVERS', {}) servers = getattr(serverconfig, 'BACKUP_SERVERS', {})
configs = set(name for role in roles for name in backups.get(role, [])) configs = set(name for role in roles for name in backups.get(role, []))
return [clientlib.Client(servers[name]) for name in configs] #return [clientlib.Client(servers[name]) for name in configs]
return [] # FIXME
_notif_todo = [] _notif_todo = []
...@@ -337,7 +339,7 @@ def notification_mail(notifications): ...@@ -337,7 +339,7 @@ def notification_mail(notifications):
hostname = socket.gethostname() hostname = socket.gethostname()
msg['From'] = f"{ serverconfig.FROM_MAIL }" msg['From'] = f"{ serverconfig.FROM_MAIL }"
msg['To'] = f"{ serverconfig.TO_MAIL }" msg['To'] = f"{ serverconfig.TO_MAIL }"
msg['Subject'] = "Modification de la base (%s)" % ', '.join(actions) msg['Subject'] = "Modification de la base ({})".format(', '.join(actions))
msg['X-Mailer'] = f"{ serverconfig.cmd_name }" msg['X-Mailer'] = f"{ serverconfig.cmd_name }"
msg.set_content( msg.set_content(
f"Des modifications ont été faites:\r\n" f"Des modifications ont été faites:\r\n"
......
...@@ -31,7 +31,7 @@ exclude = ...@@ -31,7 +31,7 @@ exclude =
.cache, .cache,
.eggs, .eggs,
*migrations* *migrations*
max-complexity = 10 max-complexity = 15
max-line-length = 160 max-line-length = 160
import-order-style = pep8 import-order-style = pep8
application-import-names = flake8 application-import-names = flake8
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment