Delete a token from the token list
542797
function delete_token (token) {
          // Remove the id from the saved list
          var token_data = $.data(token.get(0), "tokeninput");
          var callback = $(input).data("settings").onDelete;

          var index = token.prevAll().length;
          if(index > selected_token_index) index--;

          // Delete the token
          token.remove();
          selected_token = null;

          // Show the input box and give it focus again
          focus_with_timeout(input_box);

          // Remove this token from the saved list
          saved_tokens = saved_tokens.slice(0,index).concat(saved_tokens.slice(index+1));
          if (saved_tokens.length == 0) {
              input_box.attr("placeholder", settings.placeholder)
          }
          if(index < selected_token_index) selected_token_index--;

          // Update the hidden input
          update_hidden_input(saved_tokens, hidden_input);

          token_count -= 1;

          if($(input).data("settings").tokenLimit !== null) {
              input_box
                  .show()
                  .val("");
              focus_with_timeout(input_box);
          }

          // Execute the onDelete callback if defined
          if($.isFunction(callback)) {
              callback.call(hidden_input,token_data);
          }
      }
745339
private void unmarkRemovedDefaultSessionToken(String site, String token) {
		if (removedDefaultTokens == null)
			return;
		HashSet<String> removed = removedDefaultTokens.get(site);
		if (removed == null)
			return;
		removed.remove(token);
	}
710641
def remove_token(self, act):
        
        if act in self.tokens:
            self.unregister_fd(act)
            del self.tokens[act]
            return True
        else:
            import warnings
            warnings.warn("%s isn't a registered token." % act)
425272
function deleteToken(username, token, done) {
  return tokenExists(username, token, function(existsErr, tokenObj) {
    if (existsErr) {
      return done(existsErr);
    }

    if (!tokenObj) {
      return done(new Error(`token '${token}' not found`));
    }

    return tokenObj.destroy(done);
  });
}
634287
def delete(self, customer_id, token_id, data={}, **kwargs):
        "
        url = "{}/{}/tokens/{}".format(self.base_url, customer_id, token_id)
        return self.delete_url(url, data, **kwargs)
268737
private void stripCommas(TokenList tokens) {
        TokenList.Token t = tokens.getFirst();

        while( t != null ) {
            TokenList.Token next = t.next;
            if( t.getSymbol() == Symbol.COMMA ) {
                tokens.remove(t);
            }
            t = next;
        }
    }
113125
def delete_GitHub_token(token_id, *, auth, headers):
    """"""
    r = requests.delete('https://api.github.com/authorizations/{id}'.format(id=token_id), auth=auth, headers=headers)
    GitHub_raise_for_status(r)
29775
def token_list_len(tokenlist):
    
    ZeroWidthEscape = Token.ZeroWidthEscape
    return sum(len(item[1]) for item in tokenlist if item[0] != ZeroWidthEscape)
1108656
def delete_refresh_token(self, refresh_token):
        
        access_token = self.fetch_by_refresh_token(refresh_token)

        self.delete(access_token.token)
228036
protected void cleanupSessionToken(String token) {
		// Empty check
		if (sessions.isEmpty()) {
			return;
		}

		if (log.isDebugEnabled()) {
			log.debug("Removing duplicates and cleaning up sessions for site - token: " + site + " - "
					+ token);
		}

		synchronized (this.sessions) {
			// If there are no more session tokens, delete all sessions
			HttpSessionTokensSet siteTokensSet = extension.getHttpSessionTokensSet(site);
			if (siteTokensSet == null) {
				log.info("No more session tokens. Removing all sessions...");
				// Invalidate all sessions
				for (HttpSession session : this.sessions) {
					session.invalidate();
				}
	
				// Remove all sessions
				this.sessions.clear();
				this.activeSession = null;
				this.model.removeAllElements();
				return;
			}
	
			// Iterate through all the sessions, eliminate the given token and eliminate any duplicates
			Map<String, HttpSession> uniqueSession = new HashMap<>(sessions.size());
			List<HttpSession> toDelete = new LinkedList<>();
			for (HttpSession session : this.sessions) {
				// Eliminate the token
				session.removeToken(token);
				if (session.getTokenValuesCount() == 0 && !session.isActive()) {
					toDelete.add(session);
					continue;
				} else {
					model.fireHttpSessionUpdated(session);
				}
	
				// If there is already a session with these tokens, mark one of them for deletion
				if (uniqueSession.containsKey(session.getTokenValuesString())) {
					HttpSession prevSession = uniqueSession.get(session.getTokenValuesString());
					// If the latter session is active, put it into the map and delete the other
					if (session.isActive()) {
						toDelete.add(prevSession);
						session.setMessagesMatched(session.getMessagesMatched()
								+ prevSession.getMessagesMatched());
					} else {
						toDelete.add(session);
						prevSession.setMessagesMatched(session.getMessagesMatched()
								+ prevSession.getMessagesMatched());
					}
				}
				// If it's the first one with these token values, keep it
				else {
					uniqueSession.put(session.getTokenValuesString(), session);
				}
			}
	
			// Delete the duplicate sessions
			if (log.isInfoEnabled()) {
				log.info("Removing duplicate or empty sessions: " + toDelete);
			}
			Iterator<HttpSession> it = toDelete.iterator();
			while (it.hasNext()) {
				HttpSession ses = it.next();
				ses.invalidate();
				sessions.remove(ses);
				model.removeHttpSession(ses);
			}
		}
	}
1078964
def rm_token(opts, tok):
    '''
    
    '''
    redis_client = _redis_client(opts)
    if not redis_client:
        return
    try:
        redis_client.delete(tok)
        return {}
    except Exception as err:
        log.warning('Could not remove token %s: %s', tok, err)
24765
def cleanup(self):
        ''' '''
        allList = []
        allList.extend(self.cur.execute("SELECT keywordid FROM keyword;"))
        usedList = []
        usedList.extend(self.cur.execute("SELECT keywordid FROM notekeyword;"))
        unusedList = [val for val in allList if val not in usedList]
        for key in unusedList:
            if self.debug:
                print("About to delete keyword with ID %s" % key)
            try:
                self.cur.execute("DELETE FROM keyword WHERE keywordId = ?;", key)
            except:
                self.error("There was a problem deleting keyword %s" % key)
        self.con.commit()
452225
function squashTokens(tokens) {
    var token, lastToken;

    for (var i = 0; i < tokens.length; ++i) {
      token = tokens[i];

      if (lastToken && lastToken[0] === "text" && token[0] === "text") {
        lastToken[1] += token[1];
        lastToken[3] = token[3];
        tokens.splice(i--, 1); // Remove this token from the array.
      } else {
        lastToken = token;
      }
    }
  }
740877
function deselect_token (token, position) {
          token.removeClass($(input).data("settings").classes.selectedToken);
          selected_token = null;

          if(position === POSITION.BEFORE) {
              input_token.insertBefore(token);
              selected_token_index--;
          } else if(position === POSITION.AFTER) {
              input_token.insertAfter(token);
              selected_token_index++;
          } else {
              input_token.appendTo(token_list);
              selected_token_index = token_count;
          }

          // Show the input box and give it focus again
          focus_with_timeout(input_box);
      }
1128029
function isRemovedToken(context, token) {
  var removedNodes = context.removedNodes;
  var nodeIdx = removedNodes.length - 1;

  // Find the last removed node which could possibly contain this token.
  while (nodeIdx >= 0 && removedNodes[nodeIdx].start > token.start) {
    nodeIdx--;
  }

  var node = removedNodes[nodeIdx];

  // This token couldn't be removed if not contained within the removed node.
  if (nodeIdx === -1 || node.end < token.end) {
    return false;
  }

  // Iterate through the tokens contained by the removed node to find a match.
  var tokens = context.ast.tokens;
  var tokenIdx = findTokenIndex(tokens, node.start);
  while (tokens[tokenIdx].end <= node.end) {
    if (token === tokens[tokenIdx]) {
      return true;
    }
    tokenIdx++;
  }

  return false;
}
835640
def revoke_token(token_id, user):
    
    try:
        token = TokenBlacklist.query.filter_by(id=token_id, user_identity=user).one()
        token.revoked = True
        db.session.commit()
    except NoResultFound:
        raise TokenNotFound("Could not find the token {}".format(token_id))
1361890
def token_clean(self, length, numbers=True):

        

        def clean1(tokens):
            return [t for t in tokens if t.isalpha() == 1 and len(t) > length]

        def clean2(tokens):
            return [t for t in tokens if t.isalnum() == 1 and len(t) > length]

        if numbers:
            self.tokens = list(map(clean1, self.tokens))
        else:
            self.tokens = list(map(clean2, self.tokens))