def __call__(cls, *args, **kwargs):
        # type: (*Any, **Any) -> type
        """Instantiate the class only once."""
        if not cls.__instance__:
            cls.__instance__ = super(Singleton, cls).__call__(*args, **kwargs)
        else:
            try:
                cls.__instance__.__singleton__(*args, **kwargs)  # type: ignore
            except (AttributeError, TypeError):
                pass
        return cls.__instance__
def __call__ ( cls , * args , ** kwargs ) : if not cls . __instance__ : cls . __instance__ = super ( Singleton , cls ) . __call__ ( * args , ** kwargs ) else : try : cls . __instance__ . __singleton__ ( * args , ** kwargs ) except ( AttributeError , TypeError ) : pass return cls . __instance__
Instantiate the class only once.