Removes mentions from the string to prevent abuse.

        This includes ``@everyone``, ``@here``, member mentions and role mentions.
502957
def remove_mentions(self, string):
        

        def replace(obj, *, transforms=self.MENTION_TRANSFORMS):
            return transforms.get(obj.group(0), '@invalid')

        return self.MENTION_PATTERN.sub(replace, string)
823396
def _removeSingleMemberGroupReferences(kerning, leftGroups, rightGroups):
    
    new = {}
    for (left, right), value in kerning.items():
        left = leftGroups.get(left, left)
        right = rightGroups.get(right, right)
        new[left, right] = value
    return new
55285
public static void remove() {

        final String current = System.getProperties().getProperty(HANDLER_PKGS, "");

        // Only one
        if (current.equals(PKG)) {
            System.getProperties().put(HANDLER_PKGS, "");
            return;
        }

        // Middle
        String token = "|" + PKG + "|";
        int idx = current.indexOf(token);
        if (idx > -1) {
            final String removed = current.substring(0, idx) + "|" + current.substring(idx + token.length());
            System.getProperties().put(HANDLER_PKGS, removed);
            return;
        }

        // Beginning
        token = PKG + "|";
        idx = current.indexOf(token);
        if (idx > -1) {
            final String removed = current.substring(idx + token.length());
            System.getProperties().put(HANDLER_PKGS, removed);
            return;
        }

        // End
        token = "|" + PKG;
        idx = current.indexOf(token);
        if (idx > -1) {
            final String removed = current.substring(0, idx);
            System.getProperties().put(HANDLER_PKGS, removed);
            return;
        }

    }
16389
def remove_ticket_directives(message):
    
    if message:
        message = re.sub(r'closes #', '#', message)
        message = re.sub(r'addresses #', '#', message)
        message = re.sub(r'references #', '#', message)
    return message
303019
def remove_external_references_from_roles(self):
        
        
        for node_role in self.node.findall('role'):
            role = Crole(node_role)
            role.remove_external_references()
1005181
protected final void removeAllUserCommands() {
        mCurrentState.setUserCommands((int[]) null);
        mServiceHandler.removeCallbacks(mPublishStateRunnable);
        mServiceHandler.post(mPublishStateRunnable);
    }
1369606
def preprocess(s):
    
    # s = re.sub('@\S+', 'thisisamention', s)  # map all mentions to thisisamention
    s = re.sub(r'@\S+', ' ', s)  # map all mentions to thisisamention
    # s = re.sub('http\S+', 'http', s)  # keep only http from urls
    s = re.sub(r'http\S+', ' ', s)  # keep only http from urls
    s = re.sub(r'#(\S+)', r'hashtag\1 hashtag\1', s)  # #foo -> hashtagfoo hashtagfoo (for retaining hashtags even using bigrams)
    # s = re.sub(r'[0-9]+', '9', s)  # 1234 -> 9
    s = re.sub(r'\bRT\b', ' ', s, re.IGNORECASE)
    s = re.sub(r'&[a-z]+;', ' ', s, re.IGNORECASE)
    s = re.sub(r'\s+', ' ', s).strip()
    return s.lower()
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()
201641
function removeUnreferencedElements() {

  var referencedIDs = findReferencedElements();

  var alwaysKeepTags = ['font', 'style', 'metadata', 'script', 'title', 'desc'];
  function removeUnreferencedElementsInTag(node) {
    _($(node).children()).each(function(node) {
      
      // scour:
      // > we only remove if it is not one of our tags we always keep (see above)
      if(_(alwaysKeepTags).indexOf(node.name) !== -1) {
        return;
      }
      var $node = $(node);
      var id = $node.attr('id');
      if(!_(referencedIDs).has(id)) {
        if(node.name == 'g') {
          // scour:
          // > we only inspect the children of a group in a defs if the group
          // > is not referenced anywhere else
          removeUnreferencedElementsInTag(node);
        } else {
          $(node).remove();
        }
      }
    });
  }
  // scour:
  // > Remove most unreferenced elements inside defs
  _($('defs')).each(removeUnreferencedElementsInTag);

  // scour:
  // > Remove certain unreferenced elements outside of defs
  var identifiedElements = $('* > linearGradient[id], * > radialGradient[id], * > pattern[id]');
  
  _(identifiedElements).each(function(node) {
    var id = $(node).attr('id');
    if(!_(referencedIDs).has(id)) {
      $(node).remove();
    }
  });

}
912002
function mention(value, fromIndex) {
  var index = value.indexOf('@', fromIndex)

  if (index !== -1 && repo(value.charCodeAt(index - 1))) {
    return mention(value, index + 1)
  }

  return index
}
1026324
def remove(self, cls, originalMemberNameList, memberName, classNamingConvention):
        
        if memberName not in originalMemberNameList:
            delattr(cls, memberName)
54639
def remove_attendees(self, attendees):
    

    attendees_to_delete = self._build_resource_dictionary(attendees)
    for email in attendees_to_delete.keys():
      if email in self._attendees:
        del self._attendees[email]

    self._dirty_attributes.add(u'attendees')
408973
private static String discardBeginningHyphen(String string) {
		String noHyphenString = string;
		if (string.startsWith("-")) {
			noHyphenString = string.substring(1); // Oh well, just throw away
													// the awful "-". No one
													// will ever notice...
		}
		return noHyphenString;
	}
245705
def remove_all(self):
        ''''''
        if self._children:
            for child in self._children:
                if isinstance(child, String):
                    child._parent = None
            self._children = []
46918
def remove_member_data_in(self, leaderboard_name, member):
        '''
        
        '''
        self.redis_connection.hdel(
            self._member_data_key(leaderboard_name),
            member)
622114
def removeUnreferencedIDs(referencedIDs, identifiedElements):
    
    global _num_ids_removed
    keepTags = ['font']
    num = 0
    for id in identifiedElements:
        node = identifiedElements[id]
        if id not in referencedIDs and node.nodeName not in keepTags:
            node.removeAttribute('id')
            _num_ids_removed += 1
            num += 1
    return num
1093682
def _remove_references(self, removed_part):
        
        removed_part.parent = None

        # Remove labels in the hierarchy pointing to this part.
        referrers_to_remove = set()
        for referrer in removed_part.referrers:
            if removed_part not in referrer.ancestors():
                for label, referred_part in list(referrer.labels.items()):
                    if referred_part is removed_part:
                        del referrer.labels[label]
                        referrers_to_remove.add(referrer)
        removed_part.referrers -= referrers_to_remove

        # Remove labels in this part pointing into the hierarchy.
        labels_to_delete = []
        if isinstance(removed_part, Compound):
            for label, part in list(removed_part.labels.items()):
                if not isinstance(part, Compound):
                    for p in part:
                        self._remove_references(p)
                elif removed_part not in part.ancestors():
                    try:
                        part.referrers.discard(removed_part)
                    except KeyError:
                        pass
                    else:
                        labels_to_delete.append(label)
        for label in labels_to_delete:
            removed_part.labels.pop(label, None)