Add a function as an observer.

        Args:
            func: The function to register as an observer.
            identify_observed: See docstring for add_observer.

        Returns:
            True if the function is added, otherwise False.
357323
def _add_function(self, func, identify_observed):
        

        key = self.make_key(func)
        if key not in self.observers:
            self.observers[key] = ObserverFunction(
                func, identify_observed, (key, self.observers))
            return True
        else:
            return False
551309
def decorate(self, func):
		
		self.func = func
		self._set_implied_name()
		self.register()
		return func
13497
def register(name, func=None):
    

    def decorator(func):
        # Perform the registration
        ControlDaemon._register(name, func)
        return func

    # If func was given, call the decorator, otherwise, return the
    # decorator
    if func:
        return decorator(func)
    else:
        return decorator
1320743
def _add_observer(self, signal, observer):
        

        if observer not in self._observers[signal]:
            self._observers[signal].append(observer)
281292
def proxy_register(register_funtion):
    
    def wrapper(function):
        @functools.wraps(function)
        def register(excepted, filter_function=None):
            if inspect.isfunction(excepted):
                register_funtion(excepted.__name__, excepted)
            elif isinstance(excepted, str) and filter_function:
                if not inspect.isfunction(filter_function):
                    raise RegisterError('Registered must be a function.')
                filter_function.__name__ = excepted
                register_funtion(excepted, filter_function)
            elif isinstance(excepted, str):
                def register_wrapper(func):
                    if not inspect.isfunction(func):
                        raise RegisterError('Registered must be a function.')
                    func.__name__ = excepted
                    register_funtion(excepted, func)
                return register_wrapper
        return register
    return wrapper
153563
def addObserver(self, observer):
        """"""
        Observable.addObserver(self, observer)

        # If self.startOnDemand is True, the reader monitoring
        # thread only runs when there are observers.
        if self.startOnDemand:
            if 0 < self.countObservers():
                if not self.rmthread:
                    self.rmthread = ReaderMonitoringThread(
                        self,
                        self.readerProc, self.period)

                    # start reader monitoring thread in another thread to
                    # avoid a deadlock; addObserver and notifyObservers called
                    # in the ReaderMonitoringThread run() method are
                    # synchronized
                    try:
                        # Python 3.x
                        import _thread
                        _thread.start_new_thread(self.rmthread.start, ())
                    except:
                        # Python 2.x
                        import thread
                        thread.start_new_thread(self.rmthread.start, ())
        else:
            observer.update(self, (self.rmthread.readers, []))
433249
def decorate_callable(self, func):
        
        def wrapper(*args, **kwargs):
            try:
                with self:
                    result = func(*args, **kwargs)
                return result
            except DBMutexError as e:
                if self.suppress_acquisition_exceptions:
                    LOG.error(e)
                else:
                    raise e
        functools.update_wrapper(wrapper, func)
        return wrapper
451854
def registerExcept(func):
    
    setup()
    ref = weakref.ref(func)
    if ref not in _excepthooks:
        _excepthooks.append(ref)
598548
def receiver(self, func=None, json=False):
        
        self.receivers.append((func, json))
1286638
def register_callback_deleted(self, func, serialised=True):
        
        self.__add_callback(_CB_DELETED, func, serialised_if_crud=serialised)
642112
def register(self, func):
        
        assert callable(func)
        assert inspect.getargspec(func).args == ["user", "privilege"]
        self.handlers.add(func)
716943
def addObserver(self, observer):
        
        with self._lock:
            self._weak_observers.append(weakref.ref(observer))
            if len(self._weak_observers) == 1:
                self.startThread()
1156892
def register(**kwargs):
    
    def decorator(func):
        _CALL_REGISTRY[kwargs.get(API_SYM, func.__name__)] = func
        return func

    return decorator
453173
def register(cls, func):
		
		cls._add_version_info(func)
		cls._upgrade_funcs.add(func)
		return func
489160
def add(self, priority, observer, callble):
        
        #if observer is not None:
        ins = 0
        for pr, _, _ in self:
            if priority > pr:
                break
            ins += 1
        self._poc.insert(ins, (priority, weakref.ref(observer), callble))
964356
def add_parser(self, name, func):
        
        self.__parser_map__[name] = _func2method(func, method_name=name)
        return None
877293
def observed(func):
    

    def wrapper(*args, **kwargs):
        self = args[0]
        assert(isinstance(self, Observable))

        self._notify_method_before(self, func.__name__, args, kwargs)
        res = func(*args, **kwargs)
        self._notify_method_after(self, func.__name__, res, args, kwargs)
        return res

    log.logger.warning("Decorator observable.observed is deprecated:"
                       "use Observable.observed instead")
    return wrapper