
    F-PhD                    F   d Z ddlmZ ddlZddlm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mZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlmZ ddlmZ ddlZddlmZ ddlmZ ddlmZ ddlm Z  ddlm!Z! ddl"Z"ddl#Z#ddl$m%Z% ej&        dk    p e'edd          dk    Z( G d d          Z) G d de*          Z+ G d  d!          Z, G d" d#          Z-d$ Z. G d% d&          Z/d' Z0d( Z1 G d) d*          Z2d+ Z3d, Z4d- Z5d. Z6e2Z7dS )/zlocal path implementation.    )annotationsN)Callable)contextmanager)abspath)dirname)exists)isabs)isdir)isfile)islink)normpath)S_ISDIR)S_ISLNK)S_ISREG)Any)cast)Literal)overload)TYPE_CHECKING   )errorwin32_nameFntc                  t    e Zd ZU dZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zded<   ddZd Zd Zd Zd ZdS )Checkers)r   linkdirfilec                    || _         d S Npath)selfr#   s     P/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/_pytest/_py/path.py__init__zCheckers.__init__,   s    			    c                @    | j         j                            d          S N.r#   basename
startswithr$   s    r%   dotfilezCheckers.dotfile/       y!,,S111r'   c                V    |                     d          sd|z   }| j        j        |k    S r)   )r-   r#   extr$   args     r%   r2   zCheckers.ext2   s.    ~~c"" 	)Cy}##r'   c                "    | j         j        |k    S r!   )r#   r,   r3   s     r%   r,   zCheckers.basename7   s    y!S((r'   c                @    | j         j                            |          S r!   r+   r3   s     r%   
basestartszCheckers.basestarts:   r0   r'   c                6    | j                             |          S r!   )r#   reltor3   s     r%   r9   zCheckers.relto=   s    ys###r'   c                6    | j                             |          S r!   )r#   fnmatchr3   s     r%   r;   zCheckers.fnmatch@   s    y  %%%r'   c                P    t          | j                                      |          S r!   )strr#   endswithr3   s     r%   r>   zCheckers.endswithC   s    49~~&&s+++r'   c                   ddl m} |                                D ]N\  }}d}d }	 t          | |          }nJ# t          $ r= |d d         dk    r,d}	 t          | |dd                    }n# t          $ r Y nw xY wY nw xY w|t          d|d| j                  	  ||          j        d	k    r ||           |z  r dS n-t          |          t           |                      z  |z  r dS # t          j
        t          j        t          j        f$ rO | j        D ]C}||v r|                    |          r Y  dS d|z   }||v r|                    |          s Y  dS DY Lw xY wdS )
N   )
getrawcodeF   notTzno z checker available for r   )_code.sourcerA   itemsgetattrAttributeError	TypeErrorr#   co_argcountboolr   ENOENTENOTDIREBUSY_depend_on_existenceget)r$   kwrA   namevalueinvertmeths          r%   	_evaluatezCheckers._evaluateF   s   ------88::  	)  	)KD%FDtT**!   8u$$!F&tT!""X66)    | Rd R RTY R RSSS):d##/!33 DKK61 %$uu% E{{T$$&&\\1F: %$uuL%-= ) ) ) !5 ) )Drzz66$<< )#(5555 4<Drzz!vvd|| )#(5555) )	) tsX   7A>A+*A>+
A85A>7A88A>=A>#C3+C33A	E( E(#E('E(Stat
_statcachereturnc                    	 | j         S # t          $ r] 	 | j                                        | _         n3# t          j        $ r! | j                                        | _         Y nw xY w| j         cY S w xY wr!   )rW   rG   r#   statr   ELOOPlstatr.   s    r%   _statzCheckers._statn   s    	#?" 	# 	# 	#4"&).."2"2; 4 4 4"&)//"3"34?"""	#s/   	 
A03A0-A# A0"A##
A0/A0c                N    t          |                                 j                  S r!   )r   r]   moder.   s    r%   r   zCheckers.dirx       tzz||()))r'   c                N    t          |                                 j                  S r!   )r   r]   r_   r.   s    r%   r   zCheckers.file{   r`   r'   c                *    |                                  S r!   )r]   r.   s    r%   r   zCheckers.exists~       zz||r'   c                \    | j                                         }t          |j                  S r!   )r#   r\   r   r_   )r$   sts     r%   r   zCheckers.link   s#    Y__rwr'   NrX   rV   )__name__
__module____qualname__rN   r&   r/   r2   r,   r7   r9   r;   r>   rU   __annotations__r]   r   r   r   r    r'   r%   r   r   )   s        :  2 2 2$ $ $
) ) )2 2 2$ $ $& & &, , ,$ $ $L # # # #* * ** * *           r'   r   c                      e Zd ZdS )NeverRaisedN)rg   rh   ri   rk   r'   r%   rm   rm      s        Dr'   rm   c                      e Zd Zd Zd ZdS )Visitorc                ~   t          |t                    rt          |          }t          |t                    rt          |          | _        n"t	          |d          s|r	d | _        n|| _        || _        || _        || _        |r-t          t          t          gt          f         t                    nd | _        d S )N__call__c                    dS NTrk   r"   s    r%   <lambda>z"Visitor.__init__.<locals>.<lambda>   s    D r'   c                    | S r!   rk   xs    r%   rt   z"Visitor.__init__.<locals>.<lambda>   s    RS r'   )
isinstancer=   	FNMatcherrechasattrfilignorebreadthfirstr   r   r   sortedoptsortr$   r|   rz   r}   bfsorts         r%   r&   zVisitor.__init__   s    c3 	!C..Cc3 	4=cNNDHHj)) 	c 	((DHHDH=ATtHcUCZ0&999r'   c              #    K   	 |                                 }n# | j        $ r Y d S w xY w| j        |                     fd|D                       }| j        s |D ]}|                     |          E d {V  |                     |          D ]"}| j        |                     |          r|V  #| j        r |D ]}|                     |          E d {V  d S d S )Nc                Z    g | ]'}|                     d            |          %|(S )r   r   check).0prz   s     r%   
<listcomp>zVisitor.gen.<locals>.<listcomp>   s7    NNN1177q7>>Ns{cc!ff{Q{{{r'   )listdirr}   rz   r   r~   genr|   )r$   r#   entriesdirssubdirr   rz   s         @r%   r   zVisitor.gen   sD     	llnnGG{ 	 	 	FF	h||NNNNNNN
 
   	, , ,88F++++++++++g&& 	 	Ax488A;; 	, , ,88F++++++++++	, 	,, ,s    
((N)rg   rh   ri   r&   r   rk   r'   r%   ro   ro      s5        U U U, , , , ,r'   ro   c                      e Zd Zd Zd ZdS )ry   c                    || _         d S r!   )patternr$   r   s     r%   r&   zFNMatcher.__init__   s    r'   c                   | j         }|                    |j                  dk    rOt          rH|                    t          j                  dk    r%|                    t          j        |j                  }|                    |j                  dk    r|j        }n;t          |          }t          j	        
                    |          sd|j        z   |z   }t          j        ||          S )N*)r   findsepiswin32	posixpathreplacer,   r=   osr#   r	   r;   )r$   r#   r   rQ   s       r%   rq   zFNMatcher.__call__   s    , LL""b(( )Y]++r11
 ooimTX>>G<<!!R''=DDt99D7==)) 3.72tW---r'   N)rg   rh   ri   r&   rq   rk   r'   r%   ry   ry      s2          . . . . .r'   ry   c                <    t          t          | |                    S r!   )listmap)funciters     r%   map_as_listr      s    D$   r'   c                      e Zd Zeredd            Zedd            Zdd	Zd
 Zed             Z	ed             Z
d Zd Zd ZdS )rV   rX   intc                    d S r!   rk   r.   s    r%   sizez	Stat.size   s    "sr'   floatc                    d S r!   rk   r.   s    r%   mtimez
Stat.mtime   s    "%#r'   rQ   r=   r   c                2    t          | j        d|z             S )Nst_)rF   _osstatresult)r$   rQ   s     r%   __getattr__zStat.__getattr__   s    t)54<888r'   c                "    || _         || _        d S r!   )r#   r   )r$   r#   osstatresults      r%   r&   zStat.__init__   s    	)r'   c                    t           rt          d          dd l}t          j        |j        | j                  }|d         S )N	XXX win32r   )r   NotImplementedErrorpwdr   checked_callgetpwuiduid)r$   r   entrys      r%   ownerz
Stat.owner   s@     	3%k222


"3<::Qxr'   c                    t           rt          d          ddl}t          j        |j        | j                  }|d         S )zReturn group name of file.r   r   N)r   r   grpr   r   getgrgidgid)r$   r   r   s      r%   groupz
Stat.group   sB      	3%k222


"3<::Qxr'   c                4    t          | j        j                  S r!   )r   r   st_moder.   s    r%   r
   z
Stat.isdir       t)1222r'   c                4    t          | j        j                  S r!   )r   r   r   r.   s    r%   r   zStat.isfile   r   r'   c                f    | j                                          t          | j        j                  S r!   )r#   r\   r   r   r   r.   s    r%   r   zStat.islink   s(    	t)1222r'   NrX   r   rX   r   )rQ   r=   rX   r   )rg   rh   ri   r   propertyr   r   r   r&   r   r   r
   r   r   rk   r'   r%   rV   rV      s         &	""" 
"	%%% 
%9 9 9 9* * *   X   X3 3 33 3 33 3 3 3 3r'   rV   c                n    dd l }t          | t                    s|                    |           d         } | S Nr   r@   )r   rx   r   getpwnam)userr   s     r%   	getuseridr      s8    JJJdC   %||D!!!$Kr'   c                n    dd l }t          | t                    s|                    |           d         } | S r   )r   rx   r   getgrnam)r   r   s     r%   
getgroupidr     s8    JJJeS!! 'U##A&Lr'   c                  f   e Zd ZdZ G d de          Zej        ZdtdZe	j
        dk    rdud	ZdvdZd ZdwdZd ZeZed             Zed             Zed             Zed             Zd Zd ZdxdZdwdZd Zd Zd Zd Zd Zd Zd  Z d! Z!d" Z"dyd#Z#d$ Z$d% Z%dde&ddfd&Z'd' Z(d( Z)d) Z*d* Z+d+ Z,d, Z-d- Z.d. Z/dzd/Z0d{d2Z1d3 Z2d|d6Z3d7 Z4dd8d}d=Z5d~d>Z6d? Z7d@ Z8dA Z9 e:dBej        z             Z;ddCZ<ddEZ=ddGZ>ddHZ?dI Z@dwdJZAdK ZBdydLZCdydMZDddOZEdP ZFdQ ZGeHdddV            ZIeHddY            ZIddd[ZIdd\ZJdd]ZKd^ ZLeMd_             ZNd` ZOda ZPdb ZQdc ZRduddZSde ZTdf ZUddgZVddkZWeXddl            ZYeXdm             ZZeXdn             Z[eXddo            Z\eX	 dds            Z]dS )	LocalPathz]Object oriented interface to os.path and other local filesystem
    related information.
    c                      e Zd ZdZdS )LocalPath.ImportMismatchErrorz9raised on pyimport() if there is a mismatch of __file__'sN)rg   rh   ri   __doc__rk   r'   r%   ImportMismatchErrorr     s        GGGGr'   r   NFc                $   |%t          j        t          j                  | _        dS 	 t          j        |          }n# t          $ r t          d          w xY w|rt          j        	                    |          }t          |          | _        dS )a  Initialize and return a local Path instance.

        Path can be relative to the current directory.
        If path is None it defaults to the current working directory.
        If expanduser is True, tilde-expansion is performed.
        Note that Path instances always carry an absolute path.
        Note also that passing in a local path object will simply return
        the exact same path object. Use new() to get a new copy.
        NzDcan only pass None, Path instances or non-empty strings to LocalPath)r   r   r   getcwdstrpathfspathrH   
ValueErrorr#   
expanduserr   )r$   r#   r   s      r%   r&   zLocalPath.__init__  s     < -bi88DLLLy    8  
  0w))$//"4==DLLLs	   > Ar   r   c                ^   t          |          }t          |          }|r^|                     d           D ]F}|                    d          r.t	          j        t          j        t          |          ||           Gt	          j        t          j        t          |           ||           dS )zChange ownership to the given user and group.
            user and group may be specified by a number or
            by a name.  if rec is True change ownership
            recursively.
            c                .    |                      d          S Nr   r   r   rv   s    r%   rt   z!LocalPath.chown.<locals>.<lambda>6  s    !''q'// r'   rz   r   r   N)	r   r   visitr   r   r   r   chownr=   )r$   r   r   rz   r   r   rw   s          r%   r   zLocalPath.chown-  s     D//CU##C G(A(ABB G GAwwAw G*28SVVS#FFFrxTC=====r'   rX   r=   c                J    t          j        t          j        | j                  S )z Return value of a symbolic link.)r   r   r   readlinkr   r.   s    r%   r   zLocalPath.readlink;  s     %bk4<@@@r'   c                z    t          j        t          j        t	          |          t	          |                      dS )z&Posix style hard link to another name.N)r   r   r   r   r=   )r$   oldnames     r%   mklinktozLocalPath.mklinkto@  s+    rwGc$ii@@@@@r'   r   c                   |r4t          j        t          j        t	          |          | j                   dS |                     |          }|                     |                              |          }|                     |          }|	                    | j
                  }| j
                            d|z  |fz             }t          j        t          j        || j                   dS )zGCreate a symbolic link with the given value (pointing to another name).)z..N)r   r   r   symlinkr=   r   common	__class__r9   countr   join)r$   rR   absolutebase	relsourcereldestntargets           r%   mksymlinktozLocalPath.mksymlinktoD  s     	E"2:s5zz4<HHHHH{{5)) NN51177==	**T**MM$(++w{i\'ABB"2:vt|DDDDDr'   c                P    |                      t          j        |                    S r!   )r   r   r   r$   others     r%   __div__zLocalPath.__div__Q  s    yy5))***r'   c                8    |                      d          d         S )zBasename part of path.r,   r   
_getbyspecr.   s    r%   r,   zLocalPath.basenameV  s     z**1--r'   c                8    |                      d          d         S )zDirname part of path.r   r   r   r.   s    r%   r   zLocalPath.dirname[  s     y))!,,r'   c                8    |                      d          d         S )zPure base name of the path.purebasenamer   r   r.   s    r%   r   zLocalPath.purebasename`  s     ~..q11r'   c                8    |                      d          d         S )z*Extension of the path (including the '.').r2   r   r   r.   s    r%   r2   zLocalPath.exte  s     u%%a((r'   c                    |                      d          5 }|                                cddd           S # 1 swxY w Y   dS )3Read and return a bytestring from reading the path.rbNopenread)r$   fs     r%   read_binaryzLocalPath.read_binaryj  ~    YYt__ 	6688	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   7;;c                    |                      d|          5 }|                                cddd           S # 1 swxY w Y   dS )z7Read and return a Unicode string from reading the path.rencodingNr  )r$   r  r  s      r%   	read_textzLocalPath.read_texto  s    YYsXY.. 	!6688	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   9= =r
  c                    |                      |          5 }|                                cddd           S # 1 swxY w Y   dS )r   Nr  )r$   r_   r  s      r%   r  zLocalPath.readt  r  r  c                   d}|s*|                      |          }|                    d          S |                     |          }	 |                                |                                 S # |                                 w xY w)z}Read and return a list of lines from the path. if cr is False, the
        newline will be removed from the end of each line.r
  
)r  splitr  	readlinesclose)r$   crr_   contentr  s        r%   r  zLocalPath.readlinesy  sr      	iiooG==&&&		$A{{}}								s   A- -Bc                    |                      d          }	 ddl}t          j        |j        |          |                                 S # |                                 w xY w)z5(deprecated) return object unpickled from self.read()r  r   N)r  pickler   r   loadr  )r$   r  r  s      r%   r  zLocalPath.load  sR    IIdOO	MMM%fk155GGIIIIAGGIIIIs   A	 	Ac                   |                     |           rt          j        |d          	 |                     |           dS # t          j        $ r- |                     |           |                                  Y dS w xY w)zMove this path to target.z.cannot move path into a subdirectory of itselfN)r9   r   EINVALrenameEXDEVcopyremover$   r   s     r%   movezLocalPath.move  s    << 	Y,v'WXXX	KK{ 	 	 	IIfKKMMMMMM	s   A 8A?>A?c                2     t          |          |           S )a3  Return true if the basename/fullname matches the glob-'pattern'.

        valid pattern characters::

            *       matches everything
            ?       matches any single character
            [seq]   matches any character in seq
            [!seq]  matches any char not in seq

        If the pattern contains a path-separator then the full path
        is used for pattern matching and a '*' is prepended to the
        pattern.

        if the pattern doesn't contain a path-separator the pattern
        is only matched against the basename.
        )ry   r   s     r%   r;   zLocalPath.fnmatch  s    " "y!!$'''r'   c                B   t          |t          t          f          st          |d          t          |          }|r|d         | j        k    r
|| j        z  }| j        }t          j        dk    st          t          dd          dk    rgt          j
                            |                              t          j
                            |                    r|t          |          d         S n,|                    |          r|t          |          d         S dS )z_Return a string which is the relative part of the path
        to the given 'relpath'.
        z: not a string or path objectr   r   r   Nr    )rx   r=   r   rH   r   r   sysplatformrF   r   r#   normcaser-   len)r$   relpath
strrelpathstrselfs       r%   r9   zLocalPath.relto  s    'C#344 	IwGGGHHH\\
 	#*R.DH44$("J ,<7""gb'4&@&@D&H&Hw((33BG4D4DZ4P4PQQ 2s:00112
++ 	.3z??,,--rr'   c                     | j         |ddiS )z0Ensure the path joined with args is a directory.r   T)ensure)r$   argss     r%   
ensure_dirzLocalPath.ensure_dir  s    t{D+d+++r'   c                   	 | |k    rt           j        S |                     |          }|st          |          S |                     |          }|                    |          }|r|                    | j                  dz   }nd}t           j        g|z  }|r|                    |           |j        	                    |          }|S # t          $ r t          |          cY S w xY w)zReturn a string which is a relative path from self
        (assumed to be a directory) to dest such that
        self.join(bestrelpath) == dest and if not such
        path can be determined return dest.
        r   r   )r   curdirr   r=   r9   r   r   pardirappendr   rG   )r$   destr   	self2baser   r   lstr   s           r%   bestrelpathzLocalPath.bestrelpath  s    	t||y ;;t$$D !4yy 

4((Ijj&&G OODH--19+/C $

7###X]]3''FM 	 	 	t99	s   C	 %C	 BC	 	C%$C%c                *    |                                  S r!   r   r.   s    r%   r   zLocalPath.exists  rc   r'   c                .    |                      d          S )Nr   r   r   r.   s    r%   r
   zLocalPath.isdir  s    zzaz   r'   c                .    |                      d          S )Nr   r   r   r.   s    r%   r   zLocalPath.isfile  s    zzqz!!!r'   c                    | }| g}	 |}|                                 }||k    rn|                    |           3|s|                                 |S )z[Return a root-first list of all ancestor directories
        plus the path itself.
        )dirpathr2  reverse)r$   r=  currentr5  lasts        r%   partszLocalPath.parts  sh     f	 Doo''GwJJw	   	KKMMM
r'   c                    d}t          |                                 |                                          D ]\  }}||k    r|c S |}|S )zfReturn the common part shared with the other path
        or None if there is no common part.
        N)zipr@  )r$   r   r?  rw   ys        r%   r   zLocalPath.common  sT     

ekkmm44 	 	DAqAvvDDr'   c                X    |                      | j        t          |          z             S )z9Return new path object with 'other' added to the basenamer,   )newr,   r=   r   s     r%   __add__zLocalPath.__add__  s#    xxU!;x<<<r'   c              #  b   K   t          |||||                              |           E d{V  dS )a  Yields all paths below the current one

        fil is a filter (glob pattern or callable), if not matching the
        path will not be yielded, defaulting to None (everything is
        returned)

        rec is a filter (glob pattern or callable) that controls whether
        a node is descended, defaulting to None

        ignore is an Exception class that is ignoredwhen calling dirlist()
        on any of the paths (by default, all exceptions are reported)

        bf if True will cause a breadthfirst search instead of the
        default depthfirst. Default: False

        sort if True will sort entries within each directory level.
        N)ro   r   r   s         r%   r   zLocalPath.visit  sD      $ 3VR66::4@@@@@@@@@@@r'   c                    |r`t          |d          r:t          j        t          d          d           |                    |           d S |                                 d S d S )Nrq   z:listdir(sort=callable) is deprecated and breaks on python3rB   )
stacklevel)r{   warningswarnDeprecationWarningr   )r$   resr   s      r%   	_sortlistzLocalPath._sortlist  sz     
	tZ(( 	&T   !	    





	 
	r'   c                    | j         S r!   r   r.   s    r%   
__fspath__zLocalPath.__fspath__)  s
    |r'   c                d    | j         }t          r|                                }t          |          S r!   )r   r   lowerhash)r$   ss     r%   __hash__zLocalPath.__hash__,  s)    L 			AAwwr'   c                   t          j        |           }	 t          j        |          }n# t          $ r Y dS w xY wt          r;|                                }	 |                                }n# t
          $ r Y dS w xY w||k    S NF)r   r   rH   r   rT  rG   )r$   r   s1s2s       r%   __eq__zLocalPath.__eq__2  s    Yt__	5!!BB 	 	 	55	 	BXXZZ!   uuRxs   + 
99A- -
A;:A;c                    | |k     S r!   rk   r   s     r%   __ne__zLocalPath.__ne__@  s    EM""r'   c                V    t          j        |           t          j        |          k     S r!   r   r   r   s     r%   __lt__zLocalPath.__lt__C      y5!1!111r'   c                V    t          j        |           t          j        |          k    S r!   r`  r   s     r%   __gt__zLocalPath.__gt__F  rb  r'   c                   t          j        |          }t          |          st          |          }| |k    rdS t	          t           j        d          sdS t          j        t           j        j        | j	        |          S )z:Return True if 'other' references the same file as 'self'.TsamefileF)
r   r   r	   r   r{   r#   r   r   rf  r   r   s     r%   rf  zLocalPath.samefileI  sm    	%  U|| 	#ENNE5==4rw
++ 	5!"'"2DL%HHHr'   c                   |                      dd          rm|rEt          r|                     dd           ddl}t	          j        |j        | j        |           dS t	          j        t          j	        | j                   dS t          r|                     d           t	          j        t          j
        | j                   dS )zRemove a file or directory (or a directory tree if rec=1).
        if ignore_errors is True, errors while removing directories will
        be ignored.
        r   r   )r   r   i  r   N)ignore_errors)r   r   chmodshutilr   r   rmtreer   r   rmdirr  )r$   rz   rh  rj  s       r%   r  zLocalPath.removeT  s    
 ::!!:$$ 	8 
; -JJu!J,,,"M4<}      "28T\::::: "

5!!!ry$,77777r'   md5   c                   	 	 ddl }n'# t          $ r |dk    rd}t          |          }Y nw xY w t          ||                      }n(# t          t          f$ r t          d|d          w xY w|                     d          }	 	 |                    |          }|s(|                                |	                                 S |
                    |           U# |	                                 w xY w)z,Return hexdigest of hashvalue for this file.r   Nsha1shazDon't know how to compute z hashr  )hashlibImportError
__import__rF   rG   r   r  r  	hexdigestr  update)r$   hashtype	chunksizemodrU  r  bufs          r%   computehashzLocalPath.computehashj  s/   		M+%%%%% + + +v%%$H **+ *73))++DD, 	M 	M 	MK(KKKLLL	MIIdOO	!ffY'' ,>>++ GGIIII C   	! GGIIIIs3    A !,A ,A %A-+C C C2c                D   t                               | j                  }|s| j        |_        |S |                     d          \  }}}}}d|v rd|v sd|v rt          d|          nT|                    d|          }	 |d         }|r|                    d          sd|z   }n# t          $ r Y nw xY w||z   |d<   d|v r|d         s||d<   n|                    d|           |                    d| j	                   t           d	j        d
i |          |_        |S )a  Create a modified version of this path.
        the following keyword arguments modify various path parts::

          a:/some/path/to/a/file.ext
          xx                           drive
          xxxxxxxxxxxxxxxxx            dirname
                            xxxxxxxx   basename
                            xxxx       purebasename
                                 xxx   ext
        z'drive,dirname,basename,purebasename,extr,   r   r2   zinvalid specification r*   r   r   z{dirname}{sep}{basename}rk   )object__new__r   r   r   r   
setdefaultr-   KeyErrorr   r   format)	r$   rP   objdriver   r,   r   r2   pbs	            r%   rF  zLocalPath.new  st    nnT^,, 	,CKJ6:oo57
 7
3w, ##u{{ !@"!@!@AAA (3 ~|<<B$i  $s~~c22 $)C	    
  #XBzN??2i=?!ByMMMM)W---
eTX&&&@9@FF2FFGG
s   B& &
B32B3spec	list[str]c                   g }| j                             | j                  }t          d|                    d                    }|D ]}|dk    r|                    |d                    %|dk    r6|                    | j                            |dd                              a|d         }|dk    r|                    |           |                    d          }|dk    r|d	}	}n|d|         ||d         }	}|d
k    r|                    |           |dk    r|                    |	           t          d|          |S )zSee new for what 'spec' can be.N,r  r   r   r   r,   r*   r#  r   r2   zinvalid part specification )r   r  r   filterr2  r   rfindr   )
r$   r  rN  r@  r-  rQ   r,   ir   r2   s
             r%   r   zLocalPath._getbyspec  s]   ""48,,dDJJsOO,, 	Q 	QDw

58$$$$""

48==ss445555 9:%%JJx(((( s++ABww,4bc,4RaRL(122,c~--

<0000

3()Ot)O)OPPP
r'   c                    |sFt                               | j                  }t          | j                  |_        |r
 |j        | }|S  |                     d          j        |i |S )z?Return the directory path joined with any given path arguments.r#  rE  )r}  r~  r   r   r   r   rF  )r$   r-  kwargsr#   s       r%   r<  zLocalPath.dirpath  so     	>>$.11D"4<00DL ( ty$'K)txxx$$)4:6:::r'   absr-  os.PathLike[str]r  rJ   c                   | j         }d |D             }| j        }|r?g }t          |          D ]-}t          |          r|}|} n|                    d|           .|                    |          rdn|}|D ]S}|                    |          }t          r+|                    d          }|                    d|          }||z   |z   }|}Tt          
                    | j                  }	t          |          |	_        |	S )zReturn a new path by appending all 'args' as path
        components.  if abs=1 is used restart from root if any
        of the args is an absolute path.
        c                6    g | ]}t          j        |          S rk   r`  r   r4   s     r%   r   z"LocalPath.join.<locals>.<listcomp>  s     222c29S>>222r'   r   r#  /)r   r   reversedr	   insertr>   stripr   r   r}  r~  r   r   )
r$   r  r-  r   strargsr   newargsr4   
actual_sepr  s
             r%   r   zLocalPath.join  s   
 h22T222, 	'!#G(( ' ':: !G%GEq#&&&&"++C009RRc
 	 	C))C..C ,iinnkk#s++
*S0GJJnnT^,,w''
r'   c                    |r(|                                                      d           |r't          j        t          j        | j        ||          S t          j        t
          | j        |          S )ztReturn an opened file with the given mode.

        If ensure is True, create parent directories if needed.
        r   r   r  )r<  r,  r   r   ior  r   )r$   r_   r,  r  s       r%   r  zLocalPath.open  sv    
  	)LLNN!!a!((( 	%!	    !$d;;;r'   c                r    t                               | j                  }| j        | j        z   |z   |_        |S r!   )r}  r~  r   r   r   )r$   rQ   childs      r%   	_fastjoinzLocalPath._fastjoin  s/    t~..tx/$6r'   c                *    t          | j                  S r!   )r   r   r.   s    r%   r   zLocalPath.islink  s    dl###r'   c                ,   |st          | j                  S t          |          dk    rDd|v r|d         t          | j                  z   S d|v r|d         t	          | j                  z   S |sddi}t          |                               |          S )a  Check a path for existence and properties.

        Without arguments, return True if the path exists, otherwise False.

        valid checkers::

            file = 1  # is a file
            file = 0  # is not a file (may not even exist)
            dir = 1  # is a dir
            link = 1  # is a link
            exists = 1  # exists

        You can specify multiple checker definitions, for example::

            path.check(file=1, link=1)  # a link pointing to a file
        r   r   r   r   )r   r   r'  r
   r   r   rU   )r$   rP   s     r%   r   zLocalPath.check  s    "  	($,'''r77a<<{{e9uT\':'::::||f:t|(<(<<<< 	AB~~''+++r'   z*?[c                H   |;|9t          j        t          j        | j                  }t          | j        |          S t          |t                    rW| j	        
                    |          s.|                     |          }t          |j                  r|gS g S t          |          }t          j        t          j        | j                  }g }|D ]9}|                     |          }| ||          r|                    |           :|                     ||           |S )zdList directory contents, possibly filter by the given fil func
        and possibly sorted.
        )r   r   r   r   r   r   r  rx   r=   _patterncharsintersectionr   ry   r2  rO  )r$   r|   r   namesr  rN  rQ   s          r%   r   zLocalPath.listdir#  s    ;4<&rz4<@@Et~u555c3 	!%22377 s++%-(( #!7N	C..C"2:t|<< 	" 	"DNN4((E{cc%jj{

5!!!sD!!!
r'   r   c                4    |                                  j        S )z)Return size of the underlying file object)rZ   r   r.   s    r%   r   zLocalPath.size:  s    yy{{r'   r   c                4    |                                  j        S )z*Return last modification time of the path.)rZ   r   r.   s    r%   r   zLocalPath.mtime>      yy{{  r'   c                   |                      d          rz|                     d          r|                    | j                  }| |k    sJ t          | |           |rt	          | j        |j                   |rt          | |           dS dS d }|                     |          D ]}|                    |           }|                    |          }|	                                
                    d           |                     d          r(|                    |                                           |                     d          rt          ||           n,|                     d          r|
                    d           |rt	          |j        |j                   |rt          ||           dS )zCopy path to target.

        If mode is True, will copy permission from path to target.
        If stat is True, copy permission, last modification
        time, last access time, and flags from path to target.
        r   r:  r   c                .    |                      d          S r   r   )r   s    r%   rz   zLocalPath.copy.<locals>.recT  s    wwAw&r'   r   r   N)r   r   r,   copychunkedcopymoder   copystatr   r9   r<  r,  r   r   )r$   r   r_   rZ   rz   rw   r(  newxs           r%   r  zLocalPath.copyB  s    ::1: 	&|||"" 4T]336>>>>f%%% 7v~666 'v&&&&&' '' ' ' ZZCZ(( & &''$--{{7++%%!%,,,777?? '$$QZZ\\222WW!W__ '4((((WWW^^ 'KKAK&&& 6QY555 &Q%%%& &r'   c                t    t          j        |          }t          j        t           j        | j        |          S )zRename this path to target.)r   r   r   r   r  r   r  s     r%   r  zLocalPath.renameg  s*    6""!")T\6BBBr'   c                    |                      d          }ddl}	 t          j        |j        |||           |                                 dS # |                                 w xY w)z Pickle object into path locationwbr   N)r  r  r   r   dumpr  )r$   r  binr  r  s        r%   r  zLocalPath.dumpl  s[    IIdOO	v{CC888GGIIIIIAGGIIIIs   A A#c                |     | j         | }t          j        t          j        t          j        |                     |S )z/Create & return the directory joined with args.)r   r   r   r   mkdirr   )r$   r-  r   s      r%   r  zLocalPath.mkdirv  s2    DIt28RYq\\222r'   c                    |r(|                                                      d           |                     d          5 }|                    |           ddd           dS # 1 swxY w Y   dS )zdWrite binary data into path.   If ensure is True create
        missing parent directories.
        r   r   r  Nr<  r,  r  write)r$   datar,  r  s       r%   write_binaryzLocalPath.write_binary|  s      	)LLNN!!a!(((YYt__ 	GGDMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s    A##A'*A'c                    |r(|                                                      d           |                     d|          5 }|                    |           ddd           dS # 1 swxY w Y   dS )z}Write text data into path using the specified encoding.
        If ensure is True create missing parent directories.
        r   r   wr  Nr  )r$   r  r  r,  r  s        r%   
write_textzLocalPath.write_text  s      	)LLNN!!a!(((YYsXY.. 	!GGDMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   A%%A),A)r  c                   |r(|                                                      d           d|v r%t          |t                    st	          d          n`t          |t
                    sKt          |t                    st          |          }n&|                    t          j                              }| 	                    |          }	 |
                    |           |                                 dS # |                                 w xY w)z]Write data into path.   If ensure is True create
        missing parent directories.
        r   r   bzcan only process bytesN)r<  r,  rx   bytesr   r=   decoder$  getdefaultencodingr  r  r  )r$   r  r_   r,  r  s        r%   r  zLocalPath.write  s      	)LLNN!!a!((($;;dE** ; !9:::; dC(( A!$.. At99DD;;s'='?'?@@DIIdOO	GGDMMMGGIIIIIAGGIIIIs   
C5 5Dc                B   |                                  }|| k    r| S |                    d          r|                                 |                     d          rB	 |                                  n,# t          j        $ r |                     d          r Y nw xY w| S )Nr   r   )r<  r   _ensuredirsr  r   EEXIST)r$   parents     r%   r  zLocalPath._ensuredirs  s    T>>K<<A< 	!   ::!: 	

<    ::!:$$  
 s   A3 3&BBc                4    | j         | }|                    dd          r|                                S |                                                                 |                    d          s'|                    d                                           |S )zEnsure that an args-joined path exists (by default as
        a file). if you specify a keyword argument 'dir=True'
        then the path is forced to be a directory path.
        r   r   r   r:  r  )r   rO   r  r<  r   r  r  )r$   r-  r  r   s       r%   r,  zLocalPath.ensure  s    
 DIt::eQ 	==??"IIKK##%%%777?? %t""$$$Hr'   .raisingLiteral[True]rV   c                    d S r!   rk   r$   r  s     r%   rZ   zLocalPath.stat  s    :=#r'   Literal[False]Stat | Nonec                    d S r!   rk   r  s     r%   rZ   zLocalPath.stat  s    <?Cr'   Tc                    |r2t          | t          j        t          j        | j                            S 	 t          | t          j        | j                            S # t          $ r  t          $ r Y dS w xY w)zReturn an os.stat() tuple.N)rV   r   r   r   rZ   r   KeyboardInterrupt	Exceptionr  s     r%   rZ   zLocalPath.stat  s     	Ie0$,GGHHH	bgdl33444  	 	 	 	 	 	44	s   &A A54A5c                f    t          | t          j        t          j        | j                            S )zReturn an os.lstat() tuple.)rV   r   r   r   r\   r   r.   s    r%   r\   zLocalPath.lstat  s#    D%,RXt|DDEEEr'   c                <   |%t          j        t          j        | j        |          S 	 t          j        t          j        | j        d|f          S # t           j        $ r< t          j        t          j        | j        |                                 |f          cY S w xY w)zSet modification time for the given path.  if 'mtime' is None
        (the default) then the file's mtime is set to current time.

        Note that the resolution for 'mtime' is platform dependent.
        Nr   )r   r   r   utimer   r  atime)r$   r   s     r%   setmtimezLocalPath.setmtime  s     =%bheDDD	U%bhr5kJJJ| 	U 	U 	U%bhtzz||U>STTTTT	Us   &A ABBc                    	 |                                  }n# t          j        $ r d}Y nw xY wt          j        t          j        | j                   |S )z9Change directory to self and return old current directoryN)r   r   rK   r   r   chdirr   r$   olds     r%   r  zLocalPath.chdir  sZ    	..""CC| 	 	 	CCC	28T\222
s    ++c              #     K   |                                  }	 |V  ||                                  dS dS # ||                                  w w xY w)z
        Return a context manager, which changes to the path's dir during the
        managed "with" context.
        On __enter__ it returns the old dir, which might be ``None``.
        N)r  r  s     r%   as_cwdzLocalPath.as_cwd  s\       jjll	III		 s		 s	   6 Ac                p    |                      t          j                            | j                            S )z3Return a new path which contains no symbolic links.)r   r   r#   realpathr   r.   s    r%   r  zLocalPath.realpath  s&    ~~bg..t|<<===r'   c                4    |                                  j        S )z$Return last access time of the path.)rZ   r  r.   s    r%   r  zLocalPath.atime  r  r'   c                    d| j         dS )Nzlocal()rQ  r.   s    r%   __repr__zLocalPath.__repr__  s    )))))r'   c                    | j         S )z)Return string representation of the Path.rQ  r.   s    r%   __str__zLocalPath.__str__  s
    |r'   c                0   t          |t                    st          d|d          |rF|                     |          D ]/}t	          j        t          j        t          |          |           0t	          j        t          j        | j	        |           dS )zChange permissions to the given mode. If mode is an
        integer it directly encodes the os-specific modes.
        if rec is True perform recursively.
        zmode z must be an integerr   N)
rx   r   rH   r   r   r   r   ri  r=   r   )r$   r_   rz   rw   s       r%   ri  zLocalPath.chmod	  s    
 $$$ 	A?D???@@@ 	;ZZCZ(( ; ;"28SVVT::::28T\488888r'   c                    d}|                      d          D ]W}|                                rA|                    d                                          s nt	          |j                  s n|}X|S )zReturn the Python package path by looking for the last
        directory upwards which still contains an __init__.py.
        Return None if a pkgpath cannot be determined.
        NT)r=  __init__.py)r@  r
   r   r   isimportabler,   )r$   pkgpathr  s      r%   	pypkgpathzLocalPath.pypkgpath  s}    
 jjj.. 	! 	!F||~~ !{{=1188:: E#FO44 E r'   c                
   |r~t          |          }|dk    r1|t          j        vr!t          j                            |           d S d S |t          j        d         k    r$t          j                            d|           d S d S d S )Nr2  r   )r=   r$  r#   r2  r  )r$   
ensuremoder#   rV  s       r%   _ensuresyspathzLocalPath._ensuresyspath$  s     	*D		AX%%CH$$HOOA&&&&& %$ ##HOOAq)))))	* 	* $#r'   c                   |                                  st          j        |           |dk    r|| j        }t          j                            |t          |                     }||j        t          d| d|           t          j        
                    |          }|j                            |           |S d}||                                 }||                                }|                     d                              |                              | j                  }|d         dk    r|                                 d	                    |          }n|                                 }| j        }|                     ||           t+          |           t,          j        |         }| j        d
k    r|S |j        }|J |dd         dv r|dd         }n"|                    d          r|dd         dz   }|                    t6          j        d
z             r| j        d
k    r
|dd         }	 |                     |          }	n# t          j        $ r d}	Y nw xY w|	s1t7          j        d          }
|
dk    r|                     |||           |S 	 t,          j        |         S # t>          $ r ddl }|!                    |          }t          |           |_        |t,          j        |<   	 tE          t          |           d          5 }tG          |$                                |j%                   ddd           n# 1 swxY w Y   n# tL          $ r t,          j        |=  w xY w|cY S w xY w)a  Return path as an imported python module.

        If modname is None, look for the containing package
        and construct an according module name.
        The module will be put/looked up in sys.modules.
        if ensuresyspath is True then the root dir for importing
        the file (taking __init__.py files into account) will
        be prepended to sys.path if it isn't there already.
        If ensuresyspath=="append" the root dir will be appended
        if it isn't already contained in sys.path.
        if ensuresyspath is False no modification of syspath happens.

        Special value of ensuresyspath=="importlib" is intended
        purely for using in pytest, it is capable only of importing
        separate .py files outside packages, e.g. for test suite
        without any __init__.py file. It effectively allows having
        same-named test modules in different places and offers
        mild opt-in via this option. Note that it works only in
        recent versions of python.
        	importlibNzCan't find module z at location r#  )r2   r   r&   r*   r  )z.pycz.pyoz	$py.classiz.pyiFPY_IGNORE_IMPORTMISMATCH1r   r  )'r   r   rK   r   r  utilspec_from_file_locationr=   loaderrs  module_from_specexec_moduler  r<  rF  r9   r  r   popr   r  rt  r$  modulesr,   __file__r>   r   rf  getenvr   r  types
ModuleTyper  execr  __dict__BaseException)r$   modnameensuresyspathr  ry  r  pkgrootr  modfileissamer}   r  r  s                r%   pyimportzLocalPath.pyimport.  s   * zz|| 	%,t$$$K''+>99'3t99MMD|t{2!"Uw"U"UT"U"UVVV.11$77CK##C(((J?nn&&G"!//++R((..w77==dhGG9
**IIKKK((5//,,..+w777w+g&C}--
lG&&&rss|///!#2#,!!+.. /!#2#,. 677 ,=M11%dsdmGw//<    K#=>>S==227GTJJJJ{7++   &&w//"4yy'*G$c$ii.. 5!QVVXXs|4445 5 5 5 5 5 5 5 5 5 5 5 5 5 5$   G, 


sa   ?I I)(I)"J4 4AM9;M(M MM	MM	MM9M11M98M9argv
popen_optsr   c                V   ddl m} ddl m} |                    dd           |                    dd            |t	          |           gd |D             z   fi |||d}|                                \  }}|                                }t          |t                    r&|	                    t          j                              }|dk    r[t          |t                    r&|	                    t          j                              }t          ||t	          |           ||          |S )	zReturn stdout text from executing a system child process,
        where the 'self' path points to executable.
        The process is directly invoked and not through a system shell.
        r   )PIPE)PopenstdoutNstderrc                ,    g | ]}t          |          S rk   )r=   r  s     r%   r   z%LocalPath.sysexec.<locals>.<listcomp>  s    4443s88444r'   )r  r  )
subprocessr
  r  r  r=   communicatewaitrx   r  r  r$  r  RuntimeError)	r$   r  r  r
  r  procr  r  rets	            r%   sysexeczLocalPath.sysexec  sX   
 	$#####$$$$$$x&&&x&&&uYYK44t4444
 

 	
 
 
 
 ))++iikkfe$$ 	=]]3#9#;#;<<F!88&%(( As'='?'?@@D		   r'   c                >   t          |          r)t          |          }|                    d          r|S nc|t          rtt          j        d                             d          }d|vrd|vr|                    d           	 t          j        d         fd	|D             }n5# t          $ r Y n)w xY wt          j        d
                             d          }g }t          r2|t          j        d                             t          j	                  z  }|                    d           |D ]n}|D ]i}t          |          
                    |d          |z   }	 |                    d          r|r ||          sN|c c S U# t          j        $ r Y fw xY wodS )aM  Return a path object found by looking at the systems
        underlying PATH specification. If the checker is not None
        it will be invoked to filter matching paths.  If a binary
        cannot be found, None is returned
        Note: This is probably not working on plain win32 systems
        but may work on cygwin.
        r   r:  NPath;r#  r*   
SYSTEMROOTc                <    g | ]}|                     d           S )z%SystemRoot%)r   )r   r#   
systemroots     r%   r   z%LocalPath.sysfind.<locals>.<listcomp>  s4     ! ! !IMDLLDD! ! !r'   PATH:PATHEXTTr  )r	   localr   r   r   environr  r2  r  pathsepr   r   EACCES)	clsrQ   checkerpathsr   tryaddrw   addextr  s	           @r%   sysfindzLocalPath.sysfind  s    ;; #	dAwwAw  } :Jv.44S99E3e+;+;S)))%'Z%=
! ! ! !QV! ! ! $    Jv.44S99EF B"*Y/55bjAAAMM" 
 
$ 	 	Fad55>A777?? %& -'.wqzz !-$,#$HHHHH	%
 !<   	 ts*   B' '
B43B4#F FFFc                    	 t           j        d         }nI# t          $ r< 	 t           j        d         t           j        d         z   }n# t          $ r Y Y d S w xY wY nw xY w | |          S )NHOME	HOMEDRIVEHOMEPATH)r   r   r  )r#  rw   s     r%   _gethomedirzLocalPath._gethomedir  s    	
6"AA 	 	 	J{+bj.DD   ttt 	
 s1vvs2    
A%AA
AAAAAc                L    ddl }t          |                                          S )zaReturn the system's temporary directory
        (where tempfiles are usually created in)
        r   N)tempfiler  
gettempdir)r#  r/  s     r%   get_temprootzLocalPath.get_temproot  s'    
 	X((**+++r'   c                    ddl }||                                 }t          j        |j        t          |                    } | |          S )zoReturn a Path object pointing to a fresh new temporary directory
        (which we created ourselves).
        r   Nr   )r/  r1  r   r   mkdtempr=   )r#  rootdirr/  r#   s       r%   r3  zLocalPath.mkdtemp  sO    
 	?&&((G!("2GEEEs4yyr'   session-rB     c                X   ||                                  }|                                fd}d }d }d}	 d}	|                                D ]}
 ||
          }|t          |	|          }	 	 |                    |t          |	dz             z             }|r ||          } ||           n5# t          j        t          j        t          j	        f$ r ||	k    r |	}Y w xY w	 d }|d	z   fd
} ||          }|rP|rM|                                D ]7}
 ||
          }|||	|z
  k    r	 |r ||
           nS# t          j        t          j        t          j	        f$ r*  ||
          }|sY ]t          ||z
            |k     rY uY nw xY w|                    t          t          j                              z             }	 |
                    |           |                    d           n# t           $ r  t"          $ r Y nw xY w ||
          r4	 |
                    d           # t           $ r  t"          $ r Y 3w xY w9	 t$          j        d         }n6# t(          $ r) 	 t$          j        d         }n# t(          $ r d}Y nw xY wY nw xY wt          |          }|d|                    d                   dz   |z   }	 t%          j        |           n# t.          $ r Y nw xY w	 t%          j        ||           n# t.          t2          t4          f$ r Y nw xY w|S )aP  Return unique directory with a number greater than the current
        maximum one.  The number is assumed to start directly after prefix.
        if keep is true directories with a number less than (maxnum-keep)
        will be removed. If .lock files are used (lock_timeout non-zero),
        algorithm is multi-process safe.
        Nc                    | j                                         }|                              r6	 t          |t	                    d                   S # t
          $ r Y dS w xY wdS )z9Parse the number out of a path (if it matches the prefix)N)r,   rT  r-   r   r'  r   )r#   	nbasenamenprefixs     r%   	parse_numz.LocalPath.make_numbered_dir.<locals>.parse_num	  sz    ++--I##G,, yW8999!   DD s   #A 
A#"A#c                   t          j                    }|                     d          }t          |d          r#|                    t          |                     nt          j        t           j        t          |          t           j	        t           j
        z  t           j        z  d          }t          j        |d          5 }|                    t          |                     ddd           n# 1 swxY w Y   |S )z/Exclusively create lockfile. Throws when failedz.lockr   i  r  N)r   getpidr   r{   r   r=   r   r   r  O_WRONLYO_CREATO_EXCLfdopenr  )r#   mypidlockfilefdr  s        r%   create_lockfilez4LocalPath.make_numbered_dir.<locals>.create_lockfile  s   IKKEyy))Hx// ($$SZZ0000'GS]]BK"*,Dry,PRW  Yr3'' (1GGCJJ'''( ( ( ( ( ( ( ( ( ( ( ( ( ( (Os   #C22C69C6c                d     t          j                     fd}t          j        |           dS )z*Ensure lockfile is removed at process exitc                     t          j                    k    rd S 	                                   d S # t          j        $ r Y d S w xY wr!   )r   r=  r  r   Error)rC  rB  s   r%   try_remove_lockfilezXLocalPath.make_numbered_dir.<locals>.atexit_remove_lockfile.<locals>.try_remove_lockfile$  sZ     9;;%''FOO%%%%%{   DDs   2 AAN)r   r=  atexitregister)rC  rI  rB  s   ` @r%   atexit_remove_lockfilez;LocalPath.make_numbered_dir.<locals>.atexit_remove_lockfile   sF    IKKE      O/00000r'   Tr   r   c                b    	 |                                  j        S # t          j        $ r Y dS w xY w)zRead file modification timeN)r\   r   r   rH  r"   s    r%   	get_mtimez.LocalPath.make_numbered_dir.<locals>.get_mtimeQ  s<    zz||));   s    ..zgarbage-c                <    | j         }|                              S )z5Check if path denotes directory scheduled for removal)r,   r-   )r#   bngarbage_prefixs     r%   
is_garbagez/LocalPath.make_numbered_dir.<locals>.is_garbageZ  s    B==000r'   r   USERUSERNAMEr>  -)r1  rT  r   maxr  r=   r   r  rK   rM   r  r   uuiduuid4r  r  r  r  r   r   r  r  unlinkOSErrorr   rG   r   )r#  prefixr4  keeplock_timeoutr;  rE  rL  lastmaxmaxnumr#   numudirrC  rN  rR  	udir_time	path_timegarbage_pathusernamesrcr3  rQ  r:  s                         @@r%   make_numbered_dirzLocalPath.make_numbered_dir  s]    ?&&((G,,..	 	 	 	 		 	 		1 	1 	1( 	F)) . .ioo? --F}}Vc&1*oo%=>> 5.t44H**8444L%,<    f$$  	 	 	  *,	1 	1 	1 	1 	1 IdOO	 #	I #	)) " "ioo?sv}'='=%' 2+OD111!L%,D % % %$-IdOO	( %$Hy9455DD %H ED% $+<<TZ\\ARAR0R#S#SLL111$+++2222,   $   :d## ****,   $   	%z&)HH 	% 	% 	%%:j1 % % %$%	% $ii#SYYs^^#$s*X5	IdOOOO 	 	 	D		JsD!!!!)<= 	 	 	D	 s   2A B3 3/C%$C%5E3F8FF+G99HHH77III( (
J3JJJJJJJK& &
K32K37L L'&L'rY  )r   )rX   r=   )r   )r
  )F)r   F)rm  rn  )r  r=   rX   r  )r-  r  r  rJ   rX   r   )r
  FN)NNr   r   )FF)r  F).)r  r  rX   rV   )r  r  rX   r  )T)r  rJ   rX   r  rf   r!   rs   )r  r  r  r   rX   r=   )r5  NrB   r6  )^rg   rh   ri   r   rs  r   r   r   r&   r$  r%  r   r   r   r   r   __truediv__r   r,   r   r   r2   r  r  r  r  r  r   r;   r9   r.  r6  r   r
   r   r@  r   rG  rm   r   rO  rR  rW  r\  r^  ra  rd  rf  r  r{  rF  r   r<  r   r  r  r   r   setr  r   r   r   r  r  r  r  r  r  r  r  r,  r   rZ   r\   r  r  r   r  r  r  r  r  ri  r  r  r  r  classmethodr(  r-  r1  r3  rg  rk   r'   r%   r   r   	  s        H H H H Hk H H H &C) ) ) )0 |w	> 	> 	> 	>	A 	A 	A 	A
	A 	A 	A	E 	E 	E 	E+ + + K. . X. - - X- 2 2 X2 ) ) X)  
  
   
       ( ( (&  &, , ,  4  ! ! !" " "    	 	 	= = = ${u5 A A A A(        # # #2 2 22 2 2	I 	I 	I8 8 8 8,   ,& & &P   :; ; ; 9>      << < < <   
$ $ $, , ,8 C''M   .       ! ! ! !#& #& #& #&JC C C
              *      ==== X=??? X?	 	 	 	 	F F F FU U U U     ^> > >! ! !* * *  
9 
9 
9 
9  * * *W W W Wr   B , , , [,\   [ , , [, 	 	 	 [	 CI_ _ _ [_ _ _r'   r   c                :    ddl }|                    | |           dS )z Copy permission from src to dst.r   N)rj  r  rf  r3  rj  s      r%   r  r    s%    MMM
OOCr'   c                n    ddl }|                    t          |           t          |                     dS )zZCopy permission,  last modification time,
    last access time, and flags from src to dst.r   N)rj  r  r=   rl  s      r%   r  r    s3     MMM
OOCHHc$ii(((((r'   c                z   d}|                      d          }	 |                     d          }	 	 |                    |          }|sn|                    |           .	 |                                 n# |                                 w xY w	 |                                 d S # |                                 w xY w)Nrn  r  r  )r  r  r  r  )rf  r3  rx  fsrcfdestrz  s         r%   r  r    s    I88D>>D		$	!ii	** C   	!  KKMMMMEKKMMMMM



s"   B$ /A4 B$ 4B

B$ $B:c                    | rS| d                                          s| d         dk    r/|                     dd          } |  p|                                 S d S d S )Nr   _r#  )isalphar   isalnum)rQ   s    r%   r  r    sa     *a"" *d1gnn||C$$x)4<<>>)* *nnr'   )8r   
__future__r   rJ  collections.abcr   
contextlibr   r;   importlib.utilr  r  r   os.pathr   r   r   r	   r
   r   r   r   r   rZ   r   r   r   r$  typingr   r   r   r   r   rW  rK  r#  r   r%  rF   r   r   r  rm   ro   ry   r   rV   r   r   r   r  r  r  r  r  rk   r'   r%   <module>r{     sj       " " " " " "  $ $ $ $ $ $ % % % % % %      				 				                                                                       



                                             ,'
!
Jggb'5&A&AT&IZ  Z  Z  Z  Z  Z  Z  Z z	 	 	 	 	) 	 	 	 ,  ,  ,  ,  ,  ,  ,  ,F. . . . . . . .4! ! !+3 +3 +3 +3 +3 +3 +3 +3\    Q Q Q Q Q Q Q Qh$  ) ) )  "* * * 	r'   