# Path: etils/epath/typing.py



import os
import pathlib
import typing
from typing import Any, AnyStr, Iterator, Optional, Type, TypeVar
from etils.epath.typing import PathLike
    from etils.epath import register  # pylint: disable=g-import-not-at-top

  See [pathlib.Path](https://docs.python.org/3/library/pathlib.html)
  documentation.

  """

  def __new__(cls: Type[T], *args: PathLike) -> T:
    """Create a new path.

    ```python
    path = abcpath.Path()
    ```

    Args:
      *args: Paths to create

    Returns:
      path: The registered path
    """
    if cls == Path:
      if not args:
        return register.make_path('.')
      root, *parts = args
      return register.make_path(root).joinpath(*parts)
    else:
      return super().__new__(cls, *args)

  # ====== Pure paths ======

  # py3.9 backport of PurePath.is_relative_to.

# Path: etils/epath/typing.py



# Path: etils/epath/abstract_path.py
import os
import pathlib
import typing
from typing import Any, AnyStr, Iterator, Optional, Type, TypeVar
from etils.epath.typing import PathLike
    from etils.epath import register  # pylint: disable=g-import-not-at-top


  See [pathlib.Path](https://docs.python.org/3/library/pathlib.html)
  documentation.

  """

  def __new__(cls: Type[T], *args: PathLike) -> T:
    """Create a new path.

    ```python
    path = abcpath.Path()
    ```

    Args:
      *args: Paths to create

    Returns:
      path: The registered path
    """
    if cls == Path:
      if not args:
        return register.make_path('.')
      root, *parts = args
      return register.make_path(root).joinpath(*parts)
    else:
      return super().__new__(cls, *args)

  # ====== Pure paths ======

  # py3.9 backport of PurePath.is_relative_to.

  def is_relative_to(self, *other: PathLike) -> bool: