Skip to content
Snippets Groups Projects
Commit b553d657 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

slight fix

parent d4061962
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,6 @@ __all__ = [ ...@@ -5,7 +5,6 @@ __all__ = [
] ]
# Taken from https://wiki.python.org/moin/PythonDecoratorLibrary
def Singleton(cls): def Singleton(cls):
""" """
Make a singleton out of decorated class. Make a singleton out of decorated class.
...@@ -31,7 +30,8 @@ def Singleton(cls): ...@@ -31,7 +30,8 @@ def Singleton(cls):
cls.__new__ = singleton_new cls.__new__ = singleton_new
cls.__init_old__ = cls.__init__ cls.__init_old__ = cls.__init__
cls.__init__ = lambda self, *args, **kwargs: object.__init__(self) cls.__init__ = functools.wraps(cls.__init__)(
lambda self, *args, **kwargs: object.__init__(self))
return cls return cls
...@@ -70,7 +70,9 @@ def SingletonWithRegardsTo(num_args: int): ...@@ -70,7 +70,9 @@ def SingletonWithRegardsTo(num_args: int):
cls.__new__ = singleton_new cls.__new__ = singleton_new
cls.__init_old__ = cls.__init__ cls.__init_old__ = cls.__init__
cls.__init__ = lambda self, *args, **kwargs: object.__init__(self) cls.__init__ = functools.wraps(cls.__init__)(
lambda self, *args, **kwargs: object.__init__(self))
return cls return cls
return inner return inner
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment