Remove a previously-added callback

        Parameters
        ----------
        instance
            The instance to detach the callback from
        func : func
            The callback function to remove
358334
def remove_callback(self, instance, func):
        
        for cb in [self._callbacks, self._2arg_callbacks]:
            if instance not in cb:
                continue
            if func in cb[instance]:
                cb[instance].remove(func)
                return
        else:
            raise ValueError("Callback function not found: %s" % func)
1333129
function unbind (type, callback) {
        if (!events.has(type)) {
          throw new Error('Unknown event: ' + type);
        }

        if (typeof callback !== 'function') {
          throw new Error('Callback must be a function, instead got: ' + (typeof callback));
        }

        var eventsOfType = events.get(type, Immutable.List());

        if (eventsOfType.includes(callback)) {
          events = events.set(type, eventsOfType.delete(eventsOfType.indexOf(callback)));
        }

        return self;
      }
283154
function remove(clientModelDoc, callback) {
      var cb = callback || angular.noop;

      return ClientModelDoc.remove({id: clientModelDoc._id},
        function (clientModelDoc) {
          return cb(clientModelDoc);
        },
        function (err) {
          return cb(err);
        }).$promise;
    }
786105
async def register_callback(self, cb):
        
        self._callbacks.add(cb)

        def unregister():
            self._callbacks.remove(cb)

        return unregister
955992
def delete(self, callback=None, errback=None):
        
        return self._rest.delete(self.id, callback=callback, errback=errback)
4222
def remove_listener(self, event, callback, single=None, priority=None):
        
        event_stack = self._events[event]
        for x in event_stack:
            if x['callback'] == callback and \
               (single is None or x['single'] == single) and \
               (priority is None or x['priority'] == priority):
                event_stack.remove(x)
                break
        else:
            raise KeyError('Listener not found for "%s": %s' % (event,
                           callback))
1051649
def del_method(self, m):
        
        if isinstance(m, types.FunctionType) and not iscoroutinefunction(m):
            wrkey = ('function', id(m))
        else:
            f, obj = get_method_vars(m)
            wrkey = (f, id(obj))
        if wrkey in self:
            del self[wrkey]
322334
def disconnect(self, callback=None):
        
        if callback is None:
            self._callbacks = []
            self._callback_refs = []
        else:
            callback = self._normalize_cb(callback)
            if callback in self._callbacks:
                idx = self._callbacks.index(callback)
                self._callbacks.pop(idx)
                self._callback_refs.pop(idx)
1164324
def remove_request_init_listener(self, fn, *args, **kwargs):
        
        self._request_init_callbacks.remove((fn, args, kwargs))
563126
def remove_callback(self, callback):
        """"""
        if callback in self.callbacks:
            self.callbacks.remove(callback)
1267276
def removeCallback(cls, eventType, func, record=None):
        
        callbacks = cls.callbacks()
        callbacks.setdefault(eventType, [])
        for i in xrange(len(callbacks[eventType])):
            my_func, my_record, _ = callbacks[eventType][i]
            if func == my_func and record == my_record:
                del callbacks[eventType][i]
                break
716688
async def terminateInstance(self, *args, **kwargs):
        

        return await self._makeApiCall(self.funcinfo["terminateInstance"], *args, **kwargs)
507387
async def remove(self, *instances, using_db=None) -> None:
        
        db = using_db if using_db else self.model._meta.db
        if not instances:
            raise OperationalError("remove() called on no instances")
        through_table = Table(self.field.through)

        if len(instances) == 1:
            condition = (getattr(through_table, self.field.forward_key) == instances[0].id) & (
                getattr(through_table, self.field.backward_key) == self.instance.id
            )
        else:
            condition = (getattr(through_table, self.field.backward_key) == self.instance.id) & (
                getattr(through_table, self.field.forward_key).isin([i.id for i in instances])
            )
        query = db.query_class.from_(through_table).where(condition).delete()
        await db.execute_query(str(query))
281307
def XXX_REMOVEME(func):
    
    @wraps(func)
    def decorator(self, *args, **kwargs):
        msg = "~~~~~~~ XXX REMOVEME marked method called: {}.{}".format(
            self.__class__.__name__, func.func_name)
        raise RuntimeError(msg)
        return func(self, *args, **kwargs)
    return decorator
133101
def cancel(self):
        
        if self.cancelled:
            raise error.AlreadyCancelled
        elif self.called:
            raise error.AlreadyCalled
        else:
            self.canceller(self)
            self.cancelled = 1
            if self.debug:
                self._str = str(self)
            del self.func, self.args, self.kw
677528
def remove_instance(self, instance):
        
        # External instances need to be close before (process + queues)
        if instance.is_external:
            logger.info("Request external process to stop for %s", instance.name)
            instance.stop_process()
            logger.info("External process stopped.")

        instance.clear_queues(self.daemon.sync_manager)

        # Then do not listen anymore about it
        self.instances.remove(instance)
670534
def deleter(self, func):
        
        if not callable(func):
            raise TypeError('deleter must be callable function')
        if hasattr(func, '__code__') and func.__code__.co_argcount != 1:
            raise TypeError('deleter must be a function with two arguments')
        if func.__name__ != self.name:
            raise TypeError('deleter function must have same name as getter')
        self._del_func = func
        return self