class_docstr: Represents a URI, supporting path appending and retrieving parent URIs.
  
  Example Usage:
  
      >>> s3_uri = URI("s3://bucket/a?scheme=http&param=1")
      >>> s3_uri
      URI<s3://bucket/a?scheme=http&param=1>
      >>> str(s3_uri / "b" / "c")
      's3://bucket/a/b/c?scheme=http&param=1'
      >>> str(s3_uri.parent)
      's3://bucket?scheme=http&param=1'
      >>> str(s3_uri)
      's3://bucket/a?scheme=http&param=1'
      >>> s3_uri.parent.name, s3_uri.name
      ('bucket', 'a')
      >>> local_path = URI("/tmp/local")
      >>> str(local_path)
      '/tmp/local'
      >>> str(local_path.parent)
      '/tmp'
      >>> str(local_path / "b" / "c")
      '/tmp/local/b/c'
  
  Args:
      uri: The URI to represent.
          Ex: s3://bucket?scheme=http&endpoint_override=localhost%3A900
          Ex: file:///a/b/c/d
docstr: Returns a new URI that strips the given subpath from the end of this URI.
  
  Example:
      >>> uri = URI("s3://bucket/a/b/c/?param=1")
      >>> str(uri.rstrip_subpath(Path("b/c")))
      's3://bucket/a?param=1'
  
      >>> uri = URI("/tmp/a/b/c/")
      >>> str(uri.rstrip_subpath(Path("/b/c/.//")))
      '/tmp/a'
docstr_tok: ["Returns","a","new","URI","that","strips","the","given","subpath","from","the","end","of","this","URI",".","Example",":",">",">",">","uri","=","URI","(","``","s3",":","\/\/bucket\/a\/b\/c\/","?","param=1","''",")",">",">",">","str","(","uri.rstrip_subpath","(","Path","(","``","b\/c","''",")",")",")","'s3",":","\/\/bucket\/a","?","param=1'",">",">",">","uri","=","URI","(","``","\/tmp\/a\/b\/c\/","''",")",">",">",">","str","(","uri.rstrip_subpath","(","Path","(","``","\/b\/c\/.\/\/","''",")",")",")","'\/tmp\/a","'"]
code: def rstrip_subpath(self, subpath: Path) -> "URI":
      """Returns a new URI that strips the given subpath from the end of this URI.
  
      Example:
          >>> uri = URI("s3://bucket/a/b/c/?param=1")
          >>> str(uri.rstrip_subpath(Path("b/c")))
          's3://bucket/a?param=1'
  
          >>> uri = URI("/tmp/a/b/c/")
          >>> str(uri.rstrip_subpath(Path("/b/c/.//")))
          '/tmp/a'
  
      """
      assert str(self._path).endswith(str(subpath)), (
          self._path,
          subpath,
      )
      stripped_path = str(self._path).replace(str(subpath), "")
      return URI(
          self._get_str_representation(self._parsed, stripped_path)
      )
  
file_path: ray/python/ray/air/_internal/uri_utils.py
imports: from pathlib import Path
  import urllib.parse
  import os
  from typing import Union
label_desc: Use image node_id 2 for calling the URI obj's underlying member method code with example usage: obj.rstrip_subpath(subpath) and returns: URI