Allow multiple instances of @PlatformIO

This commit is contained in:
Ivan Kravets
2015-09-03 19:04:09 +03:00
parent 25c448627e
commit 0d8d5fdb32
9 changed files with 173 additions and 111 deletions

View File

@@ -100,6 +100,17 @@ class memoized(object):
return functools.partial(self.__call__, obj)
def singleton(cls):
""" From PEP-318 http://www.python.org/dev/peps/pep-0318/#examples """
_instances = {}
def get_instance(*args, **kwargs):
if cls not in _instances:
_instances[cls] = cls(*args, **kwargs)
return _instances[cls]
return get_instance
def get_systype():
data = uname()
systype = data[0]