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

#15

parent f8924b66
No related branches found
No related tags found
No related merge requests found
# coding=UTF-8
from __future__ import print_function, absolute_import, division
import functools
import six
__all__ = [
'Singleton',
]
if six.PY3:
......@@ -22,7 +27,7 @@ if six.PY3:
@functools.wraps(cls.__new__)
def singleton_new(cls, *args, **kw):
it = cls.__dict__.get('__it__')
it = cls.__dict__.get('__it__')
if it is not None:
return it
......@@ -52,6 +57,7 @@ else:
self._instance = self.__wrapped__(*args, **kwargs)
return self._instance
# taken from https://pypi.python.org/pypi/singleton-decorator/1.0.0
def Singleton(cls):
"""
......
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