Coverage for src / dotbot / util / singleton.py: 78%
9 statements
« prev ^ index » next coverage.py v7.12.0, created at 2025-11-29 10:55 -0800
« prev ^ index » next coverage.py v7.12.0, created at 2025-11-29 10:55 -0800
1from typing import Any
4class Singleton(type):
5 def __call__(cls, *args: Any, **kwargs: Any) -> Any:
6 if not hasattr(cls, "_singleton_instance"):
7 cls._singleton_instance = super().__call__(*args, **kwargs)
8 return cls._singleton_instance
10 def reset_instance(cls) -> None:
11 if hasattr(cls, "_singleton_instance"):
12 del cls._singleton_instance