1
0
Fork 0
mirror of synced 2024-06-01 15:01:10 -04:00
dotbot/dotbot/util/singleton.py
2015-04-25 02:16:10 +03:00

9 lines
256 B
Python

class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(
Singleton, cls).__call__(*args, **kwargs)
return cls._instances[cls]