add mypy tool
This commit is contained in:
parent
75ee7acb6d
commit
5efc3dd330
4 changed files with 99 additions and 10 deletions
|
|
@ -7,11 +7,21 @@ from stacosys.interface import app
|
|||
|
||||
class JobConfig(object):
|
||||
|
||||
JOBS = []
|
||||
JOBS: list = []
|
||||
|
||||
SCHEDULER_EXECUTORS = {"default": {"type": "threadpool", "max_workers": 4}}
|
||||
|
||||
def __init__(self, imap_polling_seconds, new_comment_polling_seconds, lang, site_name, site_token, site_admin_email, mailer, rss):
|
||||
def __init__(
|
||||
self,
|
||||
imap_polling_seconds,
|
||||
new_comment_polling_seconds,
|
||||
lang,
|
||||
site_name,
|
||||
site_token,
|
||||
site_admin_email,
|
||||
mailer,
|
||||
rss,
|
||||
):
|
||||
self.JOBS = [
|
||||
{
|
||||
"id": "fetch_mail",
|
||||
|
|
@ -30,8 +40,28 @@ class JobConfig(object):
|
|||
]
|
||||
|
||||
|
||||
def configure(imap_polling, comment_polling, lang, site_name, site_token, site_admin_email, mailer, rss):
|
||||
app.config.from_object(JobConfig(imap_polling, comment_polling, lang, site_name, site_token, site_admin_email, mailer, rss))
|
||||
def configure(
|
||||
imap_polling,
|
||||
comment_polling,
|
||||
lang,
|
||||
site_name,
|
||||
site_token,
|
||||
site_admin_email,
|
||||
mailer,
|
||||
rss,
|
||||
):
|
||||
app.config.from_object(
|
||||
JobConfig(
|
||||
imap_polling,
|
||||
comment_polling,
|
||||
lang,
|
||||
site_name,
|
||||
site_token,
|
||||
site_admin_email,
|
||||
mailer,
|
||||
rss,
|
||||
)
|
||||
)
|
||||
scheduler = APScheduler()
|
||||
scheduler.init_app(app)
|
||||
scheduler.start()
|
||||
|
|
|
|||
|
|
@ -2,26 +2,27 @@
|
|||
# -*- coding: UTF-8 -*-
|
||||
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
|
||||
|
||||
class Part():
|
||||
class Part:
|
||||
content: str
|
||||
content_type: str
|
||||
|
||||
|
||||
class Attachment():
|
||||
class Attachment:
|
||||
filename: str
|
||||
content: str
|
||||
content_type: str
|
||||
|
||||
|
||||
class Email():
|
||||
class Email:
|
||||
id: int
|
||||
encoding: str
|
||||
date: datetime
|
||||
from_addr: str
|
||||
to_addr: str
|
||||
subject: str
|
||||
parts: list[Part]
|
||||
attachments: list[Attachment]
|
||||
parts: List[Part]
|
||||
attachments: List[Attachment]
|
||||
plain_text_content: str
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue