
    'j                       d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZmZmZmZmZ ddlmZ  ej        e          5  ddlZddd           n# 1 swxY w Y    ej        e          5  ddlZddd           n# 1 swxY w Y    ej        e          5  ddl Z ddd           n# 1 swxY w Y   ddl!m"Z"m#Z#m$Z$ ddl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ e'rddl%m,Z, dd	l-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3 dd
l4m5Z5m6Z6m7Z7 e,e8e*e8ge9f         df         Z:e*e8e8ge;f         Z<e*e8e=e8         ge#e8         f         Z>e*e*de(f         e8e.ge;f         Z?e*e*de(f         e8e@ge;f         ZAddlBmCZCmDZDmEZE ddlFmGZGmHZH g dZIg dZJeJg dz   ZK ejL        dM                    eJ          N                                          ZO ejL        dM                    eK                    ZP ejL        eOjQ        dz             ZR ejL        ePjQ        dz             ZS e;            ZTd7dZU G d deV          ZW G d d          ZXd8d!ZY G d" d#e8          ZZ G d$ d%e[          Z\d9d(Z] G d) d*eZ          Z^ G d+ d,eZ          Z_ G d- d.          Z` G d/ d0          Za G d1 d2eaeZ          Zb G d3 d4eZ          Zc G d5 d6          ZddS ):a  
Path Pie

Implements ``path.Path`` - An object representing a
path to a file or directory.

Example::

    from path import Path
    d = Path('/home/guido/bin')

    # Globbing
    for f in d.files('*.py'):
        f.chmod(0o755)

    # Changing the working directory:
    with Path("somewhere"):
        # cwd in now `somewhere`
        ...

    # Concatenate paths with /
    foo_txt = Path("bar") / "foo.txt"
    )annotationsN)BufferedRandomBufferedReaderBufferedWriterFileIOTextIOWrapper)
ModuleType)	GeneratorIterableIterator)IOTYPE_CHECKINGAnyBinaryIOCallableoverload)Union)ExcInfoOpenBinaryModeOpenBinaryModeReadingOpenBinaryModeUpdatingOpenBinaryModeWritingOpenTextMode)LiteralNeverSelf.   )classesmasksmatchers)removeprefixremovesuffix)PathTempDir	Traversal)z

)   u    u    |   $$valuefloat | datetime.datetimereturnintc                    t          | t          t          f          r| n|                                 }t          |dz            S )Ni ʚ;)
isinstancefloatr/   	timestamp)r,   timestamp_ss     G/DATA/AppData/hermes/venv/lib/python3.11/site-packages/path/__init__.py_make_timestamp_nsr6   k   s;    %eeS\::Q%%@Q@QK{U"###    c                      e Zd ZdS )TreeWalkWarningN__name__
__module____qualname__ r7   r5   r9   r9   p           Dr7   r9   c                  "    e Zd ZdZddZdd	Zd
S )r%   ap  
    Wrap a walk result to customize the traversal.

    `follow` is a function that takes an item and returns
    True if that item should be followed and False otherwise.

    For example, to avoid traversing into directories that
    begin with `.`:

    >>> traverse = Traversal(lambda dir: not dir.startswith('.'))
    >>> items = list(traverse(Path('.').walk()))

    Directories beginning with `.` will appear in the results, but
    their children will not.

    >>> dot_dir = next(item for item in items if item.is_dir() and item.startswith('.'))
    >>> any(item.parent == dot_dir for item in items)
    False
    followCallable[[Path], bool]c                    || _         d S N)rA   )selfrA   s     r5   __init__zTraversal.__init__   s    r7   walker0Generator[Path, Callable[[], bool] | None, None]r.   Iterator[Path]c              #     K   d }	 	 |                     |          }n# t          $ r Y d S w xY w|V  t          j        | j        |          }GrD   )sendStopIteration	functoolspartialrA   )rE   rG   traverseitems       r5   __call__zTraversal.__call__   sn       	<{{8,,    JJJ (d;;H	<s    
++N)rA   rB   )rG   rH   r.   rI   )r;   r<   r=   __doc__rF   rQ   r>   r7   r5   r%   r%   t   sF         (   < < < < < <r7   r%   linesIterable[str]Iterator[str]c                    d | D             S )zZ
    >>> list(_strip_newlines(['Hello World\r\n', 'foo']))
    ['Hello World', 'foo']
    c              3  L   K   | ]}t                               d |          V   dS ) N)U_NL_ENDsub.0lines     r5   	<genexpr>z"_strip_newlines.<locals>.<genexpr>   s0      55tHLLT""555555r7   r>   rS   s    r5   _strip_newlinesr`      s    
 65u5555r7   c                      e Zd ZU dZej        Zded<   	 d&d' fd	Zd&d(dZ	d)dZ
eej        d*d                        Zej        ed+d                        Zd, fdZd- fdZd.dZd/dZd/dZd0dZd)dZed             Zed1d            Zd0dZd0dZd0dZd0dZd0d Zd0d!Z d0d"Z!d0d#Z"d0d$Z#e$d,d%            Z%d2d'Z&e$d0d(            Z'd3d*Z(e$d0d+            Z)e$d0d,            Z*e$d0d-            Z+d4d/Z,d5d1Z-d6d3Z.d5d4Z/d0d5Z0ej1        d7d8            Z2d8d:Z3d9d<Z4d:d>Z5d:d?Z6d&d;dAZ7d<dCZ8d=d>dHZ9d=d?dJZ:d=d?dKZ;	 d@dAdOZ<d@dBdPZ=d@dBdQZ>	 d=dCdVZ?dDdWZ@dEdXZAeB	 	 	 	 	 	 	 dFdGdf            ZCeB	 	 	 	 	 dHdIdj            ZCeB	 	 	 	 	 	 dJdKdn            ZCeB	 	 	 	 	 	 dJdLdq            ZCeB	 	 	 	 	 	 dJdMdt            ZCeB	 	 	 	 	 	 dJdNdv            ZCeB	 	 	 	 	 	 dJdOdx            ZCdy ZCdPd{ZDeB	 	 	 	 	 	 	 dQdRd~            ZEeB	 	 	 	 	 	 dSdTd            ZEeB	 	 	 	 	 	 dSdUd            ZEd ZEdVdWdZFdXdYdZGdPdZHdDdLejI        dfdZdZJ	 	 	 d[d\dZK	 	 d@ddd]dZLeMd^d            ZNdPdZOd_dZPdPdZQd,dZRd`dZSd`dZTd`dZUd`dZVd`dZWd`dZXdadZYdbdZZdcdZ[e$dbd            Z\e\j]        dcd            Z\dbdZ^dcdZ_e$dbd            Z`e`j]        dcd            Z`dbdZae$dbd            ZbdddZce$ddd            Zde$ded            ZedDddZddfdZfdZddgdZgdhdZheijj        dk    rd,dZknd,dZke$d,d            Zleijj        dk    rdZddidZmdjdÄZndkdńZoeB	 d=dDdZdƜdldɄ            ZpeB	 d=dDdZdƜdmd̄            Zpd0d̈́Zpdnd΄Zqeijj        dk    rdodpd҄ZrdqdԄZsdqdՄZtdr fdׄZudsdtdلZvdsdtdڄZwdsdtdۄZxdsdtd܄Zyd0d݄Zzd0dބZ{d0d߄Z|d0dZ}d0dZ~d0dZd0dZeZeZdudZdvdZdVdwdZd=dxdZd0dZd0dZdZddydZdZddzdZdZddzdZdZddydZdZddydZddDej        ddfd{dZej        fd|dZeij        dk    r=eBdYdYdd}d            ZeB	 d~dYdYdd}d            ZeB	 d~dYdYddd            ZnXeij        dk    r+eB	 d=dDddd
            ZeB	 d~dYddd            Zn!eBd~dd            ZeB	 d~dd            Zd Zej        j        e_        ej        j        e_        ej        j        e_        ej        j        e_        ej        j        e_        ej        j        e_        ej        j        e_        ej        j        e_        d0dZd)dZeZ	 dVej        d dddZeijj        dk    rd)dZeijj        dk    rUeij        dk    r'eB	 	 	 ddd            ZeB	 	 	 ddd            ZneBd0d            ZeBdd            Zd0dZej        	 	 	 	 	 	 ddd#            Zej        edd%                        Z xZS (  r#   a  
    Represents a filesystem path.

    For documentation on individual methods, consult their
    counterparts in :mod:`os.path`.

    Some methods are additionally included from :mod:`shutil`.
    The functions are linked directly into the class namespace
    such that they will be bound to the Path instance. For example,
    ``Path(src).copy(target)`` is equivalent to
    ``shutil.copy(src, target)``. Therefore, when referencing
    the docs for these methods, assume `src` references `self`,
    the Path instance.
    r	   module.otherr   r.   r   c                H    t                                          | |          S rD   )super__new__)clsrd   	__class__s     r5   rg   zPath.__new__   s    wwsE***r7   Nonec                P    |t          d          |                                  d S )Nz$Invalid initial value for path: None)	TypeError	_validaterE   rd   s     r5   rF   zPath.__init__   s,    =BCCCr7   c                    d S rD   r>   rE   s    r5   rm   zPath._validate       r7   
type[Self]c                V    | j         dz   |j         z   }| f}d|i}t          |||          S )N_rb   r;   type)rh   rb   subclass_namebasesnss        r5   using_modulezPath.using_module   s:     s*V_<M5"---r7   c                    | S )zV
        What class should be used to construct new instances from this class
        r>   rh   s    r5   _next_classzPath._next_class   s	     
r7   strc                t    t          |           j         dt                                                       dS )N())rv   r;   rf   __repr__)rE   ri   s    r5   r   zPath.__repr__   s3    t**%==(8(8(:(:====r7   morec                l    |                      t                                          |                    S rD   )r}   rf   __add__)rE   r   ri   s     r5   r   zPath.__add__   s'     5 5666r7   c                R    |                      |                    |                     S rD   )r}   r   rn   s     r5   __radd__zPath.__radd__   s"    d 3 3444r7   relc                ^    |                      | j                            | |                    S )zfp.__truediv__(rel) == fp / rel == fp.joinpath(rel)

        Join two path components, adding a separator character if
        needed.

        .. seealso:: :func:`os.path.join`
        r}   rb   joinrE   r   s     r5   __truediv__zPath.__truediv__   s*      0 0s ; ;<<<r7   c                ^    |                      | j                            ||                     S )zfp.__rtruediv__(rel) == rel / fp

        Join two path components, adding a separator character if
        needed.

        .. seealso:: :func:`os.path.join`
        r   r   s     r5   __rtruediv__zPath.__rtruediv__   s*      0 0d ; ;<<<r7   c                `    |                                  | _        t          j        |            | S rD   )cwd_old_diroschdirrp   s    r5   	__enter__zPath.__enter__   s#    


r7   c                8    t          j        | j                   d S rD   )r   r   r   rE   rt   s     r5   __exit__zPath.__exit__   s    
r7   c                :     | t          j                              S )zgReturn the current working directory as a path object.

        .. seealso:: :func:`os.getcwd`
        )r   getcwdr|   s    r5   r   zPath.cwd   s     s29;;r7   c                R     | t           j                            d                    S )N~)r   path
expanduserr|   s    r5   homez	Path.home  s"    s27%%c**+++r7   c                \    |                      | j                            |                     S )z$.. seealso:: :func:`os.path.abspath`)r}   rb   abspathrp   s    r5   absolutezPath.absolute  &     3 3D 9 9:::r7   c                \    |                      | j                            |                     S )z%.. seealso:: :func:`os.path.normcase`)r}   rb   normcaserp   s    r5   r   zPath.normcase  &     4 4T : :;;;r7   c                \    |                      | j                            |                     S )z%.. seealso:: :func:`os.path.normpath`)r}   rb   normpathrp   s    r5   r   zPath.normpath  r   r7   c                \    |                      | j                            |                     S )z%.. seealso:: :func:`os.path.realpath`)r}   rb   realpathrp   s    r5   r   zPath.realpath  r   r7   c                \    |                      | j                            |                     S )z'.. seealso:: :func:`os.path.expanduser`)r}   rb   r   rp   s    r5   r   zPath.expanduser  &     6 6t < <===r7   c                \    |                      | j                            |                     S )z'.. seealso:: :func:`os.path.expandvars`)r}   rb   
expandvarsrp   s    r5   r   zPath.expandvars   r   r7   c                \    |                      | j                            |                     S )z4.. seealso:: :attr:`parent`, :func:`os.path.dirname`)r}   rb   dirnamerp   s    r5   r   zPath.dirname$  r   r7   c                \    |                      | j                            |                     S )z3.. seealso:: :attr:`name`, :func:`os.path.basename`)r}   rb   basenamerp   s    r5   r   zPath.basename(  r   r7   c                r    |                                                                                                  S )zClean up a filename by calling :meth:`expandvars()`,
        :meth:`expanduser()`, and :meth:`normpath()` on it.

        This is commonly everything needed to clean up a filename
        read from a configuration file, for example.
        )r   r   r   rp   s    r5   expandzPath.expand,  s,       ++--66888r7   c                J    | j                             | j                  \  }}|S )zThe same as :meth:`name`, but with one file extension stripped off.

        >>> Path('/home/guido/python.tar.gz').stem
        'python.tar'
        )rb   splitextname)rE   basert   s      r5   stemz	Path.stem5  s$     +&&ty11ar7   r   c                <    |                      || j        z             S )zReturn a new path with the stem changed.

        >>> Path('/home/guido/python.tar.gz').with_stem("foo")
        Path('/home/guido/foo.gz')
        )	with_namesuffix)rE   r   s     r5   	with_stemzPath.with_stem?  s     ~~dT[0111r7   c                @    | j                             |           \  }}|S )z*The file extension, for example ``'.py'``.)rb   r   )rE   rt   r   s      r5   r   zPath.suffixG  s"     K((..	6r7   r   c                ~    |                     d          st          d|          |                                 |z   S )a  Return a new path with the file suffix changed (or added, if none)

        >>> Path('/home/guido/python.tar.gz').with_suffix(".foo")
        Path('/home/guido/python.tar.foo')

        >>> Path('python').with_suffix('.zip')
        Path('python.zip')

        >>> Path('filename.ext').with_suffix('zip')
        Traceback (most recent call last):
        ...
        ValueError: Invalid suffix 'zip'
        rc   zInvalid suffix )
startswith
ValueErrorstripext)rE   r   s     r5   with_suffixzPath.with_suffixM  sD       %% 	;9v99:::}}''r7   c                f    | j                             |           \  }}|                     |          S )z}The drive specifier, for example ``'C:'``.

        This is always empty on systems that don't use drive specifiers.
        rb   
splitdriver}   )rE   drivert   s      r5   r   z
Path.drive_  s1     ;))$//q&&&r7   c                *    |                                  S )zThis path's parent directory, as a new Path object.

        For example,
        ``Path('/usr/local/lib/libpython.so').parent ==
        Path('/usr/local/lib')``

        .. seealso:: :meth:`dirname`, :func:`os.path.dirname`
        )r   rp   s    r5   parentzPath.parenth  s     ||~~r7   c                *    |                                  S )zThe name of this file or directory without the full path.

        For example,
        ``Path('/usr/local/lib/libpython.so').name == 'libpython.so'``

        .. seealso:: :meth:`basename`, :func:`os.path.basename`
        )r   rp   s    r5   r   z	Path.namet  s     }}r7   r   c                X    |                      t          | | j                  |z             S )zReturn a new path with the name changed.

        >>> Path('/home/guido/python.tar.gz').with_name("foo.zip")
        Path('/home/guido/foo.zip')
        )r}   r"   r   rE   r   s     r5   r   zPath.with_name  s)     T49 = = DEEEr7   tuple[Self, str]c                j    | j                             |           \  }}|                     |          |fS )z~Return two-tuple of ``.parent``, ``.name``.

        .. seealso:: :attr:`parent`, :attr:`name`, :func:`os.path.split`
        )rb   splitr}   )rE   r   childs      r5   	splitpathzPath.splitpath  s6    
 ))$//''..r7   tuple[Self, Self]c                    | j                             |           \  }}|                     |          |                     |          fS )aC  Return two-tuple of ``.drive`` and rest without drive.

        Split the drive specifier from this path.  If there is
        no drive specifier, :samp:`{p.drive}` is empty, so the return value
        is simply ``(Path(''), p)``.  This is always the case on Unix.

        .. seealso:: :func:`os.path.splitdrive`
        r   )rE   r   r   s      r5   r   zPath.splitdrive  sD     [++D11
s&&(8(8(=(===r7   c                j    | j                             |           \  }}|                     |          |fS )a  Return two-tuple of ``.stripext()`` and ``.ext``.

        Split the filename extension from this path and return
        the two parts.  Either part may be empty.

        The extension is everything from ``'.'`` to the end of the
        last path segment.  This has the property that if
        ``(a, b) == p.splitext()``, then ``a + b == p``.

        .. seealso:: :func:`os.path.splitext`
        )rb   r   r}   )rE   filenameexts      r5   r   zPath.splitext  s6     ,,T22#))3..r7   c                6    |                                  d         S )zRemove one file extension from the path.

        For example, ``Path('/home/guido/python.tar.gz').stripext()``
        returns ``Path('/home/guido/python.tar')``.
        r   )r   rp   s    r5   r   zPath.stripext  s     }}q!!r7   firstothersc                N    |                       | j        j        |g|R            S )a  
        Join first to zero or more :class:`Path` components,
        adding a separator character (:samp:`{first}.module.sep`)
        if needed.  Returns a new instance of
        :samp:`{first}._next_class`.

        .. seealso:: :func:`os.path.join`
        r   )rh   r   r   s      r5   joinpathzPath.joinpath  s,     szu>v>>>???r7   list[Self | str]c                D    t          |                                           S )a  Return a list of the path components in this path.

        The first item in the list will be a Path.  Its value will be
        either :data:`os.curdir`, :data:`os.pardir`, empty, or the root
        directory of this path (for example, ``'/'`` or ``'C:\\'``).  The
        other items in the list will be strings.

        ``Path.joinpath(*result)`` will yield the original path.

        >>> Path('/foo/bar/baz').splitall()
        [Path('/'), 'foo', 'bar', 'baz']
        )list_partsrp   s    r5   splitallzPath.splitall  s     DKKMM"""r7   tuple[Self | str, ...]c                D    t          |                                           S )z[
        >>> Path('/foo/bar/baz').parts()
        (Path('/'), 'foo', 'bar', 'baz')
        )tupler   rp   s    r5   partsz
Path.parts  s    
 T[[]]###r7   Iterator[Self | str]c                ^    t          t          |                                                     S rD   )reversedr   _parts_iterrp   s    r5   r   zPath._parts  s$    d..0011222r7   c              #     K   | }|t           j        k    rT|t           j        k    rD|}|                                \  }}||k    rn$|V  |t           j        k    r|t           j        k    D|V  d S rD   )r   curdirpardirr   )rE   locprevr   s       r5   r   zPath._parts_iter  s{      RY3")#3#3D))JCd{{KKK RY3")#3#3 					r7   startc                V    |                      |          }|                    |           S )zzReturn this path as a relative path,
        based from `start`, which defaults to the current working directory.
        )r}   	relpathto)rE   r   r   s      r5   relpathzPath.relpath  s)     u%%}}T"""r7   destc                   |                                  }|                     |                                           }|                                                                }|                                }|d         | j                            |d                   k    r|S d}t          ||          D ]*\  }}|| j                            |          k    r n|dz  }+t          j        gt          |          |z
  z  }	|	||d         z  }	t          |	          dk    rt          j	        }
n | j        j
        |	 }
|                     |
          S )zReturn a relative path from `self` to `dest`.

        If there is no relative path from `self` to `dest`, for example if
        they reside on different drives in Windows, then this returns
        ``dest.absolute()``.
        r   r   N)r   r}   r   r   rb   zipr   r   lenr   r   )rE   r   origin	dest_path	orig_list	dest_listi	start_segdest_segsegmentsr   s              r5   r   zPath.relpathto  sA    $$T**3355	OO%%..00	&&((	Q<4;//	!==== #&y)#<#< 	 	IxDK00::::FAA
 I;#i..1"45IabbM!x==AiGG&dk&1G(((r7   Nmatch_MatchIterator[Self]c                     t          j        |          }t          | fdt          j                   D                       S )a}  Yields items in this directory.

        Use :meth:`files` or :meth:`dirs` instead if you want a listing
        of just files or just subdirectories.

        The elements of the list are Path objects.

        With the optional `match` argument, a callable,
        only return items whose names match the given pattern.

        .. seealso:: :meth:`files`, :meth:`dirs`
        c              3  "   K   | ]	}|z  V  
d S rD   r>   )r\   r   rE   s     r5   r^   zPath.iterdir.<locals>.<genexpr>  s'      IIudUlIIIIIIr7   )r    loadfilterr   listdirrE   r   s   ` r5   iterdirzPath.iterdir  sC     e$$eIIII
48H8HIIIJJJr7   
list[Self]c                @    d |                      |          D             S )zList of this directory's subdirectories.

        The elements of the list are Path objects.
        This does not walk recursively into subdirectories
        (but see :meth:`walkdirs`).

        Accepts parameters to :meth:`iterdir`.
        c                :    g | ]}|                                 |S r>   is_dirr\   ps     r5   
<listcomp>zPath.dirs.<locals>.<listcomp>)  s%    ===a!((**====r7   r  r  s     r5   dirsz	Path.dirs   s$     >=4<<..====r7   c                @    d |                      |          D             S )zList of the files in self.

        The elements of the list are Path objects.
        This does not walk into subdirectories (see :meth:`walkfiles`).

        Accepts parameters to :meth:`iterdir`.
        c                :    g | ]}|                                 |S r>   is_filer  s     r5   r  zPath.files.<locals>.<listcomp>4  s%    >>>a!))++>>>>r7   r  r  s     r5   filesz
Path.files+  s$     ?>4<<..>>>>r7   stricterrors0Generator[Self, Callable[[], bool] | None, None]c              #    K   t                               |          }t          j        |          }	 |                                 }n)# t
          $ r} |d|  d|            Y d}~dS d}~ww xY w|D ]o}d} ||          r|V }|p|j        }	  |            }n(# t
          $ r} |d| d|            Y d}~Hd}~ww xY w|r|                    ||          E d{V  pdS )a  Iterator over files and subdirs, recursively.

        The iterator yields Path objects naming each child item of
        this directory and its descendants.  This requires that
        ``D.is_dir()``.

        This performs a depth-first traversal of the directory tree.
        Each directory is returned just before all its children.

        The `errors=` keyword argument controls behavior when an
        error occurs.  The default is ``'strict'``, which causes an
        exception.  Other allowed values are ``'warn'`` (which
        reports the error via :func:`warnings.warn()`), and ``'ignore'``.
        `errors` may also be an arbitrary callable taking a msg parameter.
        zUnable to list directory 'z': NzUnable to access ')r  r   )Handlers_resolver    r  r  	Exceptionr  walk)	rE   r   r  error_fn	childListexcr   rO   do_traverses	            r5   r  z	Path.walk6  se     & $$V,,e$$	II 	 	 	H@$@@3@@AAAFFFFF	  	D 	DEHuU|| '!&;;/5<H&hjj   =e====>>>  D ::XU:CCCCCCCCC	D 	Ds/   A 
A-A((A-
B
B?$B::B?c                B    d |                      ||          D             S )z#Iterator over subdirs, recursively.c              3  B   K   | ]}|                                 |V  d S rD   r  r\   rP   s     r5   r^   z Path.walkdirs.<locals>.<genexpr>b  s/      KKT[[]]KKKKKKKr7   r  rE   r   r  s      r5   walkdirszPath.walkdirs`  s$    KK5&!9!9KKKKr7   c                B    d |                      ||          D             S )z!Iterator over files, recursively.c              3  B   K   | ]}|                                 |V  d S rD   r  r%  s     r5   r^   z!Path.walkfiles.<locals>.<genexpr>f  s/      LLT\\^^LLLLLLLr7   r&  r'  s      r5   	walkfileszPath.walkfilesd  s$    LL5&!9!9LLLLr7   patternr   Callable[[str], str] | Noneboolc                    t          |d| j        j                  }|p|} || j                  } ||          }t	          j        ||          S )a  Return ``True`` if `self.name` matches the given `pattern`.

        `pattern` - A filename pattern with wildcards,
            for example ``'*.py'``. If the pattern contains a `normcase`
            attribute, it is applied to the name and path prior to comparison.

        `normcase` - (optional) A function used to normalize the pattern and
            filename before matching. Defaults to normcase from
            ``self.module``, :func:`os.path.normcase`.

        .. seealso:: :func:`fnmatch.fnmatch`
        r   )getattrrb   r   r   fnmatchfnmatchcase)rE   r,  r   default_normcaser   s        r5   r1  zPath.fnmatchh  sY     #7J8LMM//x	""(7##"4111r7   c                X    | j         fdt          j        | |z            D             S )a  Return a list of Path objects that match the pattern.

        `pattern` - a path relative to this directory, with wildcards.

        For example, ``Path('/users').glob('*/bin/*')`` returns a list
        of all the files users have in their :file:`bin` directories.

        .. seealso:: :func:`glob.glob`

        .. note:: Glob is **not** recursive, even when using ``**``.
                  To do recursive globbing see :func:`walk`,
                  :func:`walkdirs` or :func:`walkfiles`.
        c                &    g | ]} |          S r>   r>   r\   srh   s     r5   r  zPath.glob.<locals>.<listcomp>  s!    :::1A:::r7   )r}   globrE   r,  rh   s     @r5   r8  z	Path.glob}  s5     ::::	$. 9 9::::r7   c                X    | j         fdt          j        | |z            D             S )a  Return an iterator of Path objects that match the pattern.

        `pattern` - a path relative to this directory, with wildcards.

        For example, ``Path('/users').iglob('*/bin/*')`` returns an
        iterator of all the files users have in their :file:`bin`
        directories.

        .. seealso:: :func:`glob.iglob`

        .. note:: Glob is **not** recursive, even when using ``**``.
                  To do recursive globbing see :func:`walk`,
                  :func:`walkdirs` or :func:`walkfiles`.
        c              3  .   K   | ]} |          V  d S rD   r>   r6  s     r5   r^   zPath.iglob.<locals>.<genexpr>  s+      ;;1A;;;;;;r7   )r}   r8  iglobr9  s     @r5   r<  z
Path.iglob  s5     ;;;;
4'> : :;;;;r7   .Tmoder   	bufferingr/   encoding
str | Nonenewlineclosefdopener Callable[[str, int], int] | Noner   c                    d S rD   r>   rE   r=  r>  r?  r  rA  rB  rC  s           r5   openz	Path.open  s	     r7   r   
Literal[0]r   c                    d S rD   r>   rF  s           r5   rG  z	Path.open  s	     r7   r   Literal[-1, 1]r   c                    d S rD   r>   rF  s           r5   rG  z	Path.open  	     r7   r   r   c                    d S rD   r>   rF  s           r5   rG  z	Path.open  rL  r7   r   r   c                    d S rD   r>   rF  s           r5   rG  z	Path.open  rL  r7   r   c                    d S rD   r>   rF  s           r5   rG  z	Path.open  s	     3r7   IO[Any]c                    d S rD   r>   rF  s           r5   rG  z	Path.open  s	     #r7   c                "    t          | g|R i |S )zOpen this file and return a corresponding file object.

        Keyword arguments work as in :func:`io.open`.  If the file cannot be
        opened, an :class:`OSError` is raised.
        )rG  rE   argskwargss      r5   rG  z	Path.open  s"     D*4***6***r7   builtins.bytesc                    |                      d          5 }|                                cddd           S # 1 swxY w Y   dS )z8Open this file, read all bytes, return them as a string.rbNrG  readrE   fs     r5   bytesz
Path.bytes  s~    YYt__ 	6688	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   7;;sizerU   c	                    d S rD   r>   	rE   r^  r=  r>  r?  r  rA  rB  rC  s	            r5   chunkszPath.chunks  s	     r7   Iterator[builtins.bytes]c	                    d S rD   r>   r`  s	            r5   ra  zPath.chunks	  s	     $'3r7   Iterator[str | builtins.bytes]c	                    d S rD   r>   r`  s	            r5   ra  zPath.chunks  s	     *-r7   c              /     K    | j         |i |5 t          fdd          E d{V  ddd           dS # 1 swxY w Y   dS )a  Returns a generator yielding chunks of the file, so it can
         be read piece by piece with a simple for loop.

        Any argument you pass after `size` will be passed to :meth:`open`.

        :example:

            >>> hash = hashlib.md5()
            >>> for chunk in Path("NEWS.rst").chunks(8192, mode='rb'):
            ...     hash.update(chunk)

         This will read the file by chunks of 8192 bytes.
        c                 2                                    pd S rD   )rZ  )r\  r^  s   r5   <lambda>zPath.chunks.<locals>.<lambda>0  s    AFF4LL$8D r7   N)rG  iter)rE   r^  rT  rU  r\  s    `  @r5   ra  zPath.chunks!  s       TY''' 	@188888$?????????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s   :>>Fr]  appendc                    |                      |rdnd          5 }|                    |           ddd           dS # 1 swxY w Y   dS )zOpen this file and write the given bytes to it.

        Default behavior is to overwrite any existing file.
        Call ``p.write_bytes(bytes, append=True)`` to append instead.
        abwbN)rG  write)rE   r]  rj  r\  s       r5   write_byteszPath.write_bytes2  s     YYv/tt400 	AGGENNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   =AAc                    |                      ||          5 }|                                cddd           S # 1 swxY w Y   dS )zOpen this file, read it in, return the content as a string.

        Optional parameters are passed to :meth:`open`.

        .. seealso:: :meth:`lines`
        )r?  r  NrY  )rE   r?  r  r\  s       r5   	read_textzPath.read_text;  s     YYY88 	A6688	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   9= =c                    |                      d          5 }|                                cddd           S # 1 swxY w Y   dS )z*Return the contents of this file as bytes.rX  r=  NrY  r[  s     r5   
read_byteszPath.read_bytesE  s    YYDY!! 	Q6688	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   8<<textlinesepc                    |t                               ||          }|                    |pt          j                    |          }|                     ||           dS )a  Write the given text to this file.

        The default behavior is to overwrite any existing file;
        to append instead, use the `append=True` keyword argument.

        There are two differences between :meth:`write_text` and
        :meth:`write_bytes`: newline handling and Unicode handling.
        See below.

        Parameters:

          `text` - str - The text to be written.

          `encoding` - str - The text encoding used.

          `errors` - str - How to handle Unicode encoding errors.
              Default is ``'strict'``.  See ``help(unicode.encode)`` for the
              options.  Ignored if `text` isn't a Unicode string.

          `linesep` - keyword argument - str/unicode - The sequence of
              characters to be used to mark end-of-line.  The default is
              :data:`os.linesep`.  Specify ``None`` to
              use newlines unmodified.

          `append` - keyword argument - bool - Specifies what to do if
              the file already exists (``True``: append to the end of it;
              ``False``: overwrite it).  The default is ``False``.


        --- Newline handling.

        ``write_text()`` converts all standard end-of-line sequences
        (``'\n'``, ``'\r'``, and ``'\r\n'``) to your platform's default
        end-of-line sequence (see :data:`os.linesep`; on Windows, for example,
        the end-of-line marker is ``'\r\n'``).

        To override the platform's default, pass the `linesep=`
        keyword argument. To preserve the newlines as-is, pass
        ``linesep=None``.

        This handling applies to Unicode text and bytes, except
        with Unicode, additional non-ASCII newlines are recognized:
        ``\x85``, ``\r\x85``, and ``\u2028``.

        --- Unicode

        `text` is written using the
        specified `encoding` (or the default encoding if `encoding`
        isn't specified).  The `errors` argument applies only to this
        conversion.
        Nrj  )	U_NEWLINErZ   encodesysgetdefaultencodingro  )rE   ru  r?  r  rv  rj  r]  s          r5   
write_textzPath.write_textJ  s^    v ==$//DH@(>(@(@&IIv.....r7   retain	list[str]c                    t                               d|                     ||                    }|                    |          S )a  Open this file, read all lines, return them in a list.

        Optional arguments:
            `encoding` - The Unicode encoding (or character set) of
                the file.  The default is ``None``, meaning use
                ``locale.getpreferredencoding()``.
            `errors` - How to handle Unicode errors; see
                `open <https://docs.python.org/3/library/functions.html#open>`_
                for the options.  Default is ``None`` meaning "strict".
            `retain` - If ``True`` (default), retain newline characters,
                but translate all newline
                characters to ``\n``.  If ``False``, newline characters are
                omitted.
        r'   )ry  rZ   rq  
splitlines)rE   r?  r  r~  ru  s        r5   rS   z
Path.lines  s7    ( }}T4>>(F#C#CDDv&&&r7   rx  rS   c                   |rdnd}|                      |||d          5 }|                    |                     |                     ddd           dS # 1 swxY w Y   dS )aa  Write the given lines of text to this file.

        By default this overwrites any existing file at this path.

        Puts a platform-specific newline sequence on every line.

            `lines` - A list of strings.

            `encoding` - A Unicode encoding to use.  This applies only if
                `lines` contains any Unicode strings.

            `errors` - How to handle errors in Unicode encoding.  This
                also applies only to Unicode strings.

        Use the keyword argument ``append=True`` to append lines to the
        file.  The default is to overwrite the file.
        awrX   )r?  r  rA  N)rG  
writelines_replace_linesep)rE   rS   r?  r  rj  r=  r\  s          r5   write_lineszPath.write_lines  s    2 %ss#YYthvrYJJ 	7aLL..u55666	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7s   )AAArT   c                4    d t          |           D             S )Nc              3  4   K   | ]}|t           j        z   V  d S rD   )r   rv  r[   s     r5   r^   z(Path._replace_linesep.<locals>.<genexpr>  s)      EEdrz!EEEEEEr7   )r`   r_   s    r5   r  zPath._replace_linesep  s    EEoe.D.DEEEEr7   c                ,    |                      d          S )zCalculate the md5 hash for this file.

        This reads through the entire file.

        .. seealso:: :meth:`read_hash`
        md5)	read_hashrp   s    r5   read_md5zPath.read_md5  s     ~~e$$$r7   	hash_namehashlib._Hashc                    t          j        |          }|                     dd          D ]}|                    |           |S )zReturns a hash object for the file at the current path.

        `hash_name` should be a hash algo name (such as ``'md5'``
        or ``'sha1'``) that's available in the :mod:`hashlib` module.
        i    rX  rs  )hashlibnewra  update)rE   r  mchunks       r5   _hashz
Path._hash  sH     K	""[[D[11 	 	EHHUOOOOr7   c                P    |                      |                                          S )zCalculate given hash for this file.

        List of supported hashes can be obtained from :mod:`hashlib` package.
        This reads the entire file.

        .. seealso:: :meth:`hashlib.hash.digest`
        )r  digestrE   r  s     r5   r  zPath.read_hash  s"     zz)$$++---r7   c                P    |                      |                                          S )zCalculate given hash for this file, returning hexdigest.

        List of supported hashes can be obtained from :mod:`hashlib` package.
        This reads the entire file.

        .. seealso:: :meth:`hashlib.hash.hexdigest`
        )r  	hexdigestr  s     r5   read_hexhashzPath.read_hexhash  s"     zz)$$..000r7   c                6    | j                             |           S )za
        >>> Path('.').isabs()
        False

        .. seealso:: :func:`os.path.isabs`
        )rb   isabsrp   s    r5   r  z
Path.isabs  s     {  &&&r7   c                6    | j                             |           S )z#.. seealso:: :func:`os.path.exists`)rb   existsrp   s    r5   r  zPath.exists      {!!$'''r7   c                6    | j                             |           S )z".. seealso:: :func:`os.path.isdir`)rb   isdirrp   s    r5   r  zPath.is_dir  s    {  &&&r7   c                6    | j                             |           S )z#.. seealso:: :func:`os.path.isfile`)rb   isfilerp   s    r5   r  zPath.is_file   r  r7   c                6    | j                             |           S )z#.. seealso:: :func:`os.path.islink`)rb   islinkrp   s    r5   r  zPath.islink  r  r7   c                6    | j                             |           S )ze
        >>> Path('.').ismount()
        False

        .. seealso:: :func:`os.path.ismount`
        )rb   ismountrp   s    r5   r  zPath.ismount  s     {""4(((r7   c                8    | j                             | |          S )z%.. seealso:: :func:`os.path.samefile`)rb   samefilern   s     r5   r  zPath.samefile  s    {##D%000r7   r2   c                6    | j                             |           S )z4.. seealso:: :attr:`atime`, :func:`os.path.getatime`)rb   getatimerp   s    r5   r  zPath.getatime      {##D)))r7   r,   r-   c                    |                                  j        }|                     t          |          |f           d S N)ry   statst_atime_nsutimer6   )rE   r,   mtime_nss      r5   	set_atimezPath.set_atime  s:    99;;*

)%00(;
<<<<<r7   c                *    |                                  S )a  
        Last access time of the file.

        >>> Path('.').atime > 0
        True

        Allows setting:

        >>> some_file = Path(getfixture('tmp_path')).joinpath('file.txt').touch()
        >>> MST = datetime.timezone(datetime.timedelta(hours=-7))
        >>> some_file.atime = datetime.datetime(1976, 5, 7, 10, tzinfo=MST)
        >>> some_file.atime
        200336400.0

        .. seealso:: :meth:`getatime`, :func:`os.path.getatime`
        )r  rp   s    r5   atimez
Path.atime  s    $ }}r7   c                0    |                      |           d S rD   )r  rE   r,   s     r5   r  z
Path.atime1      ur7   c                6    | j                             |           S )z4.. seealso:: :attr:`mtime`, :func:`os.path.getmtime`)rb   getmtimerp   s    r5   r  zPath.getmtime5  r  r7   c                    |                                  j        }|                     |t          |          f           d S r  r  )rE   r,   atime_nss      r5   	set_mtimezPath.set_mtime9  s:    99;;*

x!3E!:!:;
<<<<<r7   c                *    |                                  S )a  
        Last modified time of the file.

        Allows setting:

        >>> some_file = Path(getfixture('tmp_path')).joinpath('file.txt').touch()
        >>> MST = datetime.timezone(datetime.timedelta(hours=-7))
        >>> some_file.mtime = datetime.datetime(1976, 5, 7, 10, tzinfo=MST)
        >>> some_file.mtime
        200336400.0

        .. seealso:: :meth:`getmtime`, :func:`os.path.getmtime`
        )r  rp   s    r5   mtimez
Path.mtime=  s     }}r7   c                0    |                      |           d S rD   )r  r  s     r5   r  z
Path.mtimeN  r  r7   c                6    | j                             |           S )z4.. seealso:: :attr:`ctime`, :func:`os.path.getctime`)rb   getctimerp   s    r5   r  zPath.getctimeR  r  r7   c                *    |                                  S )zdCreation time of the file.

        .. seealso:: :meth:`getctime`, :func:`os.path.getctime`
        )r  rp   s    r5   ctimez
Path.ctimeV  s     }}r7   c                6    | j                             |           S )z2.. seealso:: :attr:`size`, :func:`os.path.getsize`)rb   getsizerp   s    r5   r  zPath.getsize^  s    {""4(((r7   c                *    |                                  S )zcSize of the file, in bytes.

        .. seealso:: :meth:`getsize`, :func:`os.path.getsize`
        )r  rp   s    r5   r^  z	Path.sizeb  s     ||~~r7   masks.Permissionsc                X    t          j        |                                 j                  S )z
        Permissions.

        >>> perms = Path('.').permissions
        >>> isinstance(perms, int)
        True
        >>> set(perms.symbolic) <= set('rwx-')
        True
        >>> perms.symbolic
        'r...'
        )r   Permissionsr  st_moderp   s    r5   permissionszPath.permissionsj  s       !4555r7   dir_fdeffective_idsfollow_symlinksr  
int | Noner  r  c               4    t          j        | ||||          S )z
        Return does the real user have access to this path.

        >>> Path('.').access(os.F_OK)
        True

        .. seealso:: :func:`os.access`
        r  )r   access)rE   r=  r  r  r  s        r5   r  zPath.accessy  s,      y'+
 
 
 	
r7   r  os.stat_resultc               .    t          j        | |          S )z
        Perform a ``stat()`` system call on this path.

        >>> Path('.').stat()
        os.stat_result(...)

        .. seealso:: :meth:`lstat`, :func:`os.stat`
        r  )r   r  )rE   r  s     r5   r  z	Path.stat  s     wt_====r7   c                *    t          j        |           S )z
        Like :meth:`stat`, but do not follow symbolic links.

        >>> Path('.').lstat() == Path('.').stat()
        True

        .. seealso:: :meth:`stat`, :func:`os.lstat`
        )r   lstatrp   s    r5   r  z
Path.lstat  s     x~~r7   win32c                    dt                      vrt          d          t          j        | t          j                  }|                                }t          j        d|          \  }}}|dz   |z   S )z
            Return the name of the owner of this file or directory. Follow
            symbolic links.

            Return a name of the form ``DOMAIN\User Name``; may be a group.

            .. seealso:: :attr:`owner`
            win32securityz)Ownership not available on this platform.N\)globalsNotImplementedErrorr  GetFileSecurityOWNER_SECURITY_INFORMATIONGetSecurityDescriptorOwnerLookupAccountSid)rE   descsidaccountdomaintypecodes         r5   	get_ownerzPath.get_owner  sw     gii//)*UVVV 0m> D 1133C(5(FtS(Q(Q%GVXD=7**r7   c                f    |                                  }t          j        |j                  j        S )z
            Return the name of the owner of this file or directory. Follow
            symbolic links.

            .. seealso:: :attr:`owner`
            )r  pwdgetpwuidst_uidpw_name)rE   sts     r5   r  zPath.get_owner  s&     B<	**22r7   c                *    |                                  S )zTName of the owner of this file or directory.

        .. seealso:: :meth:`get_owner`)r  rp   s    r5   ownerz
Path.owner  s    
 ~~r7   c               j    |                      |          j        }t          j        |          j        S )z@
            Return the group name of the file gid.
            r  )r  st_gidgrpgetgrgidgr_name)rE   r  gids      r5   groupz
Path.group  s-     ))O)<<CC<$$,,r7   os.statvfs_resultc                *    t          j        |           S )zkPerform a ``statvfs()`` system call on this path.

            .. seealso:: :func:`os.statvfs`
            )r   statvfsrp   s    r5   r  zPath.statvfs  s    
 :d###r7   	str | intc                ,    t          j        | |          S )z .. seealso:: :func:`os.pathconf`)r   pathconfr   s     r5   r   zPath.pathconf  s    ;tT***r7   )r  r  times,tuple[int, int] | tuple[float, float] | Nonec                   d S rD   r>   )rE   r  r  r  s       r5   r  z
Path.utime  s	     sr7   ry   tuple[int, int]c                   d S rD   r>   )rE   r  ry   r  r  s        r5   r  z
Path.utime  s	     sr7   c                0    t          j        | g|R i | | S )z_Set the access and modified times of this file.

        .. seealso:: :func:`os.utime`
        )r   r  rS  s      r5   r  z
Path.utime  s)    
 	'''''''r7   c                    t          |t                    r6t          j        |          } ||                                 j                  }t          j        | |           | S )at  
        Set the mode. May be the new mode (os.chmod behavior) or a `symbolic
        mode <http://en.wikipedia.org/wiki/Chmod#Symbolic_modes>`_.

        >>> a_file = Path(getfixture('tmp_path')).joinpath('afile.txt').touch()
        >>> a_file.chmod(0o700)
        Path(...
        >>> a_file.chmod('u+x')
        Path(...

        .. seealso:: :func:`os.chmod`
        )r1   r~   r   compoundr  r  r   chmod)rE   r=  masks      r5   r	  z
Path.chmod   sV     dC   	->$''D4		+,,D
tr7   uidr  c                f    dd}d	d}t          j        |  ||           ||                     | S )
zt
            Change the owner and group by names or numbers.

            .. seealso:: :func:`os.chown`
            r  r  r.   r/   c                b    t          | t                    r| nt          j        |           j        S rD   )r1   r/   r  getpwnampw_uid)r  s    r5   resolve_uidzPath.chown.<locals>.resolve_uid  (    (c22PssS8I8I8PPr7   r  c                b    t          | t                    r| nt          j        |           j        S rD   )r1   r/   r  getgrnamgr_gid)r  s    r5   resolve_gidzPath.chown.<locals>.resolve_gid  r  r7   )r  r  r.   r/   )r  r  r.   r/   )r   chown)rE   r  r  r  r  s        r5   r  z
Path.chown  sa    Q Q Q QQ Q Q Q HT;;s++[[-=-=>>>Kr7   r  c                V    t          j        | |           |                     |          S )z.. seealso:: :func:`os.rename`)r   renamer}   rE   r  s     r5   r  zPath.rename%  s(    
	$$$$r7   c                V    t          j        | |           |                     |          S )z.. seealso:: :func:`os.renames`)r   renamesr}   r  s     r5   r  zPath.renames*  s(    

4$$$r7   target_or_oldc                    |                      |r t                      j        |g|R  n&t          j        |                               |                    S )a  
        Replace a path or substitute substrings.

        Implements both pathlib.Path.replace and str.replace.

        If only a target is supplied, rename this path to the target path,
        overwriting if that path exists.

        >>> dest = Path(getfixture('tmp_path'))
        >>> orig = dest.joinpath('foo').touch()
        >>> new = orig.replace(dest.joinpath('fee'))
        >>> orig.exists()
        False
        >>> new.exists()
        True

        ..seealso:: :meth:`pathlib.Path.replace`

        If a second parameter is supplied, perform a textual replacement.

        >>> Path('foo').replace('o', 'e')
        Path('fee')
        >>> Path('foo').replace('o', 'l', 1)
        Path('flo')

        ..seealso:: :meth:`str.replace`
        )r}   rf   replacepathlibr#   )rE   r  rT  ri   s      r5   r  zPath.replace/  s]    8 ;OEGGOM1D1111d##++M::
 
 	
r7     c                0    t          j        | |           | S )z.. seealso:: :func:`os.mkdir`)r   mkdirrE   r=  s     r5   r#  z
Path.mkdirT  s    
tr7   c                    t          j        t                    5  |                     |           ddd           n# 1 swxY w Y   | S )z\Like :meth:`mkdir`, but does not raise an exception if the
        directory already exists.N)
contextlibsuppressFileExistsErrorr#  r$  s     r5   mkdir_pzPath.mkdir_pY  s      11 	 	JJt	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   <A A c                0    t          j        | |           | S )z .. seealso:: :func:`os.makedirs`)r   makedirsr$  s     r5   r,  zPath.makedirs`  s    
D$r7   c                    t          j        t                    5  |                     |           ddd           n# 1 swxY w Y   | S )z_Like :meth:`makedirs`, but does not raise an exception if the
        directory already exists.N)r&  r'  r(  r,  r$  s     r5   
makedirs_pzPath.makedirs_pe  s      11 	  	 MM$	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 r*  c                .    t          j        |            | S )z.. seealso:: :func:`os.rmdir`)r   rmdirrp   s    r5   r0  z
Path.rmdirl  s    
r7   c                   t           t          t          f}t          j        | 5  t                                          5  |                                  ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   | S )zlLike :meth:`rmdir`, but does not raise an exception if the
        directory is not empty or does not exist.N)FileNotFoundErrorr(  DirectoryNotEmptyr&  r'  	translater0  )rE   
suppresseds     r5   rmdir_pzPath.rmdir_pq  s     '9JJ
 *- 	 	",,..  

              	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 s4   A5AA5A"	"A5%A"	&A55A9<A9c                .    t          j        |            | S )z".. seealso:: :func:`os.removedirs`)r   
removedirsrp   s    r5   r8  zPath.removedirsz  s    
dr7   c                    t          j        t          t                    5  t                                          5  |                                  ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   | S )zqLike :meth:`removedirs`, but does not raise an exception if the
        directory is not empty or does not exist.N)r&  r'  r(  r3  r4  r8  rp   s    r5   removedirs_pzPath.removedirs_p  s      2CDD 	" 	"",,.. " "!!!" " " " " " " " " " " " " " "	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" s4   A2AA2A	A2"A	#A22A69A6c                    t          j        t          j        | t           j        t           j        z  d                     t          j        | d           | S )zvSet the access/modified times of this file to the current time.
        Create the file if it does not exist.
        i  N)r   closerG  O_WRONLYO_CREATr  rp   s    r5   touchz
Path.touch  sB     	r{RZ7??@@@
tr7   c                .    t          j        |            | S )z.. seealso:: :func:`os.remove`)r   removerp   s    r5   rA  zPath.remove  s    
	$r7   c                    t          j        t                    5  |                                  ddd           n# 1 swxY w Y   | S )zXLike :meth:`remove`, but does not raise an exception if the
        file does not exist.N)r&  r'  r2  unlinkrp   s    r5   remove_pzPath.remove_p  }      !233 	 	KKMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   ;??targetc                0    t          j        ||            dS )zg
        Create a hard link at self, pointing to target.

        .. seealso:: :func:`os.link`
        N)r   link)rE   rG  s     r5   hardlink_tozPath.hardlink_to  s     	r7   newpathc                V    t          j        | |           |                     |          S )zfCreate a hard link at `newpath`, pointing to this file.

        .. seealso:: :func:`os.link`
        )r   rI  r}   )rE   rK  s     r5   rI  z	Path.link  s*    
 	g(((r7   target_is_directoryc                2    t          j        || |           dS )zn
        Create a symbolic link at self, pointing to target.

        .. seealso:: :func:`os.symlink`
        N)r   symlink)rE   rG  rM  s      r5   
symlink_tozPath.symlink_to  s     	
64!455555r7   newlinkc                    ||                                  }t          j        | |           |                     |          S )zCreate a symbolic link at `newlink`, pointing here.

        If newlink is not supplied, the symbolic link will assume
        the name self.basename(), creating the link in the cwd.

        .. seealso:: :func:`os.symlink`
        )r   r   rO  r}   )rE   rQ  s     r5   rO  zPath.symlink  s<     ?mmooG

4!!!(((r7   c                l    |                      t          t          j        |           d                    S )zReturn the path to which this symbolic link points.

        The result may be an absolute or a relative path.

        .. seealso:: :meth:`readlinkabs`, :func:`os.readlink`
        z\\?\)r}   r!   r   readlinkrp   s    r5   rT  zPath.readlink  s,     R[->->	 J JKKKr7   c                    |                                  }|                                r|n| j        |z                                  S )zReturn the path to which this symbolic link points.

        The result is always an absolute path.

        .. seealso:: :meth:`readlink`, :func:`os.readlink`
        )rT  r  r   r   )rE   r  s     r5   readlinkabszPath.readlinkabs  s:     MMOOGGII?qqDK!O#=#=#?#??r7   dstc               V    |                      t          j        | ||                    S Nr  )r}   shutilcopyfilerE   rW  r  s      r5   r[  zPath.copyfile  s.    OD#GGG
 
 	
r7   c               4    t          j        | ||           d S rY  )rZ  copymoder\  s      r5   r^  zPath.copymode      c?CCCCCCr7   c               4    t          j        | ||           d S rY  )rZ  copystatr\  s      r5   ra  zPath.copystat  r_  r7   c               V    |                      t          j        | ||                    S rY  )r}   rZ  copyr\  s      r5   rc  z	Path.copy  s'    D# W W WXXXr7   c               V    |                      t          j        | ||                    S rY  )r}   rZ  copy2r\  s      r5   re  z
Path.copy2  s.    LsODDD
 
 	
r7   symlinksignore_IgnoreFn | Nonecopy_function_CopyFnignore_dangling_symlinksdirs_exist_okc                ^    |                      t          j        | ||||||                    S )N)rf  rg  ri  rk  rl  )r}   rZ  copytree)rE   rW  rf  rg  ri  rk  rl  s          r5   rn  zPath.copytree  sE     O!+)A+  

 

 
	
r7   c                ^    t          j        | ||          }|                     |p|          S )N)ri  )rZ  mover}   )rE   rW  ri  retvals       r5   rp  z	Path.move  s0    T3mDDD#...r7   )      )onexcr  ignore_errorsonerror_OnErrorCallbackrt  c                   d S rD   r>   rE   ru  rv  rt  r  s        r5   rmtreezPath.rmtree  	     3r7   c                   d S rD   r>   ry  s        r5   rz  zPath.rmtree  r{  r7   _OnExcCallback | Nonec                   d S rD   r>   )rE   ru  rt  r  s       r5   rz  zPath.rmtree  	     3r7   )rr     )r  _OnErrorCallback | Nonec                   d S rD   r>   )rE   rv  r  s      r5   rz  zPath.rmtree,  s	     3r7   c                   d S rD   r>   )rE   ru  rv  r  s       r5   rz  zPath.rmtree3  r  r7   c                    d S rD   r>   )rE   rv  s     r5   rz  zPath.rmtree>  s    JM#r7   c                    d S rD   r>   )rE   ru  rv  s      r5   rz  zPath.rmtree@  s	     3r7   c                0    t          j        | g|R i | d S rD   )rZ  rz  rS  s      r5   rz  zPath.rmtreeE  s(    d,T,,,V,,,,,r7   c                    t          j        t                    5  |                                  ddd           n# 1 swxY w Y   | S )z]Like :meth:`rmtree`, but does not raise an exception if the
        directory does not exist.N)r&  r'  r2  rz  rp   s    r5   rmtree_pzPath.rmtree_pS  rE  rF  c                .    t          j        |            dS )z.. seealso:: :func:`os.chdir`N)r   r   rp   s    r5   r   z
Path.chdirZ  s    
r7   c                    g S rD   r>   )dircontentss     r5   rh  zPath.<lambda>f  s    " r7   )ri  rg  	_IgnoreFnc               P   |                      |          }|                                 t          |                                           }t	           || d |D                                 d	fd}t          j        ||          D ]}||j        z  }	|r>|                                r*|	                                }
|

                    |	           L|                                r|                    |	|||           z |||	           |                     |           dS )
a  
        Copy entire contents of self to dst, overwriting existing
        contents in dst with those in self.

        Pass ``symlinks=True`` to copy symbolic links as links.

        Accepts a ``copy_function``, similar to copytree.

        To avoid overwriting newer files, supply a copy function
        wrapped in ``only_newer``. For example::

            src.merge_tree(dst, copy_function=only_newer(shutil.copy2))
        c                    g | ]	}|j         
S r>   r   r%  s     r5   r  z#Path.merge_tree.<locals>.<listcomp>y  s    $C$C$C4TY$C$C$Cr7   rP   r   r.   r.  c                    | j         v S rD   r  )rP   _ignoreds    r5   ignoredz Path.merge_tree.<locals>.ignored{  s    9((r7   )rf  ri  rg  N)rP   r   r.   r.  )r}   r.  r   r  set	itertoolsfilterfalser   r  rT  rO  r  
merge_treera  )rE   rW  rf  ri  rg  dst_pathsourcesr  sourcer   rG  r  s              @r5   r  zPath.merge_tree`  sW   * ##C((t||~~&&vvd$C$C7$C$C$CDDEE	) 	) 	) 	) 	) 	)  +GW== 	, 	,Ffk)D ,FMMOO ,**t$$$$ ,!!%"/!	 "     fd++++hr7   c                .    t          j        |            dS )z.. seealso:: :func:`os.chroot`N)r   chrootrp   s    r5   r  zPath.chroot  s    IdOOOOOr7   )rr  
   	argumentsr   show_cmdc                    d S rD   r>   )rE   r  r   r  s       r5   	startfilezPath.startfile  s	     sr7   	operationc                    d S rD   r>   )rE   r  r  r   r  s        r5   r  zPath.startfile  s	     sr7   c                    d S rD   r>   rp   s    r5   r  zPath.startfile  s    ),r7   c                    d S rD   r>   )rE   r  s     r5   r  zPath.startfile  s    9<r7   c                0    t          j        | g|R i | | S )z!.. seealso:: :func:`os.startfile`)r   r  rS  s      r5   r  zPath.startfile  s'    L///////Kr7   rbackup_extension!Iterator[tuple[IO[Any], IO[Any]]]c              #  |  K   t          |                              d          rt          d          | |pt          j        dz   z   }|                                 |                     |           t          ||||||          }t          j        |	                                          j
        }	t          j        t          j        z  t          j        z  }
|
t          t          dd          z  }
t          j        | |
|	          }t          |d|                    dd	          z   ||||          }t!          j        t$          t&                    5  |                     |	           d
d
d
           n# 1 swxY w Y   	 ||fV  |                                 |                                 n`# t,          $ rS |                                 |                                 |                                  |                    |             w xY w	 |                                 d
S # |                                 w xY w)ab  
        A context in which a file may be re-written in-place with
        new content.

        Yields a tuple of :samp:`({readable}, {writable})` file
        objects, where `writable` replaces `readable`.

        If an exception occurs, the old file is restored, removing the
        written data.

        Mode *must not* use ``'w'``, ``'a'``, or ``'+'``; only
        read-only-modes are allowed. A :exc:`ValueError` is raised
        on invalid modes.

        For example, to add line numbers to a file::

            p = Path(filename)
            assert p.is_file()
            with p.in_place() as (reader, writer):
                for number, line in enumerate(reader, 1):
                    writer.write('{0:3}: '.format(number)))
                    writer.write(line)

        Thereafter, the file at `filename` will have line numbers in it.
        zwa+z%Only read-only file modes can be usedbak)r>  r?  r  rA  O_BINARYr   r  r  rX   N)r  intersectionr   r   extseprD  r  rG  r  filenor  r>  r=  O_TRUNCr0  r  r&  r'  OSErrorAttributeErrorr	  r<  r  )rE   r=  r>  r?  r  rA  r  	backup_fnreadablepermos_modefdwritables                r5   in_placezPath.in_place  sz     F t99!!%(( 	FDEEE ,A	E0AB	I
 
 
 wx(())1*r{*RZ772z1---WT7D))$,,sB'''
 
 
  .99 	 	JJt	 	 	 	 	 	 	 	 	 	 	 	 	 	 		!H$$$$ NNNN  	 	 	NNNNMMOOOT"""	      I    s1   E33E7:E7?F. )H% .AHH% %H;'Callable[[str | None], SpecialResolver]c                6    t          j        t          |           S )a  
        Return a SpecialResolver object suitable referencing a suitable
        directory for the relevant platform for the given
        type of content.

        For example, to get a user config directory, invoke:

            dir = Path.special().user.config

        Uses the `appdirs
        <https://pypi.python.org/pypi/appdirs/1.4.0>`_ to resolve
        the paths in a platform-friendly way.

        To create a config directory for 'My App', consider:

            dir = Path.special("My App").user.config.makedirs_p()

        If the ``appdirs`` module is not installed, invocation
        of special will raise an ImportError.
        )rM   rN   SpecialResolverr|   s    r5   specialzPath.special  s    .  #666r7   )rc   )rd   r   r.   r   )rd   r   r.   rj   r.   rj   )rb   r	   r.   rr   )r.   rr   )r.   r~   )r   r~   r.   r   )rd   r~   r.   r   )r   r~   r.   r   r.   r   )r.   r#   )r   r~   r.   r   )r   r~   r.   r   )r   r~   r.   r   )r.   r   )r.   r   )r   r~   r   r~   r.   r   )r.   r   )r.   r   )r.   r   )r   r~   r.   r   )r   r~   r.   r   rD   )r   r   r.   r   )r   r   r.   r  )Nr  )r   r   r  r~   r.   r  )r   r   r  r~   r.   r   )r,  r~   r   r-  r.   r.  )r,  r~   r.   r  )r,  r~   r.   r   ).....T.)r=  r   r>  r/   r?  r@  r  r@  rA  r@  rB  r.  rC  rD  r.   r   )...T.)r=  r   r>  rH  r?  rj   r  rj   rA  rj   rB  r.  rC  rD  r.   r   )....T.)r=  r   r>  rJ  r?  rj   r  rj   rA  rj   rB  r.  rC  rD  r.   r   )r=  r   r>  rJ  r?  rj   r  rj   rA  rj   rB  r.  rC  rD  r.   r   )r=  r   r>  rJ  r?  rj   r  rj   rA  rj   rB  r.  rC  rD  r.   r   )r=  r   r>  r/   r?  rj   r  rj   rA  rj   rB  r.  rC  rD  r.   r   )r=  r~   r>  r/   r?  r@  r  r@  rA  r@  rB  r.  rC  rD  r.   rP  )r.   rV  ).......)r^  r/   r=  r   r>  r/   r?  r@  r  r@  rA  r@  rB  r.  rC  rD  r.   rU   )......)r^  r/   r=  r   r>  r/   r?  r@  r  r@  rA  r@  rB  r.  rC  rD  r.   rb  )r^  r/   r=  r~   r>  r/   r?  r@  r  r@  rA  r@  rB  r.  rC  rD  r.   rd  )F)r]  rV  rj  r.  r.   rj   )NN)r?  r@  r  r@  r.   r~   )ru  r~   r?  r@  r  r~   rv  r@  rj  r.  r.   rj   )NNT)r?  r@  r  r@  r~  r.  r.   r  )rS   r  r?  r@  r  r~   rj  r.  rS   rT   r.   rU   )r  r~   r.   r  )r.   r.  )rd   r~   r.   r.  )r.   r2   )r,   r-   r.   rj   )r.   r/   )r.   r  )
r=  r/   r  r  r  r.  r  r.  r.   r.  )r  r.  r.   r  )r.   r  )r  r.  r.   r~   )r.   r  )r   r  r.   r/   )r  r  r  r  r  r.  r.   r   )
r  r  ry   r  r  r  r  r.  r.   r   )r=  r  r.   r   )r  r  )r  r  r  r  r.   r   )r  r~   r.   r   )r  r~   r.   r   )r!  )r=  r/   r.   r   )rG  r~   r.   rj   )rK  r~   r.   r   )rG  r~   rM  r.  r.   rj   )rQ  r@  r.   r   )rW  r~   r  r.  r.   r   )rW  r~   r  r.  r.   rj   )rW  r~   rf  r.  rg  rh  ri  rj  rk  r.  rl  r.  r.   r   )rW  r~   ri  rj  r.   r   )
ru  r.  rv  rw  rt  rj   r  r  r.   rj   ).)ru  r.  rt  r}  r  r  r.   rj   )rv  r  r  r  r.   rj   )ru  r.  rv  r  r  r  r.   rj   )rv  r  r.   rj   )ru  r.  rv  r  r.   rj   )rW  r~   rf  r.  ri  rj  rg  r  )...)r  r~   r   r@  r  r/   r.   r   )
r  r~   r  r~   r   r@  r  r/   r.   r   )r  r~   r.   r   )r  r  NNNN)r=  r~   r>  r/   r?  r@  r  r@  rA  r@  r  r@  r.   r  )r.   r  )r;   r<   r=   rR   r   r   rb   __annotations__rg   rF   rm   classmethodrM   	lru_cacherz   r   ClassPropertyr}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   propertyr   r   r   r   r   r   r   r   r   r   r   r   multimethodr   r   r   r   r   r   r   r  r  r  r  r(  r+  r1  r8  r<  r   rG  r]  ra  ro  rq  rt  rv  r}  rS   r  staticmethodr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  setterr  r  r  r  r  r  r^  r  r  r  r  r{  platformr  r  r  r  r   r  r	  r  r  r  r  r#  r)  r,  r.  r0  r6  r8  r:  r?  rA  rD  rC  unlink_prJ  rI  rP  rO  rT  rV  r[  r^  ra  rc  re  rZ  rn  rp  version_inforz  r  r   cdr  r  r  r&  contextmanagerr  r  __classcell__ri   s   @r5   r#   r#      sP          F    
+ + + + + + +    
    . . .  [.    [ > > > > > >7 7 7 7 7 75 5 5 5= = = == = = =   
            [  , , , [,; ; ; ;< < < << < < << < < <> > > >> > > >; ; ; ;< < < <9 9 9 9    X2 2 2 2    X
( ( ( ($ ' ' ' X' 	 	 	 X	    XF F F F/ / / /
> 
> 
> 
>/ / / /" " " " 	@ 	@ 	@ 	@# # # #$ $ $ $3 3 3 3   # # # # #$) $) $) $)PK K K K K 	> 	> 	> 	> 	>	? 	? 	? 	? 	? 3;(D (D (D (D (DTL L L L LM M M M M
 EI2 2 2 2 2*; ; ; ;"< < < <*  !" !36	 	 	 	 X	 
 36	 	 	 	 X	  %(36	 	 	 	 X	  %(36	 	 	 	 X	  %(36	 	 	 	 X	  36	 	 	 	 X	  " !36	 	 	 	 X	+ + +   
  !" !36
 
 
 
 X
 
 " !36
' 
' 
' 
' X
' 
 " !36
- 
- 
- 
- X
-@ @ @"             $ j>/ >/ >/ >/ >/D  $!	' ' ' ' '4  $	7 7 7 7 7 7 7: F F F \F% % % %	 	 	 	. . . .1 1 1 1' ' ' '( ( ( (' ' ' '( ( ( (( ( ( () ) ) )1 1 1 1* * * *= = = =    X& \   \* * * *= = = =    X  \   \* * * *    X) ) ) )    X 6 6 6 X6$ "# $
 
 
 
 
 
0 /3 	> 	> 	> 	> 	> 	>	 	 	 	 |w	+ 	+ 	+ 	+ 	+*	3 	3 	3 	3       X  |w37 	- 	- 	- 	- 	- 	-	$ 	$ 	$ 	$	+ 	+ 	+ 	+  ?C " $     X  ?C
 " $     X      & |w	 	 	 	 	 % % % %
% % % %
 
  
  
  
  
  
J    
        
       
      
         
    FH   ) ) ) )6 6 6 6 6) ) ) ) )L L L L@ @ @ @ =A 
 
 
 
 
 

 =A D D D D D D =A D D D D D D 9= Y Y Y Y Y Y :> 
 
 
 
 
 
 #'!').#
 
 
 
 
* 7=l / / / / /
 7""	 !$	 	 	 	 	 
	 
 #&	
 !$	 	 	 	 	 
	 
 #&	 ,/!$	 	 	 	 	 
	 	 
	W	$	$ 
 04	 "&		 	 	 	 	 
	 
 03	
 "%	 	 	 	 	 
	 	 
MMMM 
M	JM	 	 	 	 
	- - -
 .H.H.H;&DLL(EM.H;&DL]*FN       
B
 - 
 "(44-  -  -  -  -  - d |w	 	 	 	 |ww&& "%"% #	    X  "%"% #    X  ,,, X,<<< X<	 	 	 	  #!"'+O! O! O! O! O!b 7 7 7 [ 7 7 7 7 7r7   r#   c                  @    e Zd Zeej        dd                        ZdS )r3  r.   Iterator[None]c               #     K   	 d V  d S # t           $ r*} | j        t          j        k    rt          | j         |  d } ~ ww xY wrD   )r  errno	ENOTEMPTYr3  rT  )r!  s    r5   r4  zDirectoryNotEmpty.translate&  sX      	EEEEE 	 	 	yEO++'2;	s   
 
>%9>N)r.   r  )r;   r<   r=   r  r&  r  r4  r>   r7   r5   r3  r3  %  s@            \  r7   r3  	copy_funcrj  c                H     t          j                   d fd            }|S )zg
    Wrap a copy function (like shutil.copy2) to return
    the dst if it's newer than the source.
    srcr~   rW  c                    t          |           }t          |          }|                                o)|                                |                                k    }|r|S  | |          S rD   )r#   r  r  )r  rW  src_pdst_pis_newer_dstr  s        r5   wrapperzonly_newer.<locals>.wrapper7  sc    S		S		||~~N%..*:*:enn>N>N*N 	Jyc"""r7   )r  r~   rW  r~   )rM   wraps)r  r  s   ` r5   
only_newerr  1  s?     _Y# # # # #  # Nr7   c                      e Zd ZdZddZdS )
ExtantPathz
    >>> ExtantPath('.')
    ExtantPath('.')
    >>> ExtantPath('does-not-exist')
    Traceback (most recent call last):
    OSError: does-not-exist does not exist.
    r.   rj   c                R    |                                  st          |  d          d S )Nz does not exist.)r  r  rp   s    r5   rm   zExtantPath._validateL  s3    {{}} 	5T333444	5 	5r7   Nr  r;   r<   r=   rR   rm   r>   r7   r5   r  r  C  s2         5 5 5 5 5 5r7   r  c                      e Zd ZdZddZdS )
ExtantFilea  
    >>> ExtantFile('.')
    Traceback (most recent call last):
    FileNotFoundError: . does not exist as a file.
    >>> ExtantFile('does-not-exist')
    Traceback (most recent call last):
    FileNotFoundError: does-not-exist does not exist as a file.
    r.   rj   c                R    |                                  st          |  d          d S )Nz does not exist as a file.)r  r2  rp   s    r5   rm   zExtantFile._validate[  s6    ||~~ 	I#t$G$G$GHHH	I 	Ir7   Nr  r  r>   r7   r5   r  r  Q  s8         I I I I I Ir7   r  c                  b    e Zd ZU ded<   ded<    G d d          Z	 	 	 	 	 dddZddZddZdS )r  rv   
path_classr	   r  c                  4    e Zd ZU ded<   ded<   ddZdd
ZdS )SpecialResolver.ResolverScoper  pathsr~   scoper.   rj   c                "    || _         || _        d S rD   )r  r  )rE   r  r  s      r5   rF   z&SpecialResolver.ResolverScope.__init__h  s    DJDJJJr7   class__MultiPathTypec                B    | j                             | j        |          S rD   )r  get_dirr  )rE   r  s     r5   __getattr__z)SpecialResolver.ResolverScope.__getattr__l  s    :%%dj&999r7   N)r  r  r  r~   r.   rj   )r  r~   r.   r  )r;   r<   r=   r  rF   r  r>   r7   r5   ResolverScoper  d  sS         


	 	 	 		: 	: 	: 	: 	: 	:r7   r  NFappnamer@  	appauthorversionroamingr.  	multipathc                z    t          j        d          }|| _        |                    |||||          | _        d S )Nappdirs)r  r  r  r  r  )	importlibimport_moduler  AppDirsr  )rE   r  r  r  r  r  r  r  s           r5   rF   zSpecialResolver.__init__o  sH     ))44$ ' 
 
r7   r  r~   r.   c                .    |                      | |          S rD   )r  )rE   r  s     r5   r  zSpecialResolver.__getattr__  s    !!$...r7   r  r  c                    | d| d}t          | j        |          }t                              | j                  }|                    |          S )zs
        Return the callable function from appdirs, but with the
        result wrapped in self.path_class
        rt   _dir)r0  r  Multi	for_classr  detect)rE   r  r  	prop_namer,   	MultiPaths         r5   r  zSpecialResolver.get_dir  sR    
 ++v+++	i00OODO44	&&&r7   )NNNFF)r  rv   r  r@  r  r@  r  r@  r  r.  r  r.  )r  r~   r.   r  )r  r~   r  r~   r.   r  )r;   r<   r=   r  r  rF   r  r  r>   r7   r5   r  r  `  s         	: 	: 	: 	: 	: 	: 	: 	: # $"
 
 
 
 
&/ / / /' ' ' ' ' 'r7   r  c                  |    e Zd ZdZedd            Zedd
            ZddZej	        edd                        Z
dS )r   zS
    A mix-in for a Path which may contain multiple Path separated by pathsep.
    path_clsrv   r.   type[_MultiPathType]c                <    d|j         z   }t          || |fi           S )Nr   ru   )rh   r  r   s      r5   r  zMulti.for_class  s%    **D3/2...r7   inputr~   r  c                B    t           j        |vr| j        }  | |          S rD   )r   pathsepr}   )rh   r	  s     r5   r  zMulti.detect  s$    :U""/Cs5zzr7   rI   c                    t          t          | j        |                     t          j                                      S rD   )ri  mapr}   r   r   r  rp   s    r5   __iter__zMulti.__iter__  s+    C($**RZ*@*@AABBBr7   
type[Path]c                >    t          d | j        D                       S )z>
        Multi-subclasses should use the parent class
        c              3  D   K   | ]}t          |t                    |V  d S rD   )
issubclassr   )r\   r  s     r5   r^   z$Multi._next_class.<locals>.<genexpr>  s1      VVvJvu<U<UVFVVVVVVr7   )next__mro__r|   s    r5   r}   zMulti._next_class  s#     VVVVVVVVr7   N)r  rv   r.   r  )r	  r~   r.   r  )r.   rI   r.   r  )r;   r<   r=   rR   r  r  r  r  r   r  r}   r>   r7   r5   r   r     s          / / / [/    [
C C C C W W W [ W W Wr7   r   c                      e Zd ZdS )r  Nr:   r>   r7   r5   r  r    r?   r7   r  c                  n     e Zd ZdZej        edd                        Zd fdZddZ	dd	Z
dd
Z xZS )r$   as  
    A temporary directory via :func:`tempfile.mkdtemp`, and
    constructed with the same parameters that you can use
    as a context manager.

    For example:

    >>> with TempDir() as d:
    ...     d.is_dir() and isinstance(d, Path)
    True

    The directory is deleted automatically.

    >>> d.is_dir()
    False

    .. seealso:: :func:`tempfile.mkdtemp`
    r.   r  c                    t           S rD   )r#   r|   s    r5   r}   zTempDir._next_class  s	     r7   r   c                j    t          j        |i |}t                                          | |          S rD   )tempfilemkdtemprf   rg   )rh   rT  rU  r   ri   s       r5   rg   zTempDir.__new__  s0    "D3F33wwsG,,,r7   rj   c                    d S rD   r>   rS  s      r5   rF   zTempDir.__init__  rq   r7   c                ,    |                      |           S rD   )r}   rp   s    r5   r   zTempDir.__enter__  s    
 %%%r7   c                .    |                                   d S rD   )rz  r   s     r5   r   zTempDir.__exit__  s    r7   r  r  r  )r;   r<   r=   rR   r   r  r  r}   rg   rF   r   r   r  r  s   @r5   r$   r$     s         &    [ - - - - - -   & & & &       r7   r$   c                  n    e Zd Zedd            Zedd            Zedd            Zedd            ZdS )r  msgr~   r.   r   c                      rD   r>   r   s    r5   r  zHandlers.strict  s    r7   rj   c                >    t          j        | t          d           d S )N   )
stacklevel)warningswarnr9   r"  s    r5   r'  zHandlers.warn  s    c?q999999r7   c                    d S rD   r>   r"  s    r5   rg  zHandlers.ignore  s    r7   paramstr | Callable[[str], None]Callable[[str], None]c                    d}t          |t                    r;|t          |           vrt          |          | j        | j        | j        d|         S t          |          st          |          |S )Nzinvalid errors parameter)r  r'  rg  )r1   r~   varsr   r  r'  rg  callable)rh   r)  r   s      r5   r  zHandlers._resolve  sq    (eS!! 	DII%% oo%!j#(cjQQRWXXE?? & oo%Lr7   N)r   r~   r.   r   )r   r~   r.   rj   )r)  r*  r.   r+  )	r;   r<   r=   r  r  r'  rg  r  r  r>   r7   r5   r  r    s           \ : : : \:    \ 	 	 	 [	 	 	r7   r  )r,   r-   r.   r/   r  )r  rj  r.   rj  )erR   
__future__r   builtinsr&  datetimer  r1  rM   r8  r  r  r  r   r   rerZ  r{  r  r&  ior   r   r   r   r   typesr	   r'  ImportErrorr  r  r  collections.abcr
   r   r   typingr   r   r   r   r   r   r   	_typeshedr   r   r   r   r   r   typing_extensionsr   r   r   r~   r.  r   objectrj  r   r  rw  BaseException_OnExcCallbackrX   r   r   r    compat.py38r!   r"   __all__LINESEPS
U_LINESEPScompiler   rz  	B_NEWLINEry  r,  B_NL_ENDrY   _default_linesepr6   Warningr9   r%   r`   r#   r  r3  r  r  r  r  r   r  r$   r  r>   r7   r5   <module>rF     s   0 # " " " " "                       				  				  



                     Z%%                 Z%%  JJJ               Z%%  JJJ               : 9 9 9 9 9 9 9 9 9                 P                76666666663#-t34FSz6)*G#tCy)8C=89I#s(!3S' BF JKxS13FNON ' & & & & & & & & & 3 3 3 3 3 3 3 3
*
*
*6666
BJsxx))002233	BJsxx
++,,	2:i'$.//2:i'#-..688 $ $ $ $
	 	 	 	 	g 	 	 	#< #< #< #< #< #< #< #<L6 6 6 6@7 @7 @7 @7 @73 @7 @7 @7F4	 	 	 	 	 	 	 	   $5 5 5 5 5 5 5 5I I I I I I I I-' -' -' -' -' -' -' -'`W W W W W W W W8	 	 	 	 	UD 	 	 	( ( ( ( (d ( ( (V         s6   1BB	BB..B25B2	CC!C