mirror of
https://gitflic.ru/project/maks1ms/ocab.git
synced 2025-03-14 06:13:49 +03:00
20 lines
481 B
Python
20 lines
481 B
Python
from aiogram import Dispatcher
|
|
|
|
from ocab_core.modules_system import ModulesManager
|
|
|
|
|
|
class SingletonMeta(type):
|
|
_instances = {}
|
|
|
|
def __call__(cls, *args, **kwargs):
|
|
if cls not in cls._instances:
|
|
instance = super().__call__(*args, **kwargs)
|
|
cls._instances[cls] = instance
|
|
return cls._instances[cls]
|
|
|
|
|
|
class Singleton(metaclass=SingletonMeta):
|
|
dp: Dispatcher = None
|
|
modules_manager: ModulesManager = None
|
|
storage = dict()
|