# Path: etils/epath/abstract_path.py
# T = TypeVar('T')
# def abstractmethod(fn: T) -> T:
#   def __new__(cls: Type[T], *args: PathLike) -> T:
#   def is_relative_to(self, *other: PathLike) -> bool:
#   def format(self: T, *args: Any, **kwargs: Any) -> T:
#   def exists(self) -> bool:
#   def is_dir(self) -> bool:
#   def is_file(self) -> bool:
#   def iterdir(self: T) -> Iterator[T]:
#   def glob(self: T, pattern: str) -> Iterator[T]:
#   def rglob(self: T, pattern: str) -> Iterator[T]:
#   def expanduser(self: T) -> T:
#   def resolve(self: T, strict: bool = False) -> T:
#   def open(
#       self,
#       mode: str = 'r',
#       encoding: Optional[str] = None,
#       errors: Optional[str] = None,
#       **kwargs: Any,
#   ) -> typing.IO[AnyStr]:
#   def read_bytes(self) -> bytes:
#   def read_text(self, encoding: Optional[str] = None) -> str:
#   def mkdir(
#       self,
#       mode: int = 0o777,
#       parents: bool = False,
#       exist_ok: bool = False,
#   ) -> None:
#   def rmdir(self) -> None:
#   def rmtree(self) -> None:
#   def unlink(self, missing_ok: bool = False) -> None:
#   def write_bytes(self, data: bytes) -> int:
#   def write_text(
#       self,
#       data: str,
#       encoding: Optional[str] = None,
#       errors: Optional[str] = None,
#   ) -> int:
#   def touch(self, mode: int = 0o666, exist_ok: bool = True) -> None:
#   def rename(self: T, target: PathLike) -> T:
#   def replace(self: T, target: PathLike) -> T:
#   def copy(self: T, dst: PathLike, overwrite: bool = False) -> T:
# class Path(pathlib.PurePosixPath):
# 
# Path: etils/epath/gpath.py
# _P = TypeVar('_P')
# URI_PREFIXES = ('gs://', 's3://')
# _URI_SCHEMES = frozenset(('gs', 's3'))
# _URI_MAP_ROOT = {
#     'gs://': '/gs/',
#     's3://': '/s3/',
# }
#   _PATH: ClassVar[types.ModuleType]
#   _PATH = posixpath
#   _PATH = ntpath
# class _GPath(abstract_path.Path):
# class PosixGPath(_GPath):
# class WindowsGPath(pathlib.PureWindowsPath, _GPath):
#   def __new__(cls: Type[_P], *parts: PathLike) -> _P:
#   def _new(self: _P, *parts: PathLike) -> _P:
#   def _uri_scheme(self) -> Optional[str]:
#   def _path_str(self) -> str:
#   def __fspath__(self) -> str:
#   def __str__(self) -> str:  # pylint: disable=invalid-str-returned
#   def __repr__(self) -> str:
#   def exists(self) -> bool:
#   def is_dir(self) -> bool:
#   def iterdir(self: _P) -> Iterator[_P]:
#   def expanduser(self: _P) -> _P:
#   def resolve(self: _P, strict: bool = False) -> _P:
#   def glob(self: _P, pattern: str) -> Iterator[_P]:
#   def mkdir(
#       self,
#       mode: int = 0o777,
#       parents: bool = False,
#       exist_ok: bool = False,
#   ) -> None:
#   def rmdir(self) -> None:
#   def rmtree(self) -> None:
#   def unlink(self, missing_ok: bool = False) -> None:
#   def open(
#       self,
#       mode: str = 'r',
#       encoding: Optional[str] = None,
#       errors: Optional[str] = None,
#       **kwargs: Any,
#   ) -> typing.IO[Union[str, bytes]]:
#   def rename(self: _P, target: PathLike) -> _P:
#   def replace(self: _P, target: PathLike) -> _P:
#   def copy(self: _P, dst: PathLike, overwrite: bool = False) -> _P:
# 
# Path: etils/epath/typing.py



import os
import typing
from typing import Callable, Dict, Tuple, Type, TypeVar
from etils.epath import abstract_path
from etils.epath import gpath
from etils.epath.typing import PathLike  # pylint: disable=g-multiple-import

  ```python
  @epath.register_path_cls('my_path://')
  class MyPath(pathlib.PurePosixPath):
    ...

  my_path = epath.Path('my_path://some-path')
  assert isinstance(my_path, MyPath)
  ```

  Args:
    path_cls_or_uri_prefix: If a uri prefix is given, then passing calling
      `tfds.core.as_path('prefix://path')` will call the decorated class.

  Returns:
    The decorator or decoratorated class
  """
  global _PATHLIKE_CLS
  if isinstance(path_cls_or_uri_prefix, str):

    def register_path_cls_decorator(cls: _T) -> _T:
      _URI_PREFIXES_TO_CLS[path_cls_or_uri_prefix] = cls
      return register_path_cls(cls)

    return register_path_cls_decorator
  else:
    _PATHLIKE_CLS = _PATHLIKE_CLS + (path_cls_or_uri_prefix,)
    return path_cls_or_uri_prefix



# Path: etils/epath/abstract_path.py
# T = TypeVar('T')
# def abstractmethod(fn: T) -> T:
#   def __new__(cls: Type[T], *args: PathLike) -> T:
#   def is_relative_to(self, *other: PathLike) -> bool:
#   def format(self: T, *args: Any, **kwargs: Any) -> T:
#   def exists(self) -> bool:
#   def is_dir(self) -> bool:
#   def is_file(self) -> bool:
#   def iterdir(self: T) -> Iterator[T]:
#   def glob(self: T, pattern: str) -> Iterator[T]:
#   def rglob(self: T, pattern: str) -> Iterator[T]:
#   def expanduser(self: T) -> T:
#   def resolve(self: T, strict: bool = False) -> T:
#   def open(
#       self,
#       mode: str = 'r',
#       encoding: Optional[str] = None,
#       errors: Optional[str] = None,
#       **kwargs: Any,
#   ) -> typing.IO[AnyStr]:
#   def read_bytes(self) -> bytes:
#   def read_text(self, encoding: Optional[str] = None) -> str:
#   def mkdir(
#       self,
#       mode: int = 0o777,
#       parents: bool = False,
#       exist_ok: bool = False,
#   ) -> None:
#   def rmdir(self) -> None:
#   def rmtree(self) -> None:
#   def unlink(self, missing_ok: bool = False) -> None:
#   def write_bytes(self, data: bytes) -> int:
#   def write_text(
#       self,
#       data: str,
#       encoding: Optional[str] = None,
#       errors: Optional[str] = None,
#   ) -> int:
#   def touch(self, mode: int = 0o666, exist_ok: bool = True) -> None:
#   def rename(self: T, target: PathLike) -> T:
#   def replace(self: T, target: PathLike) -> T:
#   def copy(self: T, dst: PathLike, overwrite: bool = False) -> T:
# class Path(pathlib.PurePosixPath):
# 
# Path: etils/epath/gpath.py
# _P = TypeVar('_P')
# URI_PREFIXES = ('gs://', 's3://')
# _URI_SCHEMES = frozenset(('gs', 's3'))
# _URI_MAP_ROOT = {
#     'gs://': '/gs/',
#     's3://': '/s3/',
# }
#   _PATH: ClassVar[types.ModuleType]
#   _PATH = posixpath
#   _PATH = ntpath
# class _GPath(abstract_path.Path):
# class PosixGPath(_GPath):
# class WindowsGPath(pathlib.PureWindowsPath, _GPath):
#   def __new__(cls: Type[_P], *parts: PathLike) -> _P:
#   def _new(self: _P, *parts: PathLike) -> _P:
#   def _uri_scheme(self) -> Optional[str]:
#   def _path_str(self) -> str:
#   def __fspath__(self) -> str:
#   def __str__(self) -> str:  # pylint: disable=invalid-str-returned
#   def __repr__(self) -> str:
#   def exists(self) -> bool:
#   def is_dir(self) -> bool:
#   def iterdir(self: _P) -> Iterator[_P]:
#   def expanduser(self: _P) -> _P:
#   def resolve(self: _P, strict: bool = False) -> _P:
#   def glob(self: _P, pattern: str) -> Iterator[_P]:
#   def mkdir(
#       self,
#       mode: int = 0o777,
#       parents: bool = False,
#       exist_ok: bool = False,
#   ) -> None:
#   def rmdir(self) -> None:
#   def rmtree(self) -> None:
#   def unlink(self, missing_ok: bool = False) -> None:
#   def open(
#       self,
#       mode: str = 'r',
#       encoding: Optional[str] = None,
#       errors: Optional[str] = None,
#       **kwargs: Any,
#   ) -> typing.IO[Union[str, bytes]]:
#   def rename(self: _P, target: PathLike) -> _P:
#   def replace(self: _P, target: PathLike) -> _P:
#   def copy(self: _P, dst: PathLike, overwrite: bool = False) -> _P:
# 
# Path: etils/epath/typing.py



# Path: etils/epath/register.py
import os
import typing
from typing import Callable, Dict, Tuple, Type, TypeVar
from etils.epath import abstract_path
from etils.epath import gpath
from etils.epath.typing import PathLike  # pylint: disable=g-multiple-import


  ```python
  @epath.register_path_cls('my_path://')
  class MyPath(pathlib.PurePosixPath):
    ...

  my_path = epath.Path('my_path://some-path')
  assert isinstance(my_path, MyPath)
  ```

  Args:
    path_cls_or_uri_prefix: If a uri prefix is given, then passing calling
      `tfds.core.as_path('prefix://path')` will call the decorated class.

  Returns:
    The decorator or decoratorated class
  """
  global _PATHLIKE_CLS
  if isinstance(path_cls_or_uri_prefix, str):

    def register_path_cls_decorator(cls: _T) -> _T:
      _URI_PREFIXES_TO_CLS[path_cls_or_uri_prefix] = cls
      return register_path_cls(cls)

    return register_path_cls_decorator
  else:
    _PATHLIKE_CLS = _PATHLIKE_CLS + (path_cls_or_uri_prefix,)
    return path_cls_or_uri_prefix



def make_path(path: PathLike) -> abstract_path.Path: