Exemplo n.º 1
0
    def __init__(self):
        """ Create singleton instance """
        # Check whether we already have an instance
        if ReductionSingleton.__instance is None:
            # Create and remember instance
            ReductionSingleton.__instance = Reducer()

        # Store instance reference as the only member in the handle
        self.__dict__['_ReductionSingleton__instance'] = ReductionSingleton.__instance
Exemplo n.º 2
0
 def clean(cls, reducer_cls=None):
     if reducer_cls is None:
         ReductionSingleton.__instance = Reducer()
     else:
         ReductionSingleton.__instance = reducer_cls()