Parses the sole integer value with name tag_name in tag t. Heavy-handed with the asserts.
511635
def parse_singular_int(t, tag_name):
    ''''''
    pos = t.getElementsByTagName(tag_name)
    assert(len(pos) == 1)
    pos = pos[0]
    assert(len(pos.childNodes) == 1)
    v = pos.childNodes[0].data
    assert(v.isdigit()) # no floats allowed
    return int(v)
1240416
def validate_tag(self, tag_name, prefix=None):
        
        new_version = semantic_version(tag_name)
        current = self.latest()
        if current:
            tag_name = current['tag_name']
            if prefix:
                tag_name = tag_name[len(prefix):]
            tag_name = semantic_version(tag_name)
            if tag_name >= new_version:
                what = 'equal to' if tag_name == new_version else 'older than'
                raise GithubException(
                    'Your local version "%s" is %s '
                    'the current github version "%s".\n'
                    'Bump the local version to '
                    'continue.' %
                    (
                        str(new_version),
                        what,
                        str(tag_name)
                    )
                )
        return current
1344334
def _really_parse_tag(self):
        """"""
        data = _TagOpenData()
        self._push(contexts.TAG_OPEN)
        self._emit(tokens.TagOpenOpen())
        while True:
            this, next = self._read(), self._read(1)
            can_exit = (not data.context & (data.CX_QUOTED | data.CX_NAME) or
                        data.context & data.CX_NOTE_SPACE)
            if this is self.END:
                if self._context & contexts.TAG_ATTR:
                    if data.context & data.CX_QUOTED:
                        # Unclosed attribute quote: reset, don't die
                        data.context = data.CX_ATTR_VALUE
                        self._memoize_bad_route()
                        self._pop()
                        self._head = data.reset
                        continue
                    self._pop()
                self._fail_route()
            elif this == ">" and can_exit:
                self._handle_tag_close_open(data, tokens.TagCloseOpen)
                self._context = contexts.TAG_BODY
                if is_single_only(self._stack[1].text):
                    return self._handle_single_only_tag_end()
                if is_parsable(self._stack[1].text):
                    return self._parse(push=False)
                return self._handle_blacklisted_tag()
            elif this == "/" and next == ">" and can_exit:
                self._handle_tag_close_open(data, tokens.TagCloseSelfclose)
                return self._pop()
            else:
                self._handle_tag_data(data, this)
            self._head += 1
130251
public String getTagValue(String tagName) {
        String value = null;

        if (mReadMethod != null) {
            value = mReadMethod.getTagValue(tagName);
        }
        if (value == null && mWriteMethod != null) {
            value = mWriteMethod.getTagValue(tagName);
        }

        return value;
    }
1204009
def _extract_tag_value(self, entity, tag_name):
        
        if tag_name not in TAG_EXTRACTORS:
            self.warning("{0} isn't a supported tag".format(tag_name))
            return

        # Check for already extracted tags
        if "_tag_values" not in entity:
            entity["_tag_values"] = {}

        if tag_name not in entity["_tag_values"]:
            entity["_tag_values"][tag_name] = TAG_EXTRACTORS[tag_name](entity)

        return entity["_tag_values"][tag_name]
228921
def parse_tag (self, tag, attr, value, name, base):
        """"""
        assert isinstance(tag, unicode), repr(tag)
        assert isinstance(attr, unicode), repr(attr)
        assert isinstance(name, unicode), repr(name)
        assert isinstance(base, unicode), repr(base)
        assert isinstance(value, unicode) or value is None, repr(value)
        # look for meta refresh
        if tag == u'meta' and value:
            mo = refresh_re.match(value)
            if mo:
                self.found_url(mo.group("url"), name, base)
            elif attr != 'content':
                self.found_url(value, name, base)
        elif attr == u'style' and value:
            for mo in css_url_re.finditer(value):
                url = unquote(mo.group("url"), matching=True)
                self.found_url(url, name, base)
        elif attr == u'archive':
            for url in value.split(u','):
                self.found_url(url, name, base)
        elif attr == u'srcset':
            for img_candidate in value.split(u','):
                url = img_candidate.split()[0]
                self.found_url(url, name, base)
        else:
            self.found_url(value, name, base)
856575
function(schema, raw_tag) {

		if (Lava.schema.DEBUG && (!raw_tag.content || raw_tag.content.length != 1 || typeof (raw_tag.content[0]) != 'string')) Lava.t("One string expected in tag content: " + raw_tag.name);
		return Lava.valueToType(schema, raw_tag.content[0]);

	}
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
1196976
def tag_value(self, p_key, p_default=None):
        
        return self.tag_values(p_key)[0] if p_key in self.fields['tags'] else p_default
1351559
def string_tag(name, value):
    """"""
    return name.encode('utf-8') + \
        len(value).to_bytes(4, byteorder='big') + \
        value.encode('utf-8')
398908
def as_name(value)
      case true
      when value.tag?
        element(value).name
      when value.dicom_name?
        @methods_from_names.has_key?(value) ? value.to_s : nil
      when value.dicom_method?
        @names_from_methods[value.to_sym]
      else
        nil
      end
    end
654581
private void parseAttDef(String elementName) throws Exception {
        String name;
        String type;
        String enumer = null;

        // Read the attribute name.
        name = readNmtoken(true);

        // Read the attribute type.
        requireWhitespace();
        type = readAttType();

        // Get the string of enumerated values if necessary.
        if (handler.stringInterning) {
            if (("ENUMERATION" == type) || ("NOTATION" == type)) {
                enumer = dataBufferToString();
            }
        } else {
            if ("ENUMERATION".equals(type) || "NOTATION".equals(type)) {
                enumer = dataBufferToString();
            }
        }

        // Read the default value.
        requireWhitespace();
        parseDefault(elementName, name, type, enumer);
    }
428234
def parse_symbol attr_name, xpath
      v = parse_value xpath
      v = v.to_sym unless v.nil?
      send("#{attr_name}=", v)
    end
468450
def get_tag_value(resource, tag, utf_8=False):
        """"""

        tags = {k.lower(): v for k, v in resource.get('tags', {}).items()}
        value = tags.get(tag, False)

        if value is not False:
            if utf_8:
                value = value.encode('utf8').decode('utf8')
        return value
87054
function parsePrimitive(info, name, value) {
  var result = value

  if (info.number || info.positiveNumber) {
    if (!isNaN(result) && result !== '') {
      result = Number(result)
    }
  } else if (info.boolean || info.overloadedBoolean) {
    /* Accept `boolean` and `string`. */
    if (
      typeof result === 'string' &&
      (result === '' || normalize(value) === normalize(name))
    ) {
      result = true
    }
  }

  return result
}
1104749
private void parseTagkRule() {
    final List<UIDMeta> tags = meta.getTags();
    if (tags == null || tags.isEmpty()) {
      throw new IllegalStateException(
        "Tags for the timeseries meta were null");
    }
    
    String tag_name = "";
    boolean found = false;
    
    // loop through each tag pair. If the tagk matches the requested field name
    // then we flag it as "found" and on the next pass, grab the tagv name. This
    // assumes we have a list of [tagk, tagv, tagk, tagv...] pairs. If not, 
    // we're screwed
    for (UIDMeta uidmeta : tags) {
      if (uidmeta.getType() == UniqueIdType.TAGK && 
          uidmeta.getName().equals(rule.getField())) {
        found = true;
      } else if (uidmeta.getType() == UniqueIdType.TAGV && found) {
        tag_name = uidmeta.getName();
        break;
      }
    }
    
    // if we didn't find a match, return
    if (!found || tag_name.isEmpty()) {
      testMessage("No match on tagk [" + rule.getField() + "] for rule: " + 
          rule);
      return;
    }
    
    // matched!
    testMessage("Matched tagk [" + rule.getField() + "] for rule: " + rule);
    processParsedValue(tag_name);    
  }
642996
def tag_value(prefix)
      tag = nil
      tag = @startup_tags && @startup_tags.detect { |t| t =~ /^#{prefix}/ }
      value = tag[prefix.size + 1..-1] if tag
      value
    end