Build a /-separated string from an x509.Name.
509523
def _name_attribute_to_string(self, name):
        
        return "".join(
            "/{}={}".format(
                self._get_oid_name(attr.oid),
                attr.value,
            )
            for attr in name
        )
868727
def from_string(cls, string):
    """"""
    # Note: There is some ambiguity as to whether the string passed is intended
    # to become a unit looked up by name or suffix, or a Dimension descriptor.
    if string in units.UNITS_BY_ALL:
      return cls(description=string, unit=units.Unit(string))
    else:
      return cls(description=string)
528885
def from_name(cls, name):
        """"""
        result = cls.list()
        vlans = {}
        for vlan in result:
            vlans[vlan['name']] = vlan['id']

        return vlans.get(name)
877027
def _convert_string_name(self, k):
        """"""
        k = String(k, "iso-8859-1")
        klower = k.lower().replace('_', '-')
        bits = klower.split('-')
        return "-".join((bit.title() for bit in bits))
745440
def separate_namespace(qname):
    ""
    import re
    try:
        namespace, element_name = re.search('^{(.+)}(.+)$', qname).groups()
    except:
        namespace = None
        element_name = qname
    return namespace, element_name
947750
def libname_from_dir(dirname):
    """"""
    parts = []
    for part in dirname.split('-'):
        if part[0].isdigit():
            break
        parts.append(part)
    return '-'.join(parts)
137753
def format_general_name(name):
    

    if isinstance(name, x509.DirectoryName):
        value = format_name(name.value)
    else:
        value = name.value
    return '%s:%s' % (SAN_NAME_MAPPINGS[type(name)], value)
923413
def _split(string, splitters):
    """"""
    part = ''
    for character in string:
        if character in splitters:
            yield part
            part = ''
        else:
            part += character
    yield part
1042266
def from_string(vc):
        """"""
        try:
            # Note: this means all version controls must have
            # a title naming convention (!)
            vc = globals()[vc.title()]
            assert(issubclass(vc, VersionControl))
            return vc
        except (KeyError, AssertionError):
            raise NotImplementedError("Unknown version control system.")
368890
def _build_qname(self, uri=None, namespaces=None):
        
        if not uri:
            uri = self.uri
        if not namespaces:
            namespaces = self.namespaces
        return uri2niceString(uri, namespaces)
637823
def toXMLname(string):
    """"""
    if string.find(':') != -1 :
        (prefix, localname) = string.split(':',1)
    else:
        prefix = None
        localname = string
    
    T = unicode(localname)

    N = len(localname)
    X = [];
    for i in range(N) :
        if i< N-1 and T[i]==u'_' and T[i+1]==u'x':
            X.append(u'_x005F_')
        elif i==0 and N >= 3 and \
                 ( T[0]==u'x' or T[0]==u'X' ) and \
                 ( T[1]==u'm' or T[1]==u'M' ) and \
                 ( T[2]==u'l' or T[2]==u'L' ):
            X.append(u'_xFFFF_' + T[0])
        elif (not _NCNameChar(T[i])) or (i==0 and not _NCNameStartChar(T[i])):
            X.append(_toUnicodeHex(T[i]))
        else:
            X.append(T[i])
    
    if prefix:
        return "%s:%s" % (prefix, u''.join(X))
    return u''.join(X)
997358
static String generateFullMetricName(String name, String type) {
    return SOURCE + DELIMITER + name + DELIMITER + type;
  }
1236189
def compact_qname(ns_stack, name)
      return name if name.is_a?(String)

      local_part, prefix, uri = name
      raise "invalid name: #{name}" if !prefix && uri
      if prefix
        if prefix!="xmlns"
          ns = find_namespace_uri(ns_stack, prefix, uri)
          raise "namespace prefix not bound to a namespace: '#{prefix}'" if ! ns
        end
        [prefix, local_part].map{|s| s.to_s unless s.to_s.empty?}.compact.join(':')
      else
        local_part
      end
    end
226163
def split_recursive(self, decl_string):
        """"""
        assert self.has_pattern(decl_string)
        to_go = [decl_string]
        while to_go:
            name, args = self.split(to_go.pop())
            for arg in args:
                if self.has_pattern(arg):
                    to_go.append(arg)
            yield name, args
506776
def parse_name(self):
        """"""
        name = []
        while True:
            # Match the current char until it doesnt match the given pattern:
            # first char must be an uppercase alpha and the rest must be lower
            # cased alphas.
            part = self.match_string_pattern(spat.alphau, spat.alphal)
            if part == '':
                break  # There is no more matchable strings.
            self.eat_string(part)  # Eat the found string
            name.append(part)  # Store this name part
            if self.get_char() == ' ':  # if the current char is a single space
                # eat it. This allows one space between parts
                self.eat_length(1)

        if not len(name):  # if no name parts where detected raise an expection.
            raise PartpyError(self, 'Expecting a title cased name')
        return ' '.join(name)
756782
private static String extractPropertyName(final String name) {
        final int size = name.startsWith("is") ? 2 : 3;
        final char chars[] = name.substring(size).toCharArray();
        chars[0] = Character.toLowerCase(chars[0]);
        return new String(chars);
    }
859637
def build_extension_item(name: str, parameters: List[ExtensionParameter]) -> str:
    
    return "; ".join(
        [name]
        + [
            # Quoted strings aren't necessary because values are always tokens.
            name if value is None else f"{name}={value}"
            for name, value in parameters
        ]
    )