Return a URI with the given part(s) replaced.

    Parts are decoded / encoded.
167188
def uri_with(uri, scheme=None, netloc=None, path=None, params=None, query=None, fragment=None):
    
    old_scheme, old_netloc, old_path, old_params, old_query, old_fragment = urlparse(uri)
    path, _netloc = _normalize_win_path(path)
    return urlunparse((
        scheme or old_scheme,
        netloc or old_netloc,
        path or old_path,
        params or old_params,
        query or old_query,
        fragment or old_fragment
    ))
1025496
def parse_uri(self, uri=None):

		'''
		
		'''

		# no uri provided, assume root
		if not uri:
			return rdflib.term.URIRef(self.root)

		# string uri provided
		elif type(uri) == str:

			# assume "short" uri, expand with repo root
			if type(uri) == str and not uri.startswith('http'):
				return rdflib.term.URIRef("%s%s" % (self.root, uri))

			# else, assume full uri
			else:
				return rdflib.term.URIRef(uri)

		# already rdflib.term.URIRef
		elif type(uri) == rdflib.term.URIRef:
			return uri

		# unknown input
		else:
			raise TypeError('invalid URI input')
1268899
def reconstruct_uri(environ):
    
    uri = environ.get('SCRIPT_NAME', '') + environ['PATH_INFO']
    if environ.get('QUERY_STRING'):
        uri += '?' + environ['QUERY_STRING']
    return uri
968554
public static String urlEncode(final String part) {
		try {
			return URLEncoder.encode(part, DEFAULT_URL_ENCODING);
		} catch (UnsupportedEncodingException e) {
			throw new ImpossibleException(e);
		}
	}
868428
function getUri1() {
  const startPos = pos;
  let content = [];

  if (checkSC(pos)) content = content.concat(getSC());

  while (pos < tokens[startPos].uri_end) {
    if (checkInterpolation(pos)) content.push(getInterpolation());
    else if (checkUriRaw(pos)) content.push(getUriRaw());
    else break;
  }

  if (checkSC(pos)) content = content.concat(getSC());

  return content;
}
535387
def geturi(self):
        """"""
        fragment = self.fragment
        if fragment is None:
            return self.uri
        elif isinstance(fragment, bytes):
            return self.uri + b'#' + fragment
        else:
            return self.uri + u'#' + fragment
1203010
def set_url_part(url, **kwargs):
    """"""
    d = parse_url_to_dict(url)

    d.update(kwargs)

    return unparse_url_dict(d)
293415
function encodeUriSegment(s) {
    return encodeUriString(s).replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/%26/gi, '&');
}
164498
public static URI replaceScheme(URI uri, String replace, String replacement) {
    if (replace != null && replace.equals(replacement)) {
      return uri;
    }
    try {
      if (replace != null && replace.equals(uri.getScheme())) {
        return new URI(replacement, uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), uri.getQuery(), uri.getFragment());
      } else {
        return uri;
      }
    } catch (URISyntaxException use) {
      throw new RuntimeException("Failed to replace scheme.");
    }
  }
664371
def basic_urisplit(uri):
    
    p = RFC3986_MATCHER(uri).groups()
    return (p[1], p[3], p[4], p[6], p[8])
274986
def resolve(self, uri=None, **parts):
		""""""
		
		if uri:
			result = self.__class__(urljoin(str(self), str(uri)))
		else:
			result = self.__class__(self)
		
		for part, value in parts.items():
			if part not in self.__all_parts__:
				raise TypeError("Unknown URI component: " + part)
			
			setattr(result, part, value)
		
		return result
812945
def get_uri_parts(self, value):
        
        if value.startswith('pyuri_'):
            value = self.rpyhttp(value)
        parts = self.parse_uri(value)
        try:
            return (self.ns_dict[parts[0]], parts[1])
        except KeyError:
            try:
                return (self.ns_dict[parts[0].lower()], parts[1])
            except KeyError:
                return ((None, parts[0]), parts[1])
74936
def join_all(self, *parts):
        
        url = util.join_all(self.domain, *parts)
        return url
258038
def _replace_qs(self, url, qs):
        
        url_parts = list(urlparse(url))
        url_parts[4] = qs
        return urlunparse(url_parts)
1079951
def _to_str(uri: URIRef) -> str:
        
        local_name = str(uri).replace(str(FHIR), '')
        return local_name.rsplit('.', 1)[1] if '.' in local_name else local_name
1366832
def _decode(self, data):
        
        if self.encoding:
            data = data.decode(self.encoding, 'replace')
        return data
433660
public static String decodeUri(String url)
	{
		int index1 = url.indexOf(sessUrlRewritePrefix);
		int index2 = url.indexOf(qMark);

		String tmp = null;
		if (index2 != -1 && index2 > index1)
		{
			tmp = url.substring(index2);
		}
		if (index1 != -1)
		{
			url = url.substring(0, index1);
			if (tmp != null)
			{
				url = url + tmp;
			}
		}
		return url;
	}