Code cleanup

This commit is contained in:
2020-03-01 21:46:35 +01:00
parent 567e41362b
commit 65d5dcf137
7 changed files with 180 additions and 129 deletions

View File

@@ -20,11 +20,10 @@ import logging.handlers
import sys
import time
from email.header import decode_header
from pyquarantine import QuarantineMilter, setup_milter
from pyquarantine.version import __version__ as version
def _get_quarantine(quarantines, name):
try:
quarantine = next((q for q in quarantines if q.name == name))
@@ -32,6 +31,7 @@ def _get_quarantine(quarantines, name):
raise RuntimeError(f"invalid quarantine 'name'")
return quarantine
def _get_storage(quarantines, name):
quarantine = _get_quarantine(quarantines, name)
storage = quarantine.get_storage()
@@ -40,6 +40,7 @@ def _get_storage(quarantines, name):
"storage type is set to NONE")
return storage
def _get_notification(quarantines, name):
quarantine = _get_quarantine(quarantines, name)
notification = quarantine.get_notification()
@@ -48,6 +49,7 @@ def _get_notification(quarantines, name):
"notification type is set to NONE")
return notification
def _get_whitelist(quarantines, name):
quarantine = _get_quarantine(quarantines, name)
whitelist = quarantine.get_whitelist()
@@ -56,6 +58,7 @@ def _get_whitelist(quarantines, name):
"whitelist type is set to NONE")
return whitelist
def print_table(columns, rows):
if not rows:
return