Lower-case all attribute names of the provided BeautifulSoup tag.
    Note: this mutates the tag's attribute names and does not return a new
    tag.

    :param Tag: BeautifulSoup tag
358783
def lowercase_attr_names(tag):
    
    # Use list comprehension instead of dict comprehension for 2.6 support
    tag.attrs = dict([
        (key.lower(), value)
        for key, value in iteritems(tag.attrs)
    ])
989364
def as_tag(value)
      case true
      when value.tag?
        element(value) ? value : nil
      when value.dicom_name?
        get_tag(value)
      when value.dicom_method?
        get_tag(@names_from_methods[value.to_sym])
      else
        nil
      end
    end
1151487
def _group_flat_tags(tag, tags):
    
    grouped = [tag]
    name = tag.get('name', '').lower()
    while tags and tags[0].get('name', '').lower() == name:
        grouped.append(tags.pop(0))
    return grouped
1343578
def _label_to_tag(self, name, labels, scraper_config, tag_name=None):
        
        value = labels.get(name)
        if value:
            return self._format_tag(tag_name or name, value, scraper_config)
        else:
            return None
252973
def _in_tag(self, tagname, attributes=None):
        
        node = self.cur_node
        while not node is None:
            if node.tag == tagname:
                if attributes and node.attrib == attributes:
                    return True

                elif attributes:
                    return False

                return True

            node = node.getparent()
        return False
849888
def _all_tag(self):
        
        all_tag = self.get_conf_value('all')
        if len(all_tag) == 0:
            return False
        else:
            return all_tag[0].lower() == 'true'
641505
def tags(self):
        
        tag_list = self.spec.get('tag', [])
        if isinstance(tag_list, (list, set, tuple)):
            return list(tag_list)
        return [tag_list]
340423
def removeTags(dom):
    
    # python 2 / 3 shill
    try:
        string_type = basestring
    except NameError:
        string_type = str

    # initialize stack with proper value (based on dom parameter)
    element_stack = None
    if type(dom) in [list, tuple]:
        element_stack = dom
    elif isinstance(dom, HTMLElement):
        element_stack = dom.childs if dom.isTag() else [dom]
    elif isinstance(dom, string_type):
        element_stack = parseString(dom).childs
    else:
        element_stack = dom

    # remove all tags
    output = ""
    while element_stack:
        el = element_stack.pop(0)

        if not (el.isTag() or el.isComment() or not el.getTagName()):
            output += el.__str__()

        if el.childs:
            element_stack = el.childs + element_stack

    return output
1003536
def normalizeToTag(val):
    
    try:
        val = val.upper()
    except AttributeError:
        raise KeyError("{} is not a tag or name string".format(val))
    if val not in tagsAndNameSetUpper:
        raise KeyError("{} is not a tag or name string".format(val))
    else:
        try:
            return fullToTagDictUpper[val]
        except KeyError:
            return val
393945
def add_attribute(self, tag, name, value):
        
        self.add_tag(tag)
        d = self._tags[tag]
        d[name] = value
875719
def get_lib_and_tag_name(tag):
    
    if '.' not in tag:
        raise ValueError('Tag string must be in the format "tag_lib.tag_name"')
    lib = tag.rpartition('.')[0]
    tag_name = tag.rpartition('.')[-1]
    return lib, tag_name
447657
function isNullEndTag(tagName) {
  let names = ['br', 'hr', 'img', 'input', 'link', 'meta'];
  tagName = tagName ? tagName.toLowerCase() : '';
  return names.indexOf(tagName) > -1 ? true : false;
}
958043
def tags(self):
        """"""
        if not self.raw_content:
            return set()
        return {word.strip("#").lower() for word in self.raw_content.split() if word.startswith("#") and len(word) > 1}
724325
protected function _filterTag($tag)
    {
        // Parse the tag into:
        // 1. a starting delimiter (mandatory)
        // 2. a tag name (if available)
        // 3. a string of attributes (if available)
        // 4. an ending delimiter (if available)
        $isMatch = preg_match('~(</?)(\w*)((/(?!>)|[^/>])*)(/?>)~', $tag, $matches);

        // If the tag does not match, then strip the tag entirely
        if (!$isMatch) {
            return '';
        }

        // Save the matches to more meaningfully named variables
        $tagStart = $matches[1];
        $tagName = strtolower($matches[2]);
        $tagAttributes = $matches[3];
        $tagEnd = $matches[5];

        // If the tag is not an allowed tag, then remove the tag entirely
        if (!isset($this->_tagsAllowed[$tagName])) {
            return '';
        }

        // Trim the attribute string of whitespace at the ends
        $tagAttributes = trim($tagAttributes);

        // If there are non-whitespace characters in the attribute string
        if (strlen($tagAttributes)) {
            // Parse iteratively for well-formed attributes
            preg_match_all('/(\w+)\s*=\s*(?:(")(.*?)"|(\')(.*?)\')/s', $tagAttributes, $matches);

            // Initialize valid attribute accumulator
            $tagAttributes = '';

            // Iterate over each matched attribute
            foreach ($matches[1] as $index => $attributeName) {
                $attributeName = strtolower($attributeName);
                $attributeDelimiter = $matches[2][$index];
                $attributeValue = $matches[3][$index];

                // If the attribute is not allowed, then remove it entirely
                if (!array_key_exists($attributeName, $this->_tagsAllowed[$tagName]) && !array_key_exists($attributeName, $this->_attributesAllowed)) {
                    continue;
                }
                // Add the attribute to the accumulator
                $tagAttributes .= " $attributeName=" . $attributeDelimiter . $attributeValue . $attributeDelimiter;
            }
        }

        // Reconstruct tags ending with "/>" as backwards-compatible XHTML tag
        if (strpos($tagEnd, '/') !== false) {
            $tagEnd = " $tagEnd";
        }

        // Return the filtered tag
        return $tagStart . $tagName . $tagAttributes . $tagEnd;
    }
1141090
def find_by_tag(self, tag) -> Dict[str, Set[Parameter]]:
        
        return self.tags[tag]
949606
def tags(self):
        # type: () -> Set[str]
        
        tags = set()
        if self._tags:
            tags.update(self._tags)
        if self.binding:
            binding_tags = getattr(self.binding, 'tags', None)
            if binding_tags:
                tags.update(binding_tags)
        return tags
679885
def build_tag(self, tag, text='', attrs=None):
        
        """
        return '%s%s%s' % (self.tag_start(tag, attrs), text, self.tag_end(tag))