from events import PATH_CREATED_EVENT, path_created from events.WebhookEventHandlers import auto_instantiate from events.WebhookEventHandlers.PathWebhookEventHandlers import PathWebhookEventHandler from misc import Singleton @auto_instantiate class PathCreatedWebhookEventHandler(PathWebhookEventHandler,Singleton): _instance = None def __new__(cls, *args, **kwargs): if cls._instance is None: cls._instance = super(PathCreatedWebhookEventHandler, cls).__new__(cls) return cls._instance def __init__(self): if getattr(self, "_initialized", False): return super().__init__(PATH_CREATED_EVENT) path_created.connect(self) self._initialized = True