Updates the requirement to the latest version for the given content and adds hashes
        if neccessary.
        :param content: str, content
        :return: str, updated content
192922
def update(cls, content, dependency, version, spec="==", hashes=()):
        
        new_line = "{name}{spec}{version}".format(name=dependency.full_name, spec=spec, version=version)
        appendix = ''
        # leave environment markers intact
        if ";" in dependency.line:
            # condense multiline, split out the env marker, strip comments and --hashes
            new_line += ";" + dependency.line.splitlines()[0].split(";", 1)[1] \
                .split("#")[0].split("--hash")[0].rstrip()
        # add the comment
        if "#" in dependency.line:
            # split the line into parts: requirement and comment
            parts = dependency.line.split("#")
            requirement, comment = parts[0], "#".join(parts[1:])
            # find all whitespaces between the requirement and the comment
            whitespaces = (hex(ord('\t')), hex(ord(' ')))
            trailing_whitespace = ''
            for c in requirement[::-1]:
                if hex(ord(c)) in whitespaces:
                    trailing_whitespace += c
                else:
                    break
            appendix += trailing_whitespace + "#" + comment
        # if this is a hashed requirement, add a multiline break before the comment
        if dependency.hashes and not new_line.endswith("\\"):
            new_line += " \\"
        # if this is a hashed requirement, add the hashes
        if hashes:
            for n, new_hash in enumerate(hashes):
                new_line += "\n    --hash={method}:{hash}".format(
                    method=new_hash['method'],
                    hash=new_hash['hash']
                )
                # append a new multiline break if this is not the last line
                if len(hashes) > n + 1:
                    new_line += " \\"
        new_line += appendix

        regex = cls.SUB_REGEX.format(re.escape(dependency.line))

        return re.sub(regex, new_line, content, flags=re.MULTILINE)
285856
def update(self, key, item):
        
        return lib.zhash_update(self._as_parameter_, key, item)
587780
def refreshContents( self ):
        
        item = self.uiContentsTREE.currentItem()
        if not isinstance(item, XdkEntryItem):
           return
        
        item.load()
        url = item.url()
        if url:
            self.gotoUrl(url)
1017314
def update_command(args):
    """"""
    updated = update_requirements_file(
        args.requirements_file, args.skip_packages)

    if updated:
        print('Updated requirements in {}:'.format(args.requirements_file))

        for item in updated:
            print(' * {} from {} to {}.'.format(*item))
    else:
        print('All dependencies in {} are up-to-date.'.format(
            args.requirements_file))
632349
public function needsUpdate()
    {
        $new = $this->getContent();
        $old = $this->getFileContent();

        $normalize = function($content) {
            return str_replace("\r\n", "\n", $content);
        };

        return $normalize($new) !== $normalize($old);
    }
1119342
def maybeUpdate(self):
        
        if self.wasModified():
            self.lastModified = self.filePath.getmtime()
            self.fileContents = self.filePath.getContent()
            self.hashValue = hashlib.sha1(self.fileContents).hexdigest()
1262396
def content_sha1(context):
    
    try:
        content = context.current_parameters['content']
    except AttributeError:
        content = context
    return hashlib.sha1(encodeutils.to_utf8(content)).hexdigest()
32831
def update_version(self, version: Union[http.HttpVersion, str]) -> None:
        
        if isinstance(version, str):
            v = [l.strip() for l in version.split('.', 1)]
            try:
                version = http.HttpVersion(int(v[0]), int(v[1]))
            except ValueError:
                raise ValueError(
                    'Can not parse http version number: {}'
                    .format(version)) from None
        self.version = version
1040926
def needs_update(self, cache_key):
    
    if not self.cacheable(cache_key):
      # An uncacheable CacheKey is always out of date.
      return True

    return self._read_sha(cache_key) != cache_key.hash
944377
def _set_details(self, content):
        
        try:
            self.details = str(content)
        except UnicodeEncodeError:
            if sys.version_info < (3, 0):
                # If Py2 threw encode error, convert to unicode.
                self.details = unicode(content)
            else:
                # We should never hit this in Py3, if this happens, record
                # an encoded version of the content for users to handle.
                logging.error(
                    'Unable to decode "%s" in Py3, encoding in utf-8.',
                    content)
                self.details = content.encode('utf-8')
420367
def put_content(self, content):
        

        self.blob.content_encoding = self.content_encoding
        self.blob.metadata = self.metadata
        return self.blob.upload_from_string(content, content_type=self.content_type)
722624
def file_content(self, file_content, update_if_exists=True):
        
        if not self.can_update():
            self._tcex.handle_error(910, [self.type])

        self._data['fileContent'] = file_content
        return self.tc_requests.upload(
            self.api_type,
            self.api_sub_type,
            self.unique_id,
            file_content,
            update_if_exists=update_if_exists,
        )
871662
def update_req(req):
    """"""

    if not req.name:
        return req, None

    info = get_package_info(req.name)

    if info['info'].get('_pypi_hidden'):
        print('{} is hidden on PyPI and will not be updated.'.format(req))
        return req, None

    if _is_pinned(req) and _is_version_range(req):
        print('{} is pinned to a range and will not be updated.'.format(req))
        return req, None

    newest_version = _get_newest_version(info)
    current_spec = next(iter(req.specifier)) if req.specifier else None
    current_version = current_spec.version if current_spec else None
    new_spec = Specifier(u'=={}'.format(newest_version))
    if not current_spec or current_spec._spec != new_spec._spec:
        req.specifier = new_spec
        update_info = (
            req.name,
            current_version,
            newest_version)
        return req, update_info
    return req, None
418450
def modify_content(request, page_id, content_type, language_id):
    """"""
    page = get_object_or_404(Page, pk=page_id)
    perm = request.user.has_perm('pages.change_page')
    if perm and request.method == 'POST':
        content = request.POST.get('content', False)
        if not content:
            raise Http404
        page = Page.objects.get(pk=page_id)
        if settings.PAGE_CONTENT_REVISION:
            Content.objects.create_content_if_changed(page, language_id,
                                                      content_type, content)
        else:
            Content.objects.set_or_create_content(page, language_id,
                                                  content_type, content)
        page.invalidate()
        # to update last modification date
        page.save()

        return HttpResponse('ok')
    raise Http404
1104374
private final void updateShardInfo() {
    final long expirationTime = 1000;
    // don't update too much
    if (shardKey == null || (shardInfoUpdated
        && Objects.requireNonNull(shardInfoUpdate, "update expire time not set") < System.currentTimeMillis())) {
      return;
    }
    // and only if necessary
    if (!shardInfoUpdated || !finished || shardInfoNeedUpdate) {
      // reset
      shardInfoError = false;
      // get list of relevant stages
      Set<Integer> stagesList = new HashSet<>();
      for (Integer stage : shardStageKeys.keySet()) {
        if (!shardStageStatus.containsKey(stage) || !shardStageStatus.get(stage).finished) {
          stagesList.add(stage);
        }
      }
      // loop for this list over shards
      for (Entry<String, ShardStatus> entry : shards.entrySet()) {
        ShardStatus shardStatus = entry.getValue();
        SolrClient solrClient = null;
        StageStatus stageStatus;
        // then loop over stages
        for (Integer stage : stagesList) {
          // get shardStage
          if (!shardStageStatus.containsKey(stage)) {
            stageStatus = new StageStatus(stage);
            shardStageStatus.put(stage, stageStatus);
          } else {
            stageStatus = shardStageStatus.get(stage);
          }
          if (shardStatus.finishedStages.contains(stage)) {
            stageStatus.add(true, shardStatus.numberDocumentsFoundStage.get(stage));
          } else {
            // create request
            ModifiableSolrParams solrParams = new ModifiableSolrParams();
            solrParams.add(CommonParams.QT, shardStatus.mtasHandler);
            solrParams.add(MtasRequestHandler.PARAM_ACTION, MtasRequestHandler.ACTION_STATUS);
            solrParams.add(MtasRequestHandler.PARAM_KEY, shardStageKeys.get(stage));

            try {
              // set solrClient
              solrClient = new HttpSolrClient.Builder(shardStatus.location).build();
              // get response
              QueryResponse response = solrClient.query(solrParams);
              // check for response
              if (response.getResponse().findRecursive(MtasSolrComponentStatus.NAME) != null) {
                shardStatus.numberDocumentsFoundStage.put(stage,
                    getLong(response.getResponse(), MtasSolrComponentStatus.NAME, NAME_STATUS_DOCUMENT_NUMBER_FOUND));
                shardStatus.timeStage.put(stage,
                    getInteger(response.getResponse(), MtasSolrComponentStatus.NAME, NAME_TIME_TOTAL));
                stageStatus.add(
                    shardStatus.setFinishedStage(stage,
                        getBoolean(response.getResponse(), MtasSolrComponentStatus.NAME, NAME_FINISHED)),
                    shardStatus.numberDocumentsFoundStage.get(stage));
                shardInfoError = shardStatus.setErrorStage(stage,
                    getString(response.getResponse(), MtasSolrComponentStatus.NAME, NAME_ERROR)) || shardInfoError;
                shardStatus.setAbortStage(stage,
                    getString(response.getResponse(), MtasSolrComponentStatus.NAME, NAME_ABORT));
                if (stage.equals(currentStage)) {
                  shardStatus.stage = stage;
                  shardStatus.stageNumberDocumentsFinished = getLong(response.getResponse(),
                      MtasSolrComponentStatus.NAME, NAME_STATUS_DOCUMENT_NUMBER_FINISHED);
                  shardStatus.stageSubNumberDocumentsFinished = getLongMap(response.getResponse(),
                      MtasSolrComponentStatus.NAME, NAME_STATUS_DOCUMENT_SUB_NUMBER_FINISHED);
                  shardStatus.stageSubNumberDocumentsTotal = getLong(response.getResponse(),
                      MtasSolrComponentStatus.NAME, NAME_STATUS_DOCUMENT_SUB_NUMBER_TOTAL);
                  shardStatus.stageSubNumberDocumentsFinishedTotal = getLong(response.getResponse(),
                      MtasSolrComponentStatus.NAME, NAME_STATUS_DOCUMENT_SUB_NUMBER_FINISHED_TOTAL);
                  shardStatus.stageNumberSegmentsFinished = getInteger(response.getResponse(),
                      MtasSolrComponentStatus.NAME, NAME_STATUS_SEGMENT_SUB_NUMBER_FINISHED_TOTAL);
                  shardStatus.stageSubNumberSegmentsFinished = getIntegerMap(response.getResponse(),
                      MtasSolrComponentStatus.NAME, NAME_STATUS_SEGMENT_SUB_NUMBER_FINISHED);
                  shardStatus.stageSubNumberSegmentsTotal = getInteger(response.getResponse(),
                      MtasSolrComponentStatus.NAME, NAME_STATUS_SEGMENT_SUB_NUMBER_TOTAL);
                  shardStatus.stageSubNumberSegmentsFinishedTotal = getInteger(response.getResponse(),
                      MtasSolrComponentStatus.NAME, NAME_STATUS_SEGMENT_SUB_NUMBER_FINISHED_TOTAL);
                }
              } else if (!finished && currentStage.equals(stage) && !stageStatus.checked) {
                stageStatus.finished = false;
              }
            } catch (SolrServerException | IOException e) {
              shardInfoError = shardInfoError || shardStatus.setErrorStage(stage, e.getMessage());
            } finally {
              if (solrClient != null) {
                try {
                  solrClient.close();
                } catch (IOException e) {
                  shardInfoError = shardInfoError || shardStatus.setErrorStage(stage, e.getMessage());
                }
              }
            }
          }
        }
      }
      if (!shardInfoError) {
        for (StageStatus item : shardStageStatus.values()) {
          item.checked = true;
        }
        shardInfoUpdated = true;
        shardInfoUpdate = System.currentTimeMillis() + expirationTime;
      } else {
        shardInfoUpdated = false;
        shardInfoUpdate = null;
      }
    }
  }
608861
def update(self, byts):
        '''
        
        '''
        self.size += len(byts)
        [h[1].update(byts) for h in self.hashes]
1331614
def version_task
      update_gemspec(:version, ENV['VERSION']) if ENV['VERSION']
      update_gemspec(:date, Date.today)

      update_version_file(gemspec.version)
      update_version_constant(gemspec.version)
    end