From da3680a83eee7df0000a525fc3625fa32c8d0a47 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 18 Feb 2023 14:45:51 +0100 Subject: [PATCH] Improved imports #130 --- kdb-bot/src/bot_core/abc/client_utils_abc.py | 5 +++-- kdb-bot/src/bot_data/model/user.py | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/kdb-bot/src/bot_core/abc/client_utils_abc.py b/kdb-bot/src/bot_core/abc/client_utils_abc.py index a8489080..022665c0 100644 --- a/kdb-bot/src/bot_core/abc/client_utils_abc.py +++ b/kdb-bot/src/bot_core/abc/client_utils_abc.py @@ -5,6 +5,7 @@ from typing import Callable from cpl_query.extension import List from discord.ext.commands import Context +from bot_data.model.user import User from modules.base.configuration.base_server_settings import BaseServerSettings @@ -49,12 +50,12 @@ class ClientUtilsABC(ABC): def is_message_xp_count_by_hour_higher_that_max_message_count_per_hour( self, created_at: datetime, - user: "User", + user: User, settings: BaseServerSettings, is_reaction: bool = False, ) -> bool: pass @abstractmethod - def get_ontime_for_user(self, user: "User") -> float: + def get_ontime_for_user(self, user: User) -> float: pass diff --git a/kdb-bot/src/bot_data/model/user.py b/kdb-bot/src/bot_data/model/user.py index f115df89..a9e8d437 100644 --- a/kdb-bot/src/bot_data/model/user.py +++ b/kdb-bot/src/bot_data/model/user.py @@ -5,7 +5,7 @@ from cpl_core.database import TableABC from cpl_core.dependency_injection import ServiceProviderABC from cpl_discord.service import DiscordBotServiceABC -from bot_core.abc.client_utils_abc import ClientUtilsABC +from bot_data.model.level import Level from bot_data.model.server import Server @@ -63,12 +63,15 @@ class User(TableABC): @property @ServiceProviderABC.inject - def ontime(self, client_utils: ClientUtilsABC) -> float: + def ontime(self, services: ServiceProviderABC) -> float: + from bot_core.abc.client_utils_abc import ClientUtilsABC + + client_utils: ClientUtilsABC = services.get_service(ClientUtilsABC) return client_utils.get_ontime_for_user(self) @property @ServiceProviderABC.inject - def level(self, services: ServiceProviderABC) -> "Level": + def level(self, services: ServiceProviderABC) -> Level: from modules.level.service.level_service import LevelService levels: LevelService = services.get_service(LevelService)