remove unused email modules and fix pep

This commit is contained in:
Antonio J. Delgado 2025-03-27 09:45:40 +02:00
parent 5526801f30
commit 9541e148c7

View file

@ -14,8 +14,6 @@ import logging
from logging.handlers import SysLogHandler from logging.handlers import SysLogHandler
import imaplib import imaplib
import email import email
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import click import click
import click_config_file import click_config_file
@ -144,7 +142,19 @@ class BackupImap:
data = fetch_data[0][1] data = fetch_data[0][1]
subjects = self._get_mail_header('Subject', data) subjects = self._get_mail_header('Subject', data)
if len(subjects) > 0: if len(subjects) > 0:
subject = subjects[-1].replace(os.path.sep, '_').replace('\r', '_').replace('\n', '_').replace(':', '_') subject = subjects[-1].replace(
os.path.sep,
'_'
).replace(
'\r',
'_'
).replace(
'\n',
'_'
).replace(
':',
'_'
)
message_path = os.path.join( message_path = os.path.join(
mailbox_path, mailbox_path,
subject subject