Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kazet committed Feb 9, 2024
1 parent 2e50fd1 commit 331935a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.8.0
hooks:
- id: mypy
args: [--strict]
Expand All @@ -30,7 +30,7 @@ repos:
- types-redis==4.6.0.11
- types-requests==2.31.0.10
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
args: [.]
4 changes: 2 additions & 2 deletions app/src/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from .app_utils import get_from_and_dkim_domain, scan_and_log
from .check_results import save_check_results
from .db import ScanLogEntrySource, Session, ServerErrorLogEntry
from .db import ScanLogEntrySource, ServerErrorLogEntry, Session
from .logging import build_logger
from .resolver import setup_resolver

Expand Down Expand Up @@ -44,7 +44,7 @@ def scan_domain_job(
except (DomainValidationException, ScanningException) as e:
result = None
error = translate(e.message, Language(Config.UI.LANGUAGE))
except Exception as e:
except Exception:
session = Session()
server_error_log_entry = ServerErrorLogEntry(url="worker", error=traceback.format_exc())
session.add(server_error_log_entry)
Expand Down
16 changes: 9 additions & 7 deletions scan/libmailgoose/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,13 +592,15 @@ def scan(
dkim_domain=dkim_domain,
nameservers=nameservers,
),
dkim=scan_dkim(
message=message,
message_parsed=message_parsed,
dkim_implementation_mismatch_callback=dkim_implementation_mismatch_callback,
)
if message and message_parsed
else None,
dkim=(
scan_dkim(
message=message,
message_parsed=message_parsed,
dkim_implementation_mismatch_callback=dkim_implementation_mismatch_callback,
)
if message and message_parsed
else None
),
timestamp=datetime.datetime.now(),
message_timestamp=message_timestamp,
)
16 changes: 10 additions & 6 deletions scan/libmailgoose/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,12 +609,16 @@ def translate_scan_result(
nonexistent_translation_handler: Optional[Callable[[str], str]] = None,
) -> ScanResult:
return ScanResult(
domain=_translate_domain_result(scan_result.domain, language, nonexistent_translation_handler)
if scan_result.domain
else None,
dkim=_translate_dkim_result(scan_result.dkim, language, nonexistent_translation_handler)
if scan_result.dkim
else None,
domain=(
_translate_domain_result(scan_result.domain, language, nonexistent_translation_handler)
if scan_result.domain
else None
),
dkim=(
_translate_dkim_result(scan_result.dkim, language, nonexistent_translation_handler)
if scan_result.dkim
else None
),
timestamp=scan_result.timestamp,
message_timestamp=scan_result.message_timestamp,
)

0 comments on commit 331935a

Please sign in to comment.