#!/usr/bin/env python """ Singleton meta module """ __author__ = "@tormakris" __copyright__ = "Copyright 2020, GoldenPogácsa Team" __module_name__ = "singleton" __version__text__ = "1" class Singleton(object): """ Singleton metaclass """ _instances = {} def __new__(class_, *args, **kwargs): """ New :param args: :param kwargs: :return: """ if class_ not in class_._instances: class_._instances[class_] = super( Singleton, class_).__new__( class_, *args, **kwargs) return class_._instances[class_]