Find the first tag in `tags` with a type set to `key`.
966478
function find(tags, key) {
  var value = null

  tags.some(function(tag) {
    if (tag && tag.type === key) {
      value = tag

      return true
    }

    return false
  })

  return value && value.string
}
945090
def get_tag(self, key, *, case_sensitive=True):
        
        key = key if case_sensitive else key.lower()
        for tag in self.resource.tags:
            if not case_sensitive:
                if tag.key.lower() == key:
                    return tag
            elif key == tag.key:
                return tag

        return None
896684
def findTypeParent(element, tag):
    

    p = element
    while True:
        p = p.getparent()
        if p.tag == tag:
            return p

    # Not found
    return None
1065995
def tags(self, value): # pylint: disable-msg=E0102
        """"""
        if not isinstance(value, list):
            raise TypeError
        self._config['tags'] = value
829398
def start_tag(self) -> str:
        """"""
        tag = '<' + self.tag
        attrs = self._get_attrs_by_string()
        if attrs:
            tag = ' '.join((tag, attrs))
        return tag + '>'
247907
private function getIndex($key, $tags)
    {
        // tags folder
        $tagFolder = $this->createFolderNameFromTags($tags);

        if (!is_dir($tagFolder)) {
            mkdir($tagFolder, 0755, true);
        }

        // key folder
        $folder = $tagFolder . substr($key, 0, 2) . DIRECTORY_SEPARATOR . substr($key, 2,
                2) . DIRECTORY_SEPARATOR . substr($key, 4, 2) . DIRECTORY_SEPARATOR;
        if (!is_dir($folder)) {
            mkdir($folder, 0755, true);
        }

        // check if index exists
        return $folder . 'index.db';
    }
1338681
function selectTags(tags) {
  // select all tags
  if (!tags) {
    var keys = Object.keys(__TAG_IMPL);
    return keys + selectTags(keys)
  }

  return tags
    .filter(function (t) { return !/[^-\w]/.test(t); })
    .reduce(function (list, t) {
      var name = t.trim().toLowerCase();
      return list + ",[" + IS_DIRECTIVE + "=\"" + name + "\"]"
    }, '')
}
951843
def _get_tag(self, name):
        """"""
        if name.endswith("_"):
            if name[:-1] in self._schema.reserved:
                return name[:-1]
        return name
1244740
def getElementsByTagName(start_node: ParentNode, tag: str) -> NodeList:
    """"""
    _tag = tag.upper()
    return getElementsBy(start_node, lambda node: node.tagName == _tag)
755024
def process_tags(inst_tags):
    """"""
    tag_dict = {}
    for k in range(len(inst_tags)):
        tag_dict[inst_tags[k]['Key']] = inst_tags[k]['Value']
    return tag_dict
735473
def tag(self, *tags):
        
        if not all(isinstance(tag, collections.Hashable) for tag in tags):
            raise TypeError('Tags must be hashable')
        self.tags.update(tags)
        return self
716412
def tag(self, *tag, **kwtags):
        """"""
        if not tag:
            pass
        elif len(tag) == 1 and isinstance(tag[0], dict):
            self._meta.update(tag[0])
        else:
            raise TypeError('Tags must be provided as key-word arguments or '
                            'a dictionary')
        self._meta.update(kwtags)
        return self
1156672
public String getStringTag(String key) {
		Object value = tags.get(key);
		if (value instanceof String) {
			return (String) value;
		}
		return null;
	}
287132
def tag(self, tokens):
        """"""
        tags = []
        for token in tokens:
            normalized = self.lexicon[token].normalized
            for regex, tag in self.regexes:
                if regex.match(normalized):
                    tags.append((token, tag))
                    break
            else:
                tags.append((token, None))
        return tags
52950
def get(self, tags):
        """"""
        # Try to find our name
        value = tags.get(self.name, '')

        for name in self.alternate_tags:
            # Iterate of alternates until a non-empty value is found
            value = value or tags.get(name, '')

        # If we still have nothing, return our default
        value = value or self.default
        return value
1167358
def component_by_tags(self, tags):
        
        tags_keys = [t['key'] for t in tags]
        filtered = [
            c for c in self.components
            if set(tags_keys).issubset([ct['key'] for ct in c.tags])]
        return filtered
466883
def _first(self, tag):
		'''  '''

		self.getelements()
		for element in self.elements:
			if tag in self.pos(element):
				return element
		return None