Add invoke as task runner, ruff and fix mypy errors

This commit is contained in:
2026-02-22 18:33:59 +03:00
parent 527ca62cb2
commit d6be9fbfb8
9 changed files with 187 additions and 17 deletions

View File

@@ -39,11 +39,11 @@ TERMINAL = "aws4_request"
VERSION = 0x04
def sign(key, msg):
def sign(key: bytes, msg: str) -> bytes:
return hmac.new(key, msg.encode("utf-8"), hashlib.sha256).digest()
def calculate_key(secret_access_key):
def calculate_key(secret_access_key: str) -> str:
signature = sign(("AWS4" + secret_access_key).encode("utf-8"), DATE)
signature = sign(signature, REGION)
signature = sign(signature, SERVICE)
@@ -54,7 +54,7 @@ def calculate_key(secret_access_key):
return smtp_password.decode("utf-8")
def main():
def main() -> None:
if sys.version_info[0] < 3:
raise Exception("Must be using Python 3")