Home | History | Annotate | Download | only in axl

Lines Matching defs:Singleton

2 A Python Singleton mixin class that makes use of some of the ideas
4 from it and you have a singleton. No code is required in
5 subclasses to create singleton behavior -- inheritance from
6 Singleton is all that is needed.
8 Assume S is a class that inherits from Singleton. Useful behaviors
11 1) Getting the singleton:
22 who didn't happen notice the inheritance from Singleton might think he
25 Singleton. An attempt to instantiate via S() will restult in an SingletonException
33 from Singleton may not have their own __new__
35 an exception is raised if a Singleton subclass includ
54 raise SingletonException, 'Can not override __new__ in a Singleton'
60 class Singleton(object):
66 If the singleton requires args to be instantiated, include them the first
71 raise SingletonException, 'If no supplied args, singleton must already be instantiated, or __init__ must require no args'
74 raise SingletonException, 'If the singleton requires __init__ args, supply them on first instantiation'
92 want to get rid of a singleton during test code to see what
104 if issubclass(baseClass, Singleton):
115 Demonstrates normal use -- just call getInstance and it returns a singleton instance
118 class A(Singleton):
128 If the singleton needs args to construct, include them in the first
132 class B(Singleton):
148 class B(Singleton):
160 getInstance, as long as they call Singleton.__init__ during construction.
162 If this check is not required, you don't need to call Singleton.__init__().
165 class A(Singleton):
174 class A(Singleton):
185 class B(Singleton):
196 class A(Singleton):