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