From 6035c1c11dad8d13dded75ff3fd26d35391ee761 Mon Sep 17 00:00:00 2001 From: Eiko Wagenknecht Date: Sun, 15 Oct 2023 15:35:53 +0200 Subject: [PATCH] Fix return types Signed-off-by: Eiko Wagenknecht --- src/lootscraper/database.py | 4 ++-- src/lootscraper/telegrambot.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lootscraper/database.py b/src/lootscraper/database.py index 9572181..7915a50 100644 --- a/src/lootscraper/database.py +++ b/src/lootscraper/database.py @@ -3,7 +3,7 @@ import logging from datetime import datetime, timedelta, timezone from pathlib import Path -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Self import sqlalchemy as sa from alembic import command @@ -282,7 +282,7 @@ def __init__(self: LootDatabase, echo: bool = False) -> None: self.Session = scoped_session(session_factory) # TODO: Can this be changed with SQLAlchemy 2.0 and the removal of threaded execution? - def __enter__(self: LootDatabase) -> LootDatabase: + def __enter__(self: LootDatabase) -> Self: return self def __exit__( diff --git a/src/lootscraper/telegrambot.py b/src/lootscraper/telegrambot.py index c3ab1e9..92426d8 100644 --- a/src/lootscraper/telegrambot.py +++ b/src/lootscraper/telegrambot.py @@ -6,7 +6,7 @@ import traceback from datetime import datetime, timedelta, timezone from http.client import RemoteDisconnected -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Self import humanize import sqlalchemy as sa @@ -101,7 +101,7 @@ def __init__( self.Session = scoped_session self.application: Application | None = None # type: ignore - async def __aenter__(self: TelegramBot) -> TelegramBot: + async def __aenter__(self: TelegramBot) -> Self: try: await self.start() except TelegramError: