linter &c

This commit is contained in:
2025-04-24 01:05:49 -07:00
parent 0b13bb3692
commit f453222bf7
5 changed files with 71 additions and 24 deletions

View File

@@ -1,17 +1,22 @@
#!/usr/bin/env python
from email.message import EmailMessage
import logging
import asyncio, ssl, email
from os import getenv
from imaplib import IMAP4
from logging import info, debug, error, warning
from pprint import pprint
from model import Transaction
from config import PARSERS
from parsers import TransactionParsingFailed
import asyncio
import email.policy
import logging
import os
import ssl
from email.message import EmailMessage
from imaplib import IMAP4
from logging import debug
from logging import error
from logging import info
from logging import warning
from os import getenv
from pprint import pprint
from typing import cast
from config import PARSERS
from model import Transaction
from parsers import TransactionParsingFailed
IMAP_SERVER = getenv("IMAP_SERVER")
IMAP_PORT = int(getenv("IMAP_PORT", 143))
@@ -32,7 +37,14 @@ async def ticker(interval: float):
async def submit_transaction(t: Transaction):
cmd=ACTUAL_PATH + f' -a "{t.account}"' + f' -p "{t.payee}"' + f' -m "{t.amount}"' + f' -d "{t.date}"' f' -n "{t.notes}"'
cmd = (
ACTUAL_PATH
+ f' -a "{t.account}"'
+ f' -p "{t.payee}"'
+ f' -m "{t.amount}"'
+ f' -d "{t.date}"'
f' -n "{t.notes}"'
)
debug("Actual command: %s", cmd)
proc = await asyncio.create_subprocess_shell(
cmd=cmd,
@@ -47,7 +59,9 @@ async def submit_transaction(t: Transaction):
async def process_message(msg_b: bytes):
debug("parsing message")
msg = email.message_from_bytes(msg_b, policy=email.policy.default)
msg = cast(
EmailMessage, email.message_from_bytes(msg_b, policy=email.policy.default)
)
pprint(msg)
info(
"Found message from %s to %s subject %s",