Forked from https://bitbucket.org/AlekseevAV/noolite-mtrf-to-mqtt/
[mqtt-noolite.git] / nmd / utils.py
1 class Singleton(type):
2     _instances = {}
3
4     def __call__(cls, *args, **kwargs):
5         if cls not in cls._instances:
6             cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
7         return cls._instances[cls]