Improve code quality
This commit is contained in:
parent
467060e491
commit
8b132a71b3
4 changed files with 6 additions and 35 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -72,3 +72,4 @@ config-dev.ini
|
||||||
.python-version
|
.python-version
|
||||||
stacosys.sublime-project
|
stacosys.sublime-project
|
||||||
stacosys.sublime-workspace
|
stacosys.sublime-workspace
|
||||||
|
out/
|
|
@ -8,9 +8,11 @@ class Messages:
|
||||||
|
|
||||||
def load_messages(self, lang):
|
def load_messages(self, lang):
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(os.path.join(os.path.dirname(__file__), 'messages_' + lang + '.properties'))
|
config.read(
|
||||||
|
os.path.join(os.path.dirname(__file__), "messages_" + lang + ".properties")
|
||||||
|
)
|
||||||
|
|
||||||
for key, value in config.items('messages'):
|
for key, value in config.items("messages"):
|
||||||
self.property_dict[key] = value
|
self.property_dict[key] = value
|
||||||
|
|
||||||
def get(self, key):
|
def get(self, key):
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: UTF-8 -*-
|
|
||||||
|
|
||||||
from dataclasses import dataclass
|
|
||||||
from datetime import datetime
|
|
||||||
from typing import List
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class Part:
|
|
||||||
content: str
|
|
||||||
content_type: str
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class Attachment:
|
|
||||||
filename: str
|
|
||||||
content: str
|
|
||||||
content_type: str
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class Email:
|
|
||||||
id: int
|
|
||||||
encoding: str
|
|
||||||
date: datetime
|
|
||||||
from_addr: str
|
|
||||||
to_addr: str
|
|
||||||
subject: str
|
|
||||||
parts: List[Part]
|
|
||||||
attachments: List[Attachment]
|
|
||||||
plain_text_content: str
|
|
|
@ -101,5 +101,5 @@ if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
main(args.config)
|
main(args.config)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Failed to start application: {e}")
|
logging.error("Failed to start application: %s", e)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue