Update and return an existing `Snippet` instance, given the validated data.
968949
def update(self, instance, validated_data):
        
        instance.title = validated_data.get('title', instance.title)
        instance.code = validated_data.get('code', instance.code)
        instance.linenos = validated_data.get('linenos', instance.linenos)
        instance.language = validated_data.get('language', instance.language)
        instance.style = validated_data.get('style', instance.style)
        instance.save()
        return instance
261230
def update(self, data):
        
        # Nothing to do if no data
        if data is None:
            return
        for key, value in sorted(data.items()):
            # Handle child attributes
            if key.startswith('/'):
                name = key.lstrip('/')
                # Handle deeper nesting (e.g. keys like /one/two/three) by
                # extracting only the first level of the hierarchy as name
                match = re.search("([^/]+)(/.*)", name)
                if match:
                    name = match.groups()[0]
                    value = {match.groups()[1]: value}
                # Update existing child or create a new one
                self.child(name, value)
            # Update regular attributes
            else:
                self.data[key] = value
        log.debug("Data for '{0}' updated.".format(self))
        log.data(pretty(self.data))
780298
def update(self, name, html_url, zip_url):
        """"""
        body = {
            "Name": name,
            "HtmlPageURL": html_url,
            "ZipFileURL": zip_url}
        response = self._put("/templates/%s.json" %
                             self.template_id, json.dumps(body))
327874
def update(self, data=None, **kwargs):
        
        if data is None:
            data = {}
        data.update(kwargs)
        return self.model.write([self.id], data)
765902
def patch(self, patch):
        """"""
        # explicitly pick out the parts to update so we don't inadvertently
        # step on the model name or anything
        self._contents.update({
            'patch_path': patch.original_file_path,
            'description': patch.description,
            'columns': patch.columns,
            'docrefs': patch.docrefs,
        })
        # patches always trigger re-validation
        self.validate()
526621
def run(self, value, errors, request):
        """"""
        value = self.id_validator(value, errors, request)
        if errors:
            return None
        if self.fetch_by:
            thing = self.cls.fetch_by(**{self.fetch_by: value})
        else:
            thing = self.cls.fetch_by_id(value)
        if not thing and self.source == SOURCE_MATCHDICT:
            # If part of the URL we should have a not-found error
            raise HTTPNotFound()
        elif not thing:
            self.add_error(errors, 'Invalid {0}'
                           .format(self.cls.__name__))
        return thing
617943
def update_doc(input, **params):
    
    PARAM_SOURCE = 'source'
    SOURCE_COL = 'src.col'
    SOURCE_FIELD = 'src.field'
    PARAM_RESULT = 'result'

    res = input[params.get(PARAM_RESULT)]
    for src in params.get(PARAM_SOURCE):
        res[src[SOURCE_FIELD]] = input[src[SOURCE_COL]][src[SOURCE_FIELD]]
    return res
909805
function formatData({ snippet, id }) {
  return {
    title: snippet.title,
    thumbnail: snippet.thumbnails.medium.url,
    description: snippet.description,
    url: `${baseUrl}watch?v=${id}`,
    embedUrl: `${baseUrl}embed/${id}`
  }
}
667547
def update(self, **kwds):
        
        result = self._client.tag.update(self, **kwds)
        self._replace_fields(result.get_fields())
780024
def update(self, data):
        
        data = values.of({'Data': serialize.object(data), })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return DocumentInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            sid=self._solution['sid'],
        )
1260844
def update_object(
        request, model=None, object_id=None, slug=None,
        slug_field='slug', template_name=None, template_loader=loader,
        extra_context=None, post_save_redirect=None, login_required=False,
        context_processors=None, template_object_name='object',
        form_class=None):
    
    if extra_context is None:
        extra_context = {}
    if login_required and not request.user.is_authenticated:
        return redirect_to_login(request.path)

    model, form_class = get_model_and_form_class(model, form_class)
    obj = lookup_object(model, object_id, slug, slug_field)

    if request.method == 'POST':
        form = form_class(request.POST, request.FILES, instance=obj)
        if form.is_valid():
            obj = form.save()
            msg = ugettext("The %(verbose_name)s was updated successfully.") %\
                {"verbose_name": model._meta.verbose_name}
            messages.success(request, msg, fail_silently=True)
            return redirect(post_save_redirect, obj)
    else:
        form = form_class(instance=obj)

    if not template_name:
        template_name = "%s/%s_form.html" % (
            model._meta.app_label, model._meta.object_name.lower())
    t = template_loader.get_template(template_name)
    c = {
        'form': form,
        template_object_name: obj,
    }
    apply_extra_context(extra_context, c)
    response = HttpResponse(t.render(context=c, request=request))
    return response
253902
def snippet=(v)
      case v
      when String
        @snippet = Snippet.new(v)
      when Snippet
        @snippet = v
      else
        raise ArgumentError, "Snippet must be a String or a Snippet"
      end
    end
231944
function(abbr, syntax) {
			var snippet = this.expand(abbr, null, syntax);
			if (snippet === null) {
				return null;
			}

			if (Array.isArray(snippet)) {
				return snippet.join('\n');
			}
			
			if (typeof snippet !== 'string') {
				return snippet.data;
			}
			
			return snippet + '';
		}
504081
def update_data():
    
    global allData
    while not q.empty():
        allData = q.get()
    for key, value in tags.items():
        if key in allData:
            allData[key]['name'] = value
89544
def replace(self, identifier, new_instance):
        
        try:
            # Note that `self.update()` ultimately calls merge, which will not enforce
            # a strict replacement; absent fields will default to the current values.
            return self.update(identifier, new_instance)
        except ModelNotFoundError:
            return self.create(new_instance)
783130
def run_validators(new_data, old_data):
    
    #{'validator_name': (success, score, message)}
    validation_data = {}
    for file_type, lint_data in list(new_data.items()):
        #TODO: What to do if old data doesn't have this filetype?
        old_lint_data = old_data.get(file_type, {})
        validator = ValidatorFactory.get_validator(file_type)
        if validator is not None:
            validation_data[validator.name] = validator.run(lint_data, old_lint_data)
    return validation_data
476332
def append(self, item):
        
        validated_value = self.get_validated_object(item)
        if validated_value is not None:
            self.__modified_data__.append(validated_value)