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

@@ -4,6 +4,7 @@ Backup script for all applications
Automatically discovers and runs backup scripts for all users,
then creates restic backups and sends notifications.
"""
import itertools
import os
import sys
@@ -153,7 +154,7 @@ class ResticStorage(Storage):
class Notifier(ABC):
def send(self, html_message: str):
def send(self, html_message: str) -> None:
raise NotImplementedError()
@@ -174,7 +175,7 @@ class TelegramNotifier(Notifier):
f"Missing notification configuration values for backend {name}"
)
def send(self, html_message: str):
def send(self, html_message: str) -> None:
url = f"https://api.telegram.org/bot{self.telegram_bot_token}/sendMessage"
data = {
"chat_id": self.telegram_chat_id,
@@ -358,10 +359,10 @@ class BackupManager:
)
if self.warnings:
message += f"\n\n⚠️ Предупреждения:\n" + "\n".join(self.warnings)
message += "\n\n⚠️ Предупреждения:\n" + "\n".join(self.warnings)
if self.errors:
message += f"\n\n❌ Ошибки:\n" + "\n".join(self.errors)
message += "\n\n❌ Ошибки:\n" + "\n".join(self.errors)
for notificator in self.notifiers:
try:
@@ -470,7 +471,7 @@ def initialize(config_path: Path) -> BackupManager:
)
def main():
def main() -> None:
try:
backup_manager = initialize(CONFIG_PATH)
success = backup_manager.run_backup_process()