iri: IRIREF | prefixedName 
            prefixedName: PNAME_LN | PNAME_NS
486321
def iri_to_iriref(self, iri_: ShExDocParser.IriContext) -> ShExJ.IRIREF:
        
        return ShExJ.IRIREF(self.iri_to_str(iri_))
1183065
def _prepend_name(self, prefix, dict_):
        ''''''
        return dict(['.'.join([prefix, name]), msg]
                    for name, msg in dict_.iteritems())
418893
function getGraphqlName(g, iri) {
  const { prefixes } = g.config;
  const localName = getIriLocalName(iri);
  const namespaceIri = iri.slice(0, -localName.length);

  const prefix = Object.keys(prefixes).find(key => prefixes[key] === namespaceIri) || '';

  return capitalize(prefix + localName).replace(/\W/g, '_');
}
69005
def clean_iri(uri_string):
    ''''''
    uri_string = str(uri_string).strip()
    if uri_string[:1] == "<" and uri_string[len(uri_string)-1:] == ">":
        uri_string = uri_string[1:len(uri_string)-1]
    return uri_string
1087187
def iri_to_uri(value, normalize=False):
    

    if not isinstance(value, str_cls):
        raise TypeError(unwrap(
            '''
            value must be a unicode string, not %s
            ''',
            type_name(value)
        ))

    scheme = None
    # Python 2.6 doesn't split properly is the URL doesn't start with http:// or https://
    if sys.version_info < (2, 7) and not value.startswith('http://') and not value.startswith('https://'):
        real_prefix = None
        prefix_match = re.match('^[^:]*://', value)
        if prefix_match:
            real_prefix = prefix_match.group(0)
            value = 'http://' + value[len(real_prefix):]
        parsed = urlsplit(value)
        if real_prefix:
            value = real_prefix + value[7:]
            scheme = _urlquote(real_prefix[:-3])
    else:
        parsed = urlsplit(value)

    if scheme is None:
        scheme = _urlquote(parsed.scheme)
    hostname = parsed.hostname
    if hostname is not None:
        hostname = hostname.encode('idna')
    # RFC 3986 allows userinfo to contain sub-delims
    username = _urlquote(parsed.username, safe='!$&\'()*+,;=')
    password = _urlquote(parsed.password, safe='!$&\'()*+,;=')
    port = parsed.port
    if port is not None:
        port = str_cls(port).encode('ascii')

    netloc = b''
    if username is not None:
        netloc += username
        if password:
            netloc += b':' + password
        netloc += b'@'
    if hostname is not None:
        netloc += hostname
    if port is not None:
        default_http = scheme == b'http' and port == b'80'
        default_https = scheme == b'https' and port == b'443'
        if not normalize or (not default_http and not default_https):
            netloc += b':' + port

    # RFC 3986 allows a path to contain sub-delims, plus "@" and ":"
    path = _urlquote(parsed.path, safe='/!$&\'()*+,;=@:')
    # RFC 3986 allows the query to contain sub-delims, plus "@", ":" , "/" and "?"
    query = _urlquote(parsed.query, safe='/?!$&\'()*+,;=@:')
    # RFC 3986 allows the fragment to contain sub-delims, plus "@", ":" , "/" and "?"
    fragment = _urlquote(parsed.fragment, safe='/?!$&\'()*+,;=@:')

    if normalize and query is None and fragment is None and path == b'/':
        path = None

    # Python 2.7 compat
    if path is None:
        path = ''

    output = urlunsplit((scheme, netloc, path, query, fragment))
    if isinstance(output, str_cls):
        output = output.encode('latin1')
    return output
662528
function(prefix)
{
   var count = -1;
   var ng = {
      next: function()
      {
         ++count;
         return ng.current();
      },
      current: function()
      {
         return '_:' + prefix + count;
      },
      inNamespace: function(iri)
      {
         return iri.indexOf('_:' + prefix) === 0;
      }
   };
   return ng;
}
282207
def _posix_split_name(self, name):
        
        prefix = name[:LENGTH_PREFIX + 1]
        while prefix and prefix[-1] != "/":
            prefix = prefix[:-1]

        name = name[len(prefix):]
        prefix = prefix[:-1]

        if not prefix or len(name) > LENGTH_NAME:
            raise ValueError("name is too long")
        return prefix, name
982993
def iri(uri_string):
        
        uri_string = str(uri_string)
        if uri_string[:1] == "?":
            return uri_string
        if uri_string[:1] == "[":
            return uri_string
        if uri_string[:1] != "<":
            uri_string = "<{}".format(uri_string.strip())
        if uri_string[len(uri_string)-1:] != ">":
            uri_string = "{}>".format(uri_string.strip())
        return uri_string
975948
def peer_retrieve_by_prefix(prefix, relation_name='cluster', delimiter='_',
                            inc_list=None, exc_list=None):
    
    inc_list = inc_list if inc_list else []
    exc_list = exc_list if exc_list else []
    peerdb_settings = peer_retrieve('-', relation_name=relation_name)
    matched = {}
    if peerdb_settings is None:
        return matched
    for k, v in peerdb_settings.items():
        full_prefix = prefix + delimiter
        if k.startswith(full_prefix):
            new_key = k.replace(full_prefix, '')
            if new_key in exc_list:
                continue
            if new_key in inc_list or len(inc_list) == 0:
                matched[new_key] = v
    return matched
198704
def view_prefix(arg, opts, shell_opts):
    
    # Internally, this function searches in the prefix column which means that
    # hosts have a prefix length of 32/128 while they are normally displayed
    # with the prefix length of the network they are in. To allow the user to
    # input either, e.g. 1.0.0.1 or 1.0.0.1/31 we strip the prefix length bits
    # to assume /32 if the address is not a network address. If it is the
    # network address we always search using the specified mask. In certain
    # cases there is a host with the network address, typically when /31 or /127
    # prefix lengths are used, for example 1.0.0.0/31 and 1.0.0.0/32 (first host
    # in /31 network) in which case it becomes necessary to distinguish between
    # the two using the mask.
    try:
        # this fails if bits are set on right side of mask
        ip = IPy.IP(arg)
    except ValueError:
        arg = arg.split('/')[0]

    q = { 'prefix': arg }

    v = get_vrf(opts.get('vrf_rt'), abort=True)
    if v.rt != 'all':
        q['vrf_rt'] = v.rt

    res = Prefix.list(q)

    if len(res) == 0:
        vrf_text = 'any VRF'
        if v.rt != 'all':
            vrf_text = vrf_format(v)
        print("Address %s not found in %s." % (arg, vrf_text), file=sys.stderr)
        sys.exit(1)

    p = res[0]
    vrf = p.vrf.rt

    print("-- Address ")
    print("  %-26s : %s" % ("Prefix", p.prefix))
    print("  %-26s : %s" % ("Display prefix", p.display_prefix))
    print("  %-26s : %s" % ("Type", p.type))
    print("  %-26s : %s" % ("Status", p.status))
    print("  %-26s : IPv%s" % ("Family", p.family))
    print("  %-26s : %s" % ("VRF", vrf))
    print("  %-26s : %s" % ("Description", p.description))
    print("  %-26s : %s" % ("Node", p.node))
    print("  %-26s : %s" % ("Country", p.country))
    print("  %-26s : %s" % ("Order", p.order_id))
    print("  %-26s : %s" % ("Customer", p.customer_id))
    print("  %-26s : %s" % ("VLAN", p.vlan))
    print("  %-26s : %s" % ("Alarm priority", p.alarm_priority))
    print("  %-26s : %s" % ("Monitor", p.monitor))
    print("  %-26s : %s" % ("Added", p.added))
    print("  %-26s : %s" % ("Last modified", p.last_modified))
    print("  %-26s : %s" % ("Expires", p.expires or '-'))
    if p.family == 4:
        print("  %-26s : %s / %s (%.2f%% of %s)" % ("Addresses Used / Free", p.used_addresses,
                p.free_addresses, (float(p.used_addresses)/p.total_addresses)*100,
                p.total_addresses))
    else:
        print("  %-26s : %.4e / %.4e (%.2f%% of %.4e)" % ("Addresses Used / Free", p.used_addresses,
                p.free_addresses, (float(p.used_addresses)/p.total_addresses)*100,
                p.total_addresses))
    print("-- Extra Attributes")
    if p.avps is not None:
        for key in sorted(p.avps, key=lambda s: s.lower()):
            print("  %-26s : %s" % (key, p.avps[key]))
    print("-- Tags")
    for tag_name in sorted(p.tags, key=lambda s: s.lower()):
        print("  %s" % tag_name)
    print("-- Inherited Tags")
    for tag_name in sorted(p.inherited_tags, key=lambda s: s.lower()):
        print("  %s" % tag_name)
    print("-- Comment")
    print(p.comment or '')
706541
@SuppressWarnings("rawtypes")
    private List<InetAddress> resolve(String hostname, String attrName) throws NamingException, UnknownHostException {

        Attributes attrs = context.getAttributes(hostname, new String[] { attrName });

        List<InetAddress> inetAddresses = new ArrayList<>();
        Attribute attr = attrs.get(attrName);

        if (attr != null && attr.size() > 0) {
            NamingEnumeration e = attr.getAll();

            while (e.hasMore()) {
                InetAddress inetAddress = InetAddress.getByName("" + e.next());
                inetAddresses.add(InetAddress.getByAddress(hostname, inetAddress.getAddress()));
            }
        }

        return inetAddresses;
    }
988338
def prefixedname_to_str(self, prefix: ShExDocParser.PrefixedNameContext) -> str:
        
        if prefix.PNAME_NS():
            return self._lookup_prefix(prefix.PNAME_NS().getText())
        else:
            prefix, local = prefix.PNAME_LN().getText().split(':', 1)
            return self._lookup_prefix(prefix + ':') + (local if local else "")
850928
def _prepend_name_prefix(self, name):
        """"""
        if not self.name_prefix:
            return name
        base = self.name_prefix
        if base[0] != '/':
            base = '/' + base
        if name[0] != '/':
            name = '/' + name
        return base + name
1132264
def prefixes(self):
        
        pset = set()
        for n in self.nodes():
            pfx = self.prefix(n)
            if pfx is not None:
                pset.add(pfx)
        return list(pset)
1054507
def inferNamespacePrefix(aUri):
    
    stringa = aUri.__str__()
    try:
        prefix = stringa.replace("#", "").split("/")[-1]
    except:
        prefix = ""
    return prefix
1150573
def _get_nr_prefix(i):
    
    for lookup_range, prefix_string in _nr_prefix_strings.items():
        if i in lookup_range:
            return prefix_string
    raise ValueError("No prefix string associated with {0}!".format(i))
1036371
def ns_prefix(self, prefix, ns_uri):
        
        self._element.set_ns_prefix(prefix, ns_uri)
        return self