Return a URIReference of some PID string, assuming it is well-formed.
961646
public static SimpleURIReference toURIReference(String pidString) {
        SimpleURIReference ref = null;
        try {
            ref = new SimpleURIReference(new URI(toURI(pidString)));
        } catch (URISyntaxException e) {
            // assumes pid is well-formed
            throw new Error(e);
        }
        return ref;
    }
36323
def uri(self):
        """"""
        CheckParent(self)

        val = _fitz.Link_uri(self)

        if not val:
            val = ""
        else:
            nval = "".join([c for c in val if 32 <= ord(c) <= 127])
            val = nval


        return val
1249798
def lookupSpatialReferenceID(cls, directory, filename):
        

        path = os.path.join(directory, filename)

        with open(path, 'r') as f:
            srid = lookupSpatialReferenceID(f.read())

        return srid
1273844
function extractReferencedId(value) {
  var v = value.replace(/[\s]/g, '');
  if(v.indexOf('url') !== 0) {
    return false;
  }
  return value.replace(/[\s]/g, '').slice(4, -1).replace(/["']/g, '');
}
754641
def read_pid(self):
        
        try:
            with open(self._path, 'r') as f:
                s = f.read().strip()
                if not s:
                    return None
                return int(s)
        except IOError as e:
            if e.errno == errno.ENOENT:
                return None
            raise
395367
def relative_ref(self, baseURI):
        
        # workaround for posixpath bug in 2.6, doesn't generate correct
        # relative path when *start* (second) parameter is root ('/')
        if baseURI == '/':
            relpath = self[1:]
        else:
            relpath = posixpath.relpath(self, baseURI)
        return relpath
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
1146574
def read_pid_constants(self):
        """"""
        p = self._read_as_int(Addr.PConstant, 4)
        i = self._read_as_int(Addr.IConstant, 4)
        d = self._read_as_int(Addr.DConstant, 4)
        
        return map(lambda x: x / (2 ** 16), (p, i, d))
948936
def _str_sid(self):
    ''
    sub_auths = "-".join([str(sub) for sub in self.sub_authorities])
    return f'S-{self.revision_number}-{self.authority}-{sub_auths}'
875807
def _connected_pids(self, from_parent=True):
        
        to_pid = aliased(PersistentIdentifier, name='to_pid')
        if from_parent:
            to_relation = PIDRelation.child_id
            from_relation = PIDRelation.parent_id
        else:
            to_relation = PIDRelation.parent_id
            from_relation = PIDRelation.child_id
        query = PIDQuery(
            [to_pid], db.session(), _filtered_pid_class=to_pid
        ).join(
            PIDRelation,
            to_pid.id == to_relation
        )
        # accept both PersistentIdentifier models and fake PIDs with just
        # pid_value, pid_type as they are fetched with the PID fetcher.
        if isinstance(self.pid, PersistentIdentifier):
            query = query.filter(from_relation == self.pid.id)
        else:
            from_pid = aliased(PersistentIdentifier, name='from_pid')
            query = query.join(
                from_pid,
                from_pid.id == from_relation
            ).filter(
                from_pid.pid_value == self.pid.pid_value,
                from_pid.pid_type == self.pid.pid_type,
            )

        return query
386627
def iri2uri(uri):
	""""""

	assert uri != None, 'iri2uri must be passed a non-none string!'

	original = uri
	if isinstance(uri ,str):
		(scheme, authority, path, query, fragment) = urllib.parse.urlsplit(uri)
		authority = authority.encode('idna').decode('utf-8')
		# For each character in 'ucschar' or 'iprivate'
		#  1. encode as utf-8
		#  2. then %-encode each octet of that utf-8
		# path = urllib.parse.quote(path)
		uri = urllib.parse.urlunsplit((scheme, authority, path, query, fragment))
		uri = "".join([encode(c) for c in uri])

	# urllib.parse.urlunsplit(urllib.parse.urlsplit({something})
	# strips any trailing "?" chars. While this may be legal according to the
	# spec, it breaks some services. Therefore, we patch
	# the "?" back in if it has been removed.
	if original.endswith("?") and not uri.endswith("?"):
		uri = uri+"?"
	return uri
74056
def _uri(self, url):
        """"""
        if url and not url.startswith('/'):
            # Then this must be a proxy request.
            return url
        uri = "{0}://{1}{2}{3}".format(
            self._protocol,
            self.real_connection.host,
            self._port_postfix(),
            url,
        )
        return uri
497653
def get_uri(self):
    ''' 
    '''
    if hasattr(self, 'simage'):
        if self.simage is not None:
            if self.simage.image not in ['', None]:
                # Concatenates the <uri>://<image>
                return str(self.simage)
1219893
def _references(self, i, sequence=False):
        """"""

        value = ''

        c = next(i)
        if c == '\\':
            # \\
            if sequence and self.bslash_abort:
                raise PathNameException
            value = c
        elif c == '/':
            # \/
            if sequence:
                raise PathNameException
            i.rewind(1)
        else:
            # \a, \b, \c, etc.
            pass
        return value
1045630
def uri_from_parts(parts):
    ""
    uri = "%s://%s%s" % (parts[0], parts[1], parts[2])
    if parts[3]:
        extra = '?'+urlencode(parts[3])
        uri += extra
    return uri
751167
private static String getCidUriValue(String uri) {
		int colon = uri.indexOf(':');
		if (colon == 3) {
			String scheme = uri.substring(0, colon);
			return "cid".equalsIgnoreCase(scheme) ? uri.substring(colon + 1) : null;
		}

		if (uri.length() > 0 && uri.charAt(0) == '<' && uri.charAt(uri.length() - 1) == '>') {
			return uri.substring(1, uri.length() - 1);
		}

		return null;
	}
1004226
def resolve(self, pid):
        """"""
        client = d1_cli.impl.client.CLICNClient(
            **self._cn_client_connect_params_from_session()
        )
        object_location_list_pyxb = client.resolve(pid)
        for location in object_location_list_pyxb.objectLocation:
            d1_cli.impl.util.print_info(location.url)