Merge pull request #1378 from YunoHost/ci-format-dev

[CI] Format code with Black
This commit is contained in:
Alexandre Aubin 2021-11-14 21:42:14 +01:00 committed by GitHub
commit 2d9bfdce2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View file

@ -210,7 +210,10 @@ class MailDiagnoser(Diagnoser):
# Do the DNS Query
status, answers = dig(query, "A")
if status != "ok" or (answers and set(answers) <= set(blacklist["non_blacklisted_return_code"])):
if status != "ok" or (
answers
and set(answers) <= set(blacklist["non_blacklisted_return_code"])
):
continue
# Try to get the reason

View file

@ -749,8 +749,12 @@ class OperationLogger(object):
# 72971 DEBUG 29739 + ynh_exit_properly
# which are lines from backup-before-upgrade or restore-after-failed-upgrade ...
filters = [re.compile(f_) for f_ in BORING_LOG_LINES]
filters.append(re.compile(r'\d+ \+ '))
lines = [line for line in lines if not any(filter_.search(line) for filter_ in filters)]
filters.append(re.compile(r"\d+ \+ "))
lines = [
line
for line in lines
if not any(filter_.search(line) for filter_ in filters)
]
lines_to_display = []
@ -758,7 +762,7 @@ class OperationLogger(object):
rev_lines = list(reversed(lines))
for i, line in enumerate(rev_lines):
if line.endswith("+ ynh_exit_properly"):
lines_to_display = reversed(rev_lines[i:i + 20])
lines_to_display = reversed(rev_lines[i : i + 20])
break
# If didnt find anything, just get the last 20 lines