Refreshes all refreshable tokens in the queryset.
        Deletes any tokens which fail to refresh.
        Deletes any tokens which are expired and cannot refresh.
        Excludes tokens for which the refresh was incomplete for other reasons.
422031
def bulk_refresh(self):
        
        session = OAuth2Session(app_settings.ESI_SSO_CLIENT_ID)
        auth = requests.auth.HTTPBasicAuth(app_settings.ESI_SSO_CLIENT_ID, app_settings.ESI_SSO_CLIENT_SECRET)
        incomplete = []
        for model in self.filter(refresh_token__isnull=False):
            try:
                model.refresh(session=session, auth=auth)
                logging.debug("Successfully refreshed {0}".format(repr(model)))
            except TokenError:
                logger.info("Refresh failed for {0}. Deleting.".format(repr(model)))
                model.delete()
            except IncompleteResponseError:
                incomplete.append(model.pk)
        self.filter(refresh_token__isnull=True).get_expired().delete()
        return self.exclude(pk__in=incomplete)
217897
def refresh_token(self):
        

        try:
            if self.token:
                self.token = self.request().refresh_token(self.refresh_url, self.token['refresh_token'])
                return True
        except Exception as e:
            # TODO: what might go wrong here - handle this error properly
            #print("Unexpected error:\t\t", str(e))
            #traceback.print_exc()
            pass
        return False
531953
def refresh(self):
        
        strawpoll_response = requests.get('{api_url}/{poll_id}'.format(api_url=api_url, poll_id=self.id))
        raise_status(strawpoll_response)
        self.status_code = strawpoll_response.status_code
        self.response_json = strawpoll_response.json()
        self.id = self.response_json['id']
        self.title = self.response_json['title']
        self.options = self.response_json['options']
        self.votes = self.response_json['votes']
        self.captcha = self.response_json['captcha']
        self.dupcheck = self.response_json['dupcheck']
        self.url = 'https://www.strawpoll.me/{id}'.format(id=self.id)
        self.results_url = 'https://www.strawpoll.me/{id}/r'.format(id=self.id)
187015
def _requires_refresh_token(self):
        
        expires_on = datetime.datetime.strptime(
            self.login_data['token']['expiresOn'], '%Y-%m-%dT%H:%M:%SZ')
        refresh = datetime.datetime.utcnow() + datetime.timedelta(seconds=30)
        return expires_on < refresh
465678
def _refresh_converters(self):
        
        self._converters.clear()
        return reduce(lambda a, b: a and b, [self._add_converter(k) for k in list(self._xsltLibrary.keys())], True)
1202283
def refresh_token!(refresh_token)
      old_token = OAuth2::AccessToken.new(oauth_client,'', refresh_token: refresh_token)
      self.access_token = old_token.refresh!
    end
612011
public function refresh() {
    $grant = new ClientCredentialsGrantRequest($this->clientId, $this->clientSecret, $this->scopes);
    $tokens = $grant->getTokens();

    $this->accessToken = $tokens->{"access_token"};
    $this->expiresAt = Util::calculateExpiryTime($tokens->{"expires_in"});
  }
904832
private void refreshValidIssues(FeatureCollector collector, List<Team> teams, Set<Scope> scopes) {
        long refreshValidIssuesStart = System.currentTimeMillis();
        List<String> lookUpIds = Objects.equals(collector.getMode(), JiraMode.Board) ? teams.stream().map(Team::getTeamId).collect(Collectors.toList()) : scopes.stream().map(Scope::getpId).collect(Collectors.toList());
        lookUpIds.forEach(l -> {
            LOGGER.info("Refreshing issues for " + collector.getMode() + " ID:" + l);
            List<String> issueIds = jiraClient.getAllIssueIds(l, collector.getMode());
            List<Feature> existingFeatures = Objects.equals(collector.getMode(), JiraMode.Board) ? featureRepository.findAllByCollectorIdAndSTeamID(collector.getId(), l) : featureRepository.findAllByCollectorIdAndSProjectID(collector.getId(), l);
            List<Feature> deletedFeatures = existingFeatures.stream().filter(e -> !issueIds.contains(e.getsId())).collect(Collectors.toList());
            deletedFeatures.forEach(d -> {
                LOGGER.info("Deleting Feature " + d.getsId() + ':' + d.getsName());
                featureRepository.delete(d);
            });
        });
        log(collector.getMode() + " Issues Refreshed ", refreshValidIssuesStart);
    }
1324773
def _on_completions_refreshed(self, new_completer):
        
        with self._completer_lock:
            self.completer = new_completer
            # When cli is first launched we call refresh_completions before
            # instantiating the cli object. So it is necessary to check if cli
            # exists before trying the replace the completer object in cli.
            if self.cli:
                self.cli.current_buffer.completer = new_completer

        if self.cli:
            # After refreshing, redraw the CLI to clear the statusbar
            # "Refreshing completions..." indicator
            self.cli.request_redraw()
242109
def refresh(self, *args, **kwargs):
        
        result = self.fetch(*args, **kwargs)
        self.store(self.key(*args, **kwargs), self.expiry(*args, **kwargs), result)
        return result
1332475
def clean_expired_tokens(opts):
    '''
    
    '''
    loadauth = salt.auth.LoadAuth(opts)
    for tok in loadauth.list_tokens():
        token_data = loadauth.get_tok(tok)
        if 'expire' not in token_data or token_data.get('expire', 0) < time.time():
            loadauth.rm_token(tok)
175844
def refresh_token(self, subid):
    ''''''
    if os.path.exists(self.data_base):    # /scif/data
        data_base = "%s/%s" %(self.data_base, subid)
        if os.path.exists(data_base):
            refreshed = "%s/%s" %(self.database, str(uuid.uuid4()))
            os.rename(data_base, refreshed)
            return refreshed
        self.logger.warning('%s does not exist, cannot rename %s' % (data_base, subid))
    else:
        self.logger.warning('%s does not exist, cannot rename %s' % (self.database, subid))
1343826
def refresh(self, refresh_token):
        
        r = requests.post(self.apiurl + "/token", params={"grant_type": "refresh_token", "client_id": self.cid,
                                                          "client_secret": self.csecret,
                                                          "refresh_token": refresh_token})

        if r.status_code != 200:
            raise ServerError

        jsd = r.json()

        return jsd['access_token'], int(jsd['expires_in']) + int(jsd['created_at'])
1006908
function queryRefresh(queryList) {
    var queryListImpl = queryList;
    if (queryList.dirty) {
        queryList.reset(queryListImpl._valuesTree);
        queryList.notifyOnChanges();
        return true;
    }
    return false;
}
90798
def _refresh(self, _):
        
        # pylint: disable=import-error
        from google.appengine.api import app_identity
        try:
            token, _ = app_identity.get_access_token(self._scopes)
        except app_identity.Error as e:
            raise exceptions.CredentialsError(str(e))
        self.access_token = token
60870
def prune_database():
    
    now = datetime.now()
    expired = TokenBlacklist.query.filter(TokenBlacklist.expires < now).all()
    for token in expired:
        db.session.delete(token)
    db.session.commit()
404602
def refresh_token(self, arguments):
        

        new_access_token = None

        auth = ExistAuth(self.client_id, self.client_secret)
        resp = auth.refresh_token(self.access_token)
        if auth.token:
            new_access_token = auth.token['access_token']
            print('OAuth token refreshed: %s' % new_access_token)
            self.write_config(new_access_token)
        else:
            print('ERROR: We were unable to refresh the OAuth token | %s' % json.dumps(resp))