Add invoke as task runner, ruff and fix mypy errors
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@ import sys
|
||||
from email.message import EmailMessage
|
||||
|
||||
|
||||
def send_test_email(login, password, to_email):
|
||||
def send_test_email(login: str, password: str, to_email: str) -> None:
|
||||
"""Отправляет тестовое email через Yandex Cloud Postbox SMTP"""
|
||||
|
||||
# initialize connection to our email server
|
||||
smtp = smtplib.SMTP("postbox.cloud.yandex.net", port="587")
|
||||
smtp = smtplib.SMTP("postbox.cloud.yandex.net", port=587)
|
||||
|
||||
smtp.set_debuglevel(2)
|
||||
|
||||
@@ -43,7 +43,7 @@ def send_test_email(login, password, to_email):
|
||||
print(f"Test email successfully sent to {to_email}")
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Send a test email via Yandex Cloud Postbox SMTP server."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user