Return the literal representation of a compound tag.
169045
def serialize_compound(self, tag):
        """"""
        separator, fmt = self.comma, '{{{}}}'

        with self.depth():
            if self.should_expand(tag):
                separator, fmt = self.expand(separator, fmt)

            return fmt.format(separator.join(
                f'{self.stringify_compound_key(key)}{self.colon}{self.serialize(value)}'
                for key, value in tag.items()
            ))
1286117
public T load(CompoundTag tag) {
        Tag subTag = tag.getValue().get(key);
        if (subTag == null) {
            return (value = defaultValue);
        }
        return (value = field.getValue(subTag));
    }
787622
def parse_nbt(literal):
    """"""
    parser = Parser(tokenize(literal))
    tag = parser.parse()

    cursor = parser.token_span[1]
    leftover = literal[cursor:]
    if leftover.strip():
        parser.token_span = cursor, cursor + len(leftover)
        raise parser.error(f'Expected end of string but got {leftover!r}')

    return tag
269649
def get_previous_tag(cls, el):
        """"""

        sibling = el.previous_sibling
        while not cls.is_tag(sibling) and sibling is not None:
            sibling = sibling.previous_sibling
        return sibling
345765
def get_representation(self, prefix="", suffix="\n"):
        """"""
        res = prefix + "Section " + self.get_section_name().upper() + suffix
        return res
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
1099336
def get_tag_value(x, key):
    """"""
    if x is None:
        return ''
    result = [y['Value'] for y in x if y['Key'] == key]
    if result:
        return result[0]
    return ''
541128
function getTag(val) {
  const tag = Object.prototype.toString.call(val).slice(8, -1)

  if (basicTypes.includes(tag.toLowerCase())) {
    return tag.toLowerCase()
  }

  return tag
}
687378
def p_regex_literal(self, p):
        """"""
        p[0] = self.asttypes.Regex(p[1])
        p[0].setpos(p)
147589
def getXmlText (parent, tag):
    """"""
    elem = parent.getElementsByTagName(tag)[0]
    # Yes, the DOM standard is awful.
    rc = []
    for node in elem.childNodes:
        if node.nodeType == node.TEXT_NODE:
            rc.append(node.data)
    return ''.join(rc)
1195307
def tag(*tags):
    '''
    
    '''
    def dfn(fn):
        _tags = getattr(fn, 'tags', set())
        _tags.update(tags)
        fn.tags = _tags
        return fn
    return dfn
93831
def tag(ctx, input, output):
    """"""
    log.info('chemdataextractor.pos.tag')
    log.info('Reading %s' % input.name)
    doc = Document.from_file(input)
    for element in doc.elements:
        if isinstance(element, Text):
            for sentence in element.sentences:
                output.write(u' '.join(u'/'.join([token, tag]) for token, tag in sentence.pos_tagged_tokens))
                output.write(u'\n')
223677
def translate_sbml_compound(entry, new_id, compartment_map):
    """"""
    new_entry = DictCompoundEntry(entry, id=new_id)

    if 'compartment' in new_entry.properties:
        old_compartment = new_entry.properties['compartment']
        new_entry.properties['compartment'] = compartment_map.get(
            old_compartment, old_compartment)

    # Get XHTML notes properties
    for key, value in iteritems(parse_xhtml_species_notes(entry)):
        if key not in new_entry.properties:
            new_entry.properties[key] = value

    return new_entry
1239297
function getImmediateCustomParentTag(tag) {
  var ptag = tag;
  while (ptag.__.isAnonymous) {
    if (!ptag.parent) { break }
    ptag = ptag.parent;
  }
  return ptag
}
692172
def tag_namespace(cls, tag):
        """"""
        md = re.match("^(?:\{([^\}]*)\})", tag)
        if md is not None:
            return md.group(1)
138907
def decodeTagAttributes(self, text):
		""""""
		attribs = {}
		if text.strip() == u'':
			return attribs
		scanner = _attributePat.scanner(text)
		match = scanner.search()
		while match:
			key, val1, val2, val3, val4 = match.groups()
			value = val1 or val2 or val3 or val4
			if value:
				value = _space.sub(u' ', value).strip()
			else:
				value = ''
			attribs[key] = self.decodeCharReferences(value)

			match = scanner.search()
		return attribs
1011617
def compound_id(obj):
    """"""
    if isinstance(obj, (Category, Session)):
        raise TypeError('Compound IDs are not supported for this entry type')
    elif isinstance(obj, Event):
        return unicode(obj.id)
    elif isinstance(obj, Contribution):
        return '{}.{}'.format(obj.event_id, obj.id)
    elif isinstance(obj, SubContribution):
        return '{}.{}.{}'.format(obj.contribution.event_id, obj.contribution_id, obj.id)