Handle a new update.

        Fetches new data from the client, then compares it to the previous
        lookup.

        Returns:
            (bool, new_data): whether changes occurred, and the new value.
11827
def handle(self, client, subhooks=()):
        
        new_data = self.fetch(client)

        # Holds the list of updated fields.
        updated = {}

        if not subhooks:
            # We always want to compare to previous values.
            subhooks = [self.name]

        for subhook in subhooks:
            new_key = self.extract_key(new_data, subhook)
            if new_key != self.previous_keys.get(subhook):
                updated[subhook] = new_key

        if updated:
            logger.debug("Hook %s: data changed from %r to %r", self.name, self.previous_keys, updated)
            self.previous_keys.update(updated)
            return (True, new_data)

        return (False, None)
97645
def update(self):
        
        error = ""

        if self.key is None:
            error = "To update a client you need to provide a key"
        if self.secret is None:
            error = "To update a client you need to provide the secret"

        if error:
            raise ClientException(error)

        self.request()
        return True
883945
def new(cls, data=None):
		
		obj = cls()
		if data is not None:
			obj.update(data)
		return obj
1230314
def check_update():
    
    r = requests.get("https://pypi.python.org/pypi/prof/json")
    data = r.json()
    if versiontuple(data['info']['version']) > versiontuple(__version__):
        return True
    return False
802935
def update_or_create(self, *args, **kwargs):
        
        obj, created = super().update_or_create(*args, **kwargs)

        if not created:
            return self.with_signal(result=(obj, created))

        return obj, created
242109
def refresh(self, *args, **kwargs):
        
        result = self.fetch(*args, **kwargs)
        self.store(self.key(*args, **kwargs), self.expiry(*args, **kwargs), result)
        return result
644395
def update(self):
        
        if self._track_changes:
            data = self.to_api_data(restrict_keys=self._track_changes)
            if data:
                response = self.session.patch(self.build_url(''), data=data)
                if not response:
                    return False
                self._track_changes.clear()
        if self._font._track_changes:
            data = self._font.to_api_data(restrict_keys=self._font._track_changes)
            if data:
                response = self.session.patch(self.build_url(self._endpoints.get('font')), data=data)
                if not response:
                    return False
                self._font._track_changes.clear()
        if self._track_background_color:
            if self._background_color is None:
                url = self.build_url(self._endpoints.get('clear_fill'))
                response = self.session.post(url)
            else:
                data = {'color': self._background_color}
                url = self.build_url(self._endpoints.get('fill'))
                response = self.session.patch(url, data=data)
            if not response:
                return False
            self._track_background_color = False

        return True
69104
def update(self, other):
        
        if type(self) != type(other):
            return NotImplemented
        else:
            if other.bad:
                self.error = other.error
                self.bad = True
            self._fieldDict.update(other._fieldDict)
385460
def update(self, data_=None, **kwargs):
    
    if data_ is None:
      data_ = dict()
    else:
      data_ = dict(data_)
    data_.update(**kwargs)
    changes = set()
    for attr_name in data_:
      if hasattr(self, attr_name):
        if getattr(self, attr_name) != data_[attr_name]:
          changes.add(attr_name)
          setattr(self, attr_name, data_[attr_name])
      else:
        if self.strict_attrs:
          raise Exception("Unknown attribute for {}: {}".format(self.__class__.__name__, attr_name))
    return changes
1045771
protected function performUpdate()
    {
        // If the updating event returns false, we will cancel the update operation so
        // developers can hook Validation systems into their models and cancel this
        // operation if the model does not pass validation. Otherwise, we update.
        if ($this->fireModelEvent('updating') === false) {
            return false;
        }

        // First we need to create a fresh query instance and touch the creation and
        // update timestamp on the model which are maintained by us for developer
        // convenience. Then we will just continue saving the model instances.
        if ($this->usesTimestamps()) {
            $this->updateTimestamps();
        }

        // Once we have run the update operation, we will fire the "updated" event for
        // this model instance. This will allow developers to hook into these after
        // models are updated, giving them a chance to do any special processing.
        $dirty = $this->getDirty();

        if (count($dirty) > 0) {
            static::$client::update($this->getKey(), $dirty, $this->attributes);

            $this->fireModelEvent('updated', false);

            $this->syncChanges();
        }

        return true;
    }
3568
private void handleUpdate(final TrackMetadataUpdate update) {
        boolean foundInCache = false;

        if (update.metadata == null || update.metadata.trackType != CdjStatus.TrackType.REKORDBOX) {
            clearDeck(update);
        } else {
            // We can offer waveform information for this device; check if we've already looked it up. First, preview:
            final WaveformPreview lastPreview = previewHotCache.get(DeckReference.getDeckReference(update.player, 0));
            if (lastPreview == null || !lastPreview.dataReference.equals(update.metadata.trackReference)) {  // We have something new!

                // First see if we can find the new preview in the hot cache
                for (WaveformPreview cached : previewHotCache.values()) {
                    if (cached.dataReference.equals(update.metadata.trackReference)) {  // Found a hot cue hit, use it.
                        updatePreview(update, cached);
                        foundInCache = true;
                        break;
                    }
                }

                // If not found in the cache try actually retrieving it.
                if (!foundInCache && activePreviewRequests.add(update.player)) {
                    clearDeckPreview(update);  // We won't know what it is until our request completes.
                    // We had to make sure we were not already asking for this track.
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                WaveformPreview preview = requestPreviewInternal(update.metadata.trackReference, true);
                                if (preview != null) {
                                    updatePreview(update, preview);
                                }
                            } catch (Exception e) {
                                logger.warn("Problem requesting waveform preview from update" + update, e);
                            } finally {
                                activePreviewRequests.remove(update.player);
                            }
                        }
                    }).start();
                }
            }

            // Secondly, the detail.
            foundInCache = false;
            final WaveformDetail lastDetail = detailHotCache.get(DeckReference.getDeckReference(update.player, 0));
            if (isFindingDetails() && (lastDetail == null || !lastDetail.dataReference.equals(update.metadata.trackReference))) {  // We have something new!

                // First see if we can find the new detailed waveform in the hot cache
                for (WaveformDetail cached : detailHotCache.values()) {
                    if (cached.dataReference.equals(update.metadata.trackReference)) {  // Found a hot cue hit, use it.
                        updateDetail(update, cached);
                        foundInCache = true;
                        break;
                    }
                }

                // If not found in the cache try actually retrieving it.
                if (!foundInCache && activeDetailRequests.add(update.player)) {
                    clearDeckDetail(update);  // We won't know what it is until our request completes.
                    // We had to make sure we were not already asking for this track.
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                WaveformDetail detail = requestDetailInternal(update.metadata.trackReference, true);
                                if (detail != null) {
                                    updateDetail(update, detail);
                                }
                            } catch (Exception e) {
                                logger.warn("Problem requesting waveform detail from update" + update, e);
                            } finally {
                                activeDetailRequests.remove(update.player);
                            }
                        }
                    }).start();
                }
            }
        }
    }
1247201
private boolean handleNewInformation() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Parsing new information: " + getVirtualConnection());
        }

        final HttpInboundServiceContextImpl sc = getHTTPContext();

        if (!isPartiallyParsed()) {
            // this is the first pass through on parsing this new request
            // PK12235, check for a full stop only
            if (getChannel().isStopped()) {
                // channel stopped during the initial read, send error back
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Channel stopped during initial read");
                }
                sc.setHeadersParsed();
                // since we haven't parsed the request version, force the
                // response to the minimal 1.0 version
                sc.getResponse().setVersion(VersionValues.V10);
                sendErrorMessage(StatusCodes.UNAVAILABLE);
                return true;
            }
        }

        boolean completed = false;

        // if this is an http/2 link, don't perform additional parsing
        if (this.isAlpnHttp2Link(switchedVC)) {
            return false;
        }
        try {
            completed = sc.parseMessage();
        } catch (UnsupportedMethodException meth) {
            // no FFDC required
            sc.setHeadersParsed();
            sendErrorMessage(StatusCodes.NOT_IMPLEMENTED);
            setPartiallyParsed(false);
            return true;
        } catch (UnsupportedProtocolVersionException ver) {
            // no FFDC required
            sc.setHeadersParsed();
            sendErrorMessage(StatusCodes.UNSUPPORTED_VERSION);
            setPartiallyParsed(false);
            return true;
        } catch (MessageTooLargeException mtle) {
            // no FFDC required
            sc.setHeadersParsed();
            sendErrorMessage(StatusCodes.ENTITY_TOO_LARGE);
            setPartiallyParsed(false);
            return true;
        } catch (MalformedMessageException mme) {
            //no FFDC required
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "parseMessage encountered a MalformedMessageException : " + mme);
            }
            handleGenericHNIError(mme, sc);
            return true;
        } catch (IllegalArgumentException iae) {
            //no FFDC required
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "parseMessage encountered an IllegalArgumentException : " + iae);
            }
            handleGenericHNIError(iae, sc);
            return true;
        } catch (CompressionException ce) {
            //no FFDC required
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "parseMessage encountered a CompressionException : " + ce);
            }
            handleGenericHNIError(ce, sc);
            return true;
        } catch (Throwable t) {
            FFDCFilter.processException(t,
                                        "HttpInboundLink.handleNewInformation",
                                        "2", this);
            handleGenericHNIError(t, sc);
            return true;
        }

        // partialParsed is the opposite of the complete flag
        setPartiallyParsed(!completed);
        if (isPartiallyParsed()) {
            sc.setupReadBuffers(sc.getHttpConfig().getIncomingHdrBufferSize(), false);
        }
        return false;
    }
1133779
async def process_update(self, update):
        
        dispatcher = self.get_dispatcher()
        loop = dispatcher.loop

        # Analog of `asyncio.wait_for` but without cancelling task
        waiter = loop.create_future()
        timeout_handle = loop.call_later(RESPONSE_TIMEOUT, asyncio.tasks._release_waiter, waiter)
        cb = functools.partial(asyncio.tasks._release_waiter, waiter)

        fut = asyncio.ensure_future(dispatcher.updates_handler.notify(update), loop=loop)
        fut.add_done_callback(cb)

        try:
            try:
                await waiter
            except asyncio.futures.CancelledError:
                fut.remove_done_callback(cb)
                fut.cancel()
                raise

            if fut.done():
                return fut.result()
            else:
                # context.set_value(WEBHOOK_CONNECTION, False)
                fut.remove_done_callback(cb)
                fut.add_done_callback(self.respond_via_request)
        finally:
            timeout_handle.cancel()
586872
def update(self, **args):
        
        self_dict = self.to_dict()
        if args:
            self_dict = dict(list(self_dict.items()) + list(args.items()))
        response = self.requester.put(
            '/{endpoint}/{id}', endpoint=self.endpoint,
            id=self.id, payload=self_dict
        )
        obj_json = response.json()
        if 'version' in obj_json:
            self.__dict__['version'] = obj_json['version']
        return self
155081
def refresh(self):
        
        data = self.machine.raw_snapshot_data(self.name)
        self._save(data)
547429
async def update(self, **kwargs):
        '''
        
        '''
        try:
            self.data[self.pk] = self.pk_type(kwargs['pk'])
            updated_obj = await self._meta.object_class().update(self.db, data=self.data)
            if updated_obj is None:
                raise NotFound('Object matching the given {} was not found'.format(self.pk))
            return await updated_obj.serialize()
        except Exception as ex:
            logger.exception(ex)
            raise BadRequest(ex)
21168
def update(self, new_inputs, strip_prefix=True):
        
        if strip_prefix and self.input_name_prefix is not None:
            for i in new_inputs:
                if i.startswith(self.input_name_prefix):
                    self.inputs[i[len(self.input_name_prefix):]] = new_inputs[i]
        else:
            self.inputs.update(new_inputs)