2 """
3 Singleton Metaclass.
4
5 Enforces any object using this metaclass to only create a single instance.
6
7 - External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Creational-Pattern-Usage}
8 - External Singleton Pattern documentation: U{https://en.wikipedia.org/wiki/Singleton_pattern}
9 """
10 __instance = None
11
13 """
14 Override the __call__ method to make sure only one instance is created.
15 """
16 if cls.__instance is None:
17 cls.__instance = type.__call__(cls, *args, **kwargs)
18
19 return cls.__instance
20