# Path: ubelt/util_io.py
# def writeto(fpath, to_write, aslines=False, verbose=None):
# def _ensure_bytes(text):
# def readfrom(fpath, aslines=False, errors='replace', verbose=None):
# def touch(fpath, mode=0o666, dir_fd=None, verbose=0, **kwargs):
# def delete(path, verbose=False):


from os.path import (
    dirname, exists, expanduser, expandvars, join, normpath, split, splitext,
)
from ubelt import util_io
        from ubelt import util_platform
import os
import sys
import pathlib
                import pwd
            import pwd
        import ubelt as ub
        import tempfile
            import shutil
        new = self.__class__(aug)
        return new

    def delete(self):
        """
        Removes a file or recursively removes a directory.
        If a path does not exist, then this is does nothing.

        SeeAlso:
            :func:`ubelt.delete`

        Returns:
            Path: reference to self

        Example:
            >>> import ubelt as ub
            >>> from os.path import join
            >>> base = ub.Path(ub.ensure_app_cache_dir('ubelt', 'delete_test2'))
            >>> dpath1 = (base / 'dir').ensuredir()
            >>> (base / 'dir' / 'subdir').ensuredir()
            >>> (base / 'dir' / 'to_remove1.txt').touch()
            >>> fpath1 = (base / 'dir' / 'subdir' / 'to_remove3.txt').touch()
            >>> fpath2 = (base / 'dir' / 'subdir' / 'to_remove2.txt').touch()
            >>> assert all(p.exists() for p in [dpath1, fpath1, fpath2])
            >>> fpath1.delete()
            >>> assert all(p.exists() for p in [dpath1, fpath2])
            >>> assert not fpath1.exists()
            >>> dpath1.delete()
            >>> assert not any(p.exists() for p in [dpath1, fpath1, fpath2])
        """

# Path: ubelt/util_io.py
# def writeto(fpath, to_write, aslines=False, verbose=None):
# def _ensure_bytes(text):
# def readfrom(fpath, aslines=False, errors='replace', verbose=None):
# def touch(fpath, mode=0o666, dir_fd=None, verbose=0, **kwargs):
# def delete(path, verbose=False):


# Path: ubelt/util_path.py
from os.path import (
    dirname, exists, expanduser, expandvars, join, normpath, split, splitext,
)
from ubelt import util_io
        from ubelt import util_platform
import os
import sys
import pathlib
                import pwd
            import pwd
        import ubelt as ub
        import tempfile
            import shutil

        new = self.__class__(aug)
        return new

    def delete(self):
        """
        Removes a file or recursively removes a directory.
        If a path does not exist, then this is does nothing.

        SeeAlso:
            :func:`ubelt.delete`

        Returns:
            Path: reference to self

        Example:
            >>> import ubelt as ub
            >>> from os.path import join
            >>> base = ub.Path(ub.ensure_app_cache_dir('ubelt', 'delete_test2'))
            >>> dpath1 = (base / 'dir').ensuredir()
            >>> (base / 'dir' / 'subdir').ensuredir()
            >>> (base / 'dir' / 'to_remove1.txt').touch()
            >>> fpath1 = (base / 'dir' / 'subdir' / 'to_remove3.txt').touch()
            >>> fpath2 = (base / 'dir' / 'subdir' / 'to_remove2.txt').touch()
            >>> assert all(p.exists() for p in [dpath1, fpath1, fpath2])
            >>> fpath1.delete()
            >>> assert all(p.exists() for p in [dpath1, fpath2])
            >>> assert not fpath1.exists()
            >>> dpath1.delete()
            >>> assert not any(p.exists() for p in [dpath1, fpath1, fpath2])
        """

        util_io.delete(self)