You can use ``@broker.observer()`` as a decorator to your callback
        instead of :func:`Broker.add_observer`.
10212
def observer(self, component_type=ComponentType):
        
        def inner(func):
            self.add_observer(func, component_type)
            return func
        return inner
572980
@Override
    public void addObserver(final Observer<S, T> observer) {
        synchronized (OBSERVER_LOCK) {
            if (observers.contains(observer)) {
                LOGGER.warn("Skip observer registration. Observer[" + observer + "] is already registered!");
                return;
            }
            observers.add(observer);
        }
    }
41701
def addMonitor(self, monitorFriendlyName, monitorURL):
        
        url = self.baseUrl
        url += "newMonitor?apiKey=%s" % self.apiKey
        url += "&monitorFriendlyName=%s" % monitorFriendlyName
        url += "&monitorURL=%s&monitorType=1" % monitorURL
        url += "&monitorAlertContacts=%s" % monitorAlertContacts
        url += "&noJsonCallback=1&format=json"
        success, response = self.requestApi(url)
        if success:
            return True
        else:
            return False
111248
def _add_subscribers_for_type(self, callback_type, subscribers, callbacks, **kwargs):
        '''  '''
        for subscriber in subscribers:
            callback_name = 'on_' + callback_type
            if hasattr(subscriber, callback_name):
                _function = functools.partial(getattr(subscriber, callback_name), **kwargs)
                callbacks.append(_function)
107836
static void addAttachObserver(HTMLElement element, ObserverCallback callback) {
        if (!ready) {
            startObserving();
        }
        attachObservers.add(createObserver(element, callback, ATTACH_UID_KEY));
    }
1159574
def add_observers(self, count, date_observed):
        
        if not self.can_update():
            self._tcex.handle_error(910, [self.type])

        data = {
            'count': count,
            'dataObserved': self._utils.format_datetime(
                date_observed, date_format='%Y-%m-%dT%H:%M:%SZ'
            ),
        }

        return self.tc_requests.add_observations(
            self.api_type, self.api_sub_type, self.unique_id, data, owner=self.owner
        )
1003854
def _notify_add(self, slice_):
        """"""
        change = AddChange(self, slice_)
        self.notify_observers(change)
494467
def add_callback(self, events, callback):
        """"""
        if self._poll is None:
            raise RuntimeError('poll instance is closed')
        if events & ~(READABLE|WRITABLE):
            raise ValueError('illegal event mask: {}'.format(events))
        if events & READABLE:
            self._readers += 1
        if events & WRITABLE:
            self._writers += 1
        handle = add_callback(self, callback, events)
        self._sync()
        return handle
191685
def add(self, widget, condition=lambda: 42):
        

        assert callable(condition)
        assert isinstance(widget, BaseWidget)
        self._widgets.append((widget, condition))

        return widget
593122
def set_callback(self, ref, callback):
        
        # if the callback already exists, remove it
        self.remove_callback(ref)

        # add it to the callbacks
        if callback is not None:
            self._callbacks[ref] = callback
567759
def listens_to(name, sender=None, weak=True):
    
    def decorator(f):
        if sender:
            return signal(name).connect(f, sender=sender, weak=weak)
        return signal(name).connect(f, weak=weak)
    return decorator
414756
def method_missing(method_name, *args, &block)
      if observer.respond_to?(method_name.to_sym)
        observer.public_send(method_name.to_sym, *args, &block)
      elsif env.aliases.include?(method_name.to_sym)
        env.send(:target, *args, &block)
      else
        super
      end
    end
549115
def addMonitor(self, monitor):
    

    token = self.nextMonitorToken
    self.nextMonitorToken += 1

    self.monitors[token] = monitor

    return token
472806
public void addWatcher(final MongoNamespace namespace,
                                     final Callback<ChangeEvent<BsonDocument>, Object> watcher) {
    instanceChangeStreamListener.addWatcher(namespace, watcher);
  }
837189
def properties_observer(instance, prop, callback, **kwargs):
    """"""
    change_only = kwargs.get('change_only', True)
    observer(instance, prop, callback, change_only=change_only)
155727
def observe(self, key: str, callback: Callable[[Any, Any], None]):
        """"""
        if key not in self._callbacks:
            self._add_key(key)
        self._callbacks[key].append(callback)
1048784
def add_observer(self, observer):
        
        if not isinstance(observer, PowerManagementObserver):
            raise TypeError("observer MUST conform to power.PowerManagementObserver")
        self._weak_observers.append(weakref.ref(observer))