mirror of
https://github.com/283375/arcaea-offline.git
synced 2025-04-21 23:10:18 +00:00
13 lines
283 B
Python
13 lines
283 B
Python
from typing import Generic, TypeVar
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
class Singleton(type, Generic[T]):
|
|
_instance = None
|
|
|
|
def __call__(cls, *args, **kwargs) -> T:
|
|
if cls._instance is None:
|
|
cls._instance = super().__call__(*args, **kwargs)
|
|
return cls._instance
|