// updateFromURI updates the data in the model with the user provided URL data.
349742
func (m *model) updateFromURI(u *url.URL) {
	m.scheme, m.host, m.path = u.Scheme, u.Host, u.Path
	if h, p, err := net.SplitHostPort(m.host); err == nil {
		m.host = h
		m.port = p
	}
}
498370
func (c *CommitCommentsService) Update(uri *Hyperlink, uriParams M, requestParams interface{}) (comment *CommitComment, result *Result) {
	url, err := ExpandWithDefault(uri, &RepoCommentsURL, uriParams)
	if err != nil {
		return nil, &Result{Err: err}
	}

	result = c.client.patch(url, requestParams, &comment)
	return
}
435767
func (tfu threatsForUpdate) update(resp *pb.FetchThreatListUpdatesResponse) error {
	// For each update response do the removes and adds
	for _, m := range resp.GetListUpdateResponses() {
		td := ThreatDescriptor{
			PlatformType:    PlatformType(m.PlatformType),
			ThreatType:      ThreatType(m.ThreatType),
			ThreatEntryType: ThreatEntryType(m.ThreatEntryType),
		}

		phs, ok := tfu[td]
		switch m.ResponseType {
		case pb.FetchThreatListUpdatesResponse_ListUpdateResponse_PARTIAL_UPDATE:
			if !ok {
				return errors.New("safebrowsing: partial update received for non-existent key")
			}
		case pb.FetchThreatListUpdatesResponse_ListUpdateResponse_FULL_UPDATE:
			if len(m.Removals) > 0 {
				return errors.New("safebrowsing: indices to be removed included in a full update")
			}
			phs = partialHashes{}
		default:
			return errors.New("safebrowsing: unknown response type")
		}

		// Hashes must be sorted for removal logic to work properly.
		phs.Hashes.Sort()

		for _, removal := range m.Removals {
			idxs, err := decodeIndices(removal)
			if err != nil {
				return err
			}

			for _, i := range idxs {
				if i < 0 || i >= int32(len(phs.Hashes)) {
					return errors.New("safebrowsing: invalid removal index")
				}
				phs.Hashes[i] = ""
			}
		}

		// If any removal was performed, compact the list of hashes.
		if len(m.Removals) > 0 {
			compactHashes := phs.Hashes[:0]
			for _, h := range phs.Hashes {
				if h != "" {
					compactHashes = append(compactHashes, h)
				}
			}
			phs.Hashes = compactHashes
		}

		for _, addition := range m.Additions {
			hashes, err := decodeHashes(addition)
			if err != nil {
				return err
			}
			phs.Hashes = append(phs.Hashes, hashes...)
		}

		// Hashes must be sorted for SHA256 checksum to be correct.
		phs.Hashes.Sort()
		if err := phs.Hashes.Validate(); err != nil {
			return err
		}

		if cs := m.GetChecksum(); cs != nil {
			phs.SHA256 = cs.Sha256
		}
		if !bytes.Equal(phs.SHA256, phs.Hashes.SHA256()) {
			return errors.New("safebrowsing: threat list SHA256 mismatch")
		}

		phs.State = m.NewClientState
		tfu[td] = phs
	}
	return nil
}
35949
func (r *AppService) Update(id string, appupdatereq *AppUpdateReq) *AppUpdateCall {
	c := &AppUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.id = id
	c.appupdatereq = appupdatereq
	return c
}
810786
func (s *userService) Update(id int64, user datamodels.User) (datamodels.User, error) {
	user.ID = id
	return s.repo.InsertOrUpdate(user)
}
227846
func (u *UserResource) updateUser(request *restful.Request, response *restful.Response) {
	usr := new(User)
	err := request.ReadEntity(&usr)
	if err == nil {
		u.users[usr.ID] = *usr
		response.WriteEntity(usr)
	} else {
		response.WriteError(http.StatusInternalServerError, err)
	}
}
356822
func (s *RRSetsService) Update(k RRSetKey, val RRSet) (*http.Response, error) {
	var ignored interface{}
	return s.client.put(k.URI(), val, &ignored)
}
744423
func (o *querySet) Update(values Params) (int64, error) {
	return o.orm.alias.DbBaser.UpdateBatch(o.orm.db, o, o.mi, o.cond, values, o.orm.alias.TZ)
}
324327
func (u *UserService) updateUser(request *restful.Request, response *restful.Response) {
	c := appengine.NewContext(request.Request)
	usr := new(User)
	err := request.ReadEntity(&usr)
	if err == nil {
		item := &memcache.Item{
			Key:    usr.Id,
			Object: &usr,
		}
		err = memcache.Gob.Set(c, item)
		if err != nil {
			response.WriteError(http.StatusInternalServerError, err)
			return
		}
		response.WriteEntity(usr)
	} else {
		response.WriteError(http.StatusInternalServerError, err)
	}
}
674033
func Update(id string, params *stripe.FileLinkParams) (*stripe.FileLink, error) {
	return getC().Update(id, params)
}
168331
func (c *UsersController) Update(ctx *app.UpdateUsersContext) error {
	return proxy.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
}
292475
func (c Client) Update(id string, params *stripe.RadarValueListParams) (*stripe.RadarValueList, error) {
	path := stripe.FormatURLPath("/v1/radar/value_lists/%s", id)
	vl := &stripe.RadarValueList{}
	err := c.B.Call(http.MethodPost, path, c.Key, params, vl)
	return vl, err
}
452725
func (t *TeamsService) Update(uri *Hyperlink, input TeamParams,
	uriParams M) (team Team, result *Result) {
	url, err := ExpandWithDefault(uri, &TeamURL, uriParams)
	if err != nil {
		return Team{}, &Result{Err: err}
	}
	result = t.client.patch(url, input, &team)
	return
}
589245
func Update(id string, params *stripe.SubscriptionItemParams) (*stripe.SubscriptionItem, error) {
	return getC().Update(id, params)
}
473935
func (s *LimitService) UpdateResourceLimit(p *UpdateResourceLimitParams) (*UpdateResourceLimitResponse, error) {
	resp, err := s.cs.newRequest("updateResourceLimit", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r UpdateResourceLimitResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
818668
func (d *DataSource) InsertOrUpdate(user Model) (Model, error) {
	// no matter what we will update the password hash
	// for both update and insert actions.
	hashedPassword, err := GeneratePassword(user.password)
	if err != nil {
		return user, err
	}
	user.HashedPassword = hashedPassword

	// update
	if id := user.ID; id > 0 {
		_, found := d.GetByID(id)
		if !found {
			return user, errors.New("ID should be zero or a valid one that maps to an existing User")
		}
		d.mu.Lock()
		d.Users[id] = user
		d.mu.Unlock()
		return user, nil
	}

	// insert
	id := d.getLastID() + 1
	user.ID = id
	d.mu.Lock()
	user.CreatedAt = time.Now()
	d.Users[id] = user
	d.mu.Unlock()

	return user, nil
}
654143
func (s *REST) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, _ rest.ValidateObjectFunc, _ rest.ValidateObjectUpdateFunc, forceAllowCreate bool, options *metav1.UpdateOptions) (runtime.Object, bool, error) {
	obj, err := objInfo.UpdatedObject(ctx, nil)
	if err != nil {
		return nil, false, err
	}
	mapping, ok := obj.(*userinternal.UserIdentityMapping)
	if !ok {
		return nil, false, kerrs.NewBadRequest("invalid type")
	}
	Strategy.PrepareForUpdate(ctx, mapping, nil)
	return s.createOrUpdate(ctx, mapping, false)
}