Esempio n. 1
0
 def __init__(self, callable_, argsInfo, onDead=None):
     '''Use callable_ as a listener of topicName. The argsInfo is the 
     return value from a Validator, ie an instance of callables.ArgsInfo.
     If given, the onDead will be called if/when callable_ gets
     garbage collected (callable_ is held only by weak reference). '''
     # set call policies
     self.acceptsAllKwargs = argsInfo.acceptsAllKwargs
     
     self.__wantsTopic = argsInfo.wantsTopic
     if onDead is None:
         self._callable = weakmethod.getWeakRef(callable_)
     else:
         self._callable = weakmethod.getWeakRef(callable_, self.__notifyOnDead)
     self.__onDead = onDead
     
     # save identity now in case callable dies:
     name, mod = getID(callable_)   #
     self.__nameID = name
     self.__module = mod 
     self.__id     = str(id(callable_))[-4:] # only last four digits of id
Esempio n. 2
0
    def __init__(self, callable_, argsInfo, onDead=None):
        '''Use callable_ as a listener of topicName. The argsInfo is the 
        return value from a Validator, ie an instance of callables.CallArgsInfo.
        If given, the onDead will be called with self as parameter, if/when
        callable_ gets garbage collected (callable_ is held only by weak
        reference). '''
        # set call policies
        self.acceptsAllKwargs = argsInfo.acceptsAllKwargs

        self._autoTopicArgName = argsInfo.autoTopicArgName
        self._callable = weakmethod.getWeakRef(callable_, self.__notifyOnDead)
        self.__onDead = onDead

        # save identity now in case callable dies:
        name, mod = getID(callable_)  #
        self.__nameID = name
        self.__module = mod
        self.__id = str(id(callable_))[-4:]  # only last four digits of id
        self.__hash = hash(callable_)
Esempio n. 3
0
 def __init__(self, callback, id=None):
     assert callable(callback), '%s is not callable' % callback
     self.__callable = weakmethod.getWeakRef(callback)
     self.id = id
     self.weakID = str(self) # save this now in case callable weak ref dies
Esempio n. 4
0
 def __init__(self, callback, id=None):
     assert callable(callback), '%s is not callable' % callback
     self.__callable = weakmethod.getWeakRef(callback)
     self.id = id
     self.weakID = str(self)  # save this now in case callable weak ref dies