
    y9>i                     :
   U d Z ddlZ eed          rej        dk     r ed          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 ddlmZmZ dd	lmZmZmZ g d
ZdZeedf         ed<   dZeedf         ed<   dZeedf         ed<   i ddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,dd-d.d/d0i d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdDdHdIdJdKdLdMdNdOdPdQdRdSdTddUdVddWdXdYdZd[d\Zeeef         ed]<   i dd^d_d`ddadbdbdcddddddddcd!dedededcdYdfdfdgdfdhd#ddiid%djdkdkdkdld8ddjid'dmdndndndod)dpdqdrdsdgdtd+dudududgdvddwdxdydydzd.d{d|dndcd0d}d~dddd2dddddd[ddddgdvdddddi d:dddnddd<ddidDddd`dBddgdddd@ddddddFddgddddVdddddodKddddd4ddddd6ddddd>ddidMddgdddOddddZddgdddQdd_d`dRdddddSdndndndddnidddddddddddd_d`ddidddddZeeeedz  eedf         f         f         ed<   ddniddniddniddniddniddniddniddniddniddniddniddnidddddZ eeeedz  eedf         f         f         ed<   dddddddddƜZ!eeef         ed<   ej"        dedededede#f
d̈́            Z$ddl%m&Z&m'Z' dede#fdЄZ(ddede)deeedz  f         fd҄Z*dededz  ddfdԄZ+	 	 	 	 ddedededz  dedz  dedz  de)defdքZ,	 ddededededz  de)de#fdׄZ-dee         dededee         fdلZ.ddڄZ/efdee         de0e         fd܄Z1dedee#ef         fdބZ2	 ddee         de)de#de)fdZ3dededeeef         fdZ4	 	 	 	 	 	 	 ddede)de#dedz  dedz  dedz  dedz  dedz  defdZ5	 	 	 	 	 	 ddedee         de)de#dedz  dedz  dedz  dedz  ddfdZ6	 	 	 	 	 	 ddedede)de#dedz  dedz  dedz  dedz  ddfdZ7d Z8dedededefdZ9	 ddedede)de#de)f
dZ:	 	 	 ddedede)de#dedz  de)fdZ;	 	 	 ddedede)de#dedz  ddfdZ<	 	 	 	 	 d dede)dedz  dedz  de#dedz  defdZ=	 	 	 	 ddede)dedz  de#dedz  ddfdZ>	 	 	 	 ddede)dedz  de#dedz  ddfdZ?	 	 	 	 ddede)dedz  de#dedz  ddfdZ@	 ddedede)de#de)f
dZA	 	 	 ddedede)de#dedz  de)fdZB	 	 	 ddedede)de#dedz  ddfdZCdS (  z)Main package providing archive functions.    Nversion_info)      r   finalr   z+This program requires Python 3.11 or later.)SequenceCallable   )AppVersion)fileutillogutil)
create_archivediff_archivesextract_archive
is_archivelist_archivelist_formatsrepack_archivesearch_archivesupported_formatstest_archive)listextracttestcreate.ArchiveCommands)(7zaceadfalzipapeararcarjbzip2bzip3cabchmcompresscpiodebdmsflacfreearcgzipisolrziplz4lzhlziplzmalzoprarrpmrzipsharshntarudfvhdwimxzzipzoozpaqzstdArchiveFormats)r&   r*   r0   r5   r6   rA   rE   ArchiveCompressionszapplication/gzipr0   zapplication/jarrB   zapplication/java-archivez'application/vnd.android.package-archivez!application/vnd.ms-cab-compressedr(   zapplication/x-7z-compressedr   zapplication/x-acer   zapplication/x-adfr    zapplication/x-alzipr!   zapplication/x-archiver#   zapplication/x-arcr$   zapplication/x-arjr%   zapplication/x-bzip2r&   zapplication/x-bzip3r'   zapplication/x-cabzapplication/x-chmr)   zapplication/x-compressr*   zapplication/x-cpior+   zapplication/x-debian-packager,   zapplication/x-dmsr-   zapplication/x-freearcr/   zapplication/x-iso9660-imager1   zapplication/x-lz4r3   zapplication/x-lzopr7   zapplication/x-lzmar6   zapplication/x-lzipr5   zapplication/x-lhar4   zapplication/x-lrzipr2   zapplication/x-lzhzapplication/x-ms-wimr@   zapplication/x-rpmr9   zapplication/x-rzipr:   zapplication/x-sharr;   zapplication/x-tarr=   r>   r?   rA   rC   r8   rD   rE   r"   r<   r.   )zapplication/x-iso13346-imagezapplication/x-vhdzapplication/x-xzzapplication/x-zip-compressedzapplication/x-zoozapplication/vnd.rarzapplication/zipzapplication/zpaqzapplication/zstdzaudio/x-apezaudio/x-shnz
audio/flacArchiveMimetypes)r   7za7zr7zz7zzs)unar)Nr   )unacerM   )rN   )r   r   r   )unadf)unalz)mac)py_echo)r   r   r   r   )r#   )r$   )nomarch)Nr   r   r   )r%   )r   rK   rL   )Nr   r   r   )r   rI   rK   rL   )pbzip2lbzip2r&   rM   py_bz2)rT   rU   r&   )rT   rU   r&   rV   )Nr   r   r   r   )r'   )r   r   r   r   )
cabextractr   rK   rL   rM   )lcab)rW   r   rK   rL   )r   r   r   r   )r   rK   rL   archmageextract_chmLib)r   rK   rL   rY   )r0   r   rI   rK   rL   rM   uncompress.real)r   rI   rK   rL   rR   )r0   r   rI   rK   rL   )r*   )r   r   r   r   )r+   bsdcpior   rK   rL   rM   )r+   r\   r   rK   rL   )r+   r\   )r.   )r   rI   rK   rL   pigzr0   )rM   py_gzip)zopflir^   )Nr   r   )r   rK   rL   rM   )r   rK   rL   isoinfo)genisoimage)r3   )lha)lhasarM   )plzipr5   clzippdlzip)r   rK   rL   r6   rA   rM   py_lzma)r   rK   rL   rR   )r   rK   rL   r6   rA   )r6   rA   rg   )r2   )r8   )unrarr   rK   rL   rM   )rh   r   rK   rL   )rpm2cpior   rK   rL   )r9   r   rI   rK   rL   )r9   r   rK   rL   )r   r   r   )dpkg-debr   rK   rL   )xdmsrM   )rk   )r7   )r:   )r   r   r   )r;   )unshar)r   r   )shorten)r=   starbsdtar
py_tarfile)r   )rA   r   rK   rL   )rM   rg   )rg   )r   rI   rK   rL   
py_zipfile)unziprM   jar)rr   rs   )rB   rr   )rB   )Nr   r   r   r   )rC   )rD   )rE   )py_zstd)Nr   r   )r@   rA   rB   rC   rD   rE   ArchivePrograms)rq   )rs   )r   r   r   )r&   r(   r%   r0   r1   r+   r9   r,   r6   r>   r?   rA   rB    NoPasswordSupportArchiveProgramsp7zipp7azipp7rzipp7zzp7zzs
uncompressdpkgchmlib)r   rI   rJ   rK   rL   r[   rj   extract_chmlibProgramModulescommandprogramexecompressionreturnc                     |dv rj|d| dg}t          j        |t          j        d          dk    rdS t          j        |          r&|dk    r| d	k    r|d
k    rt
          j        dk    rdS dS n|dv r|dv S dS )a"  Decide if the given program supports the compression natively.
    The result is memoized since this function can call the given program
    for testing if it supports certain options.

    @return: True iff the program supports the given compression format
      natively, else False.
    )r=   rn   ro   z--z--help)stderr	verbosityr   Fr=   r   rA   ntT)rp   )r0   r&   r6   rA   )r   run
subprocessDEVNULLfind_programosname)r   r   r   r   cmds        Q/var/www/html/auto_sub_bot/venv/lib/python3.11/site-packages/patoolib/__init__.pyprogram_supports_compressionr     s     +++ &&&18C
 2bAAAQFF5[)) 	 5  x''4''GtOO u4	 
O	#	#===5    )
guess_mimeEncoding2Mimefilenamec                 8    t          |           \  }}|t          v S )a(  Detect if the file is a known archive.

    Example: patoolib.is_archive("package.deb")

    :param filename: The filename to check. Can be relative to the current working directory or absolute.
    :type filename: str
    :return: True if given filename is an archive file.
    :rtype: bool
    )r   rH   )r   mime_compressions      r   r   r   '  s"     $H--D,###r   r   c                 `   t          |           \  }}|dk    rt          j        d|  d| d|            |s|st          j        d|  d          |t
          v rt
          |         }nt          j        d| d|  d          |d	k    rt          j        d
| d|             ||k    rd}||fS )z8Detect filename archive format and optional compression.   zarchive z
 has mime  and compression z!unknown archive format for file `'zunknown archive mime format z for file `r	   zdetected format z for archive N)r   r   log_infor   PatoolErrorrH   )r   r   r   r   formats        r   get_archive_formatr   5  s   "8,,D+A~~OxOO4OO+OO	
 	
 	
  PK PN8NNNOOO!$'G4GGHGGG
 
 	
 A~~GGGXGGHHH;r   r   c                     | t           vrt          j        d|  d          |!|t          vrt          j        d| d          dS dS )z*Make sure format and compression is known.zunknown archive format `r   Nzunknown archive compression `)rF   r   r   rG   )r   r   s     r   check_archive_formatr   L  sf    ^##C&CCCDDD;6I#I#IM{MMMNNN #I#Ir   passwordc           
         t           |          }g }||                    |           d|fD ]!}||v r|                    ||                    "|t          || |          }|st	          j        | d|  d          |D ]}|                    d          r%	 t          |           |c S # t          $ r Y nw xY w<t	          j	        |          }	|	rs|dv r7| dk    rt	          j
        |          sq| dk    rt	          j        |          sn|dk    rt	          j        |	          | k    rt          |||	||	          s|	c S |R|t          v rI|d
k    r%d| d|  d| d| d| 
}
t          j        |
           t#          t          |         |||          S d| d|  }
||
d| z  }
|
dd                    |          z   z  }
t	          j        |
          )z8Find suitable archive program for given format and mode.N archive format `z' is not supportedpy_)r   rK   rL   rI   r8   r*   r$   r   r   z(could not find an executable program to z format r   z, trying to run z
 only for )r   r   z; candidates are ,)ru   appendextend(_remove_command_without_password_supportr   r   
startswithget_patool_program_moduleImportErrorr   p7zip_supports_rarp7zip_supports_compressget_arc_formatcheck_program_compressionr   r   r   find_archive_programjoin)r   r   r   r   r   r   commandsprogramskeyr   msgs              r   r   r   T  s    v&HH   g + +(??OOHSM***;HfgVV X'VVFVVVWWW  e$$ 	)'222   (( 	666U??4+B7+K+K?Z''0LW0U0U'E!! &s++v55,#{i    JJJ	" ;-#?#? >> eW  e  ef  e  egr  e  e  EL  e  e  Xc  e  eCL#+&	
 
 
 	
 OW
N
Nf
N
NC0;000(!3!333C

3

s   B))
B65B6c                 x    |sdS t          | |||          rdS | dk    r| }nd}t          |||          }|rdS dS )zCheck if a program supports the given compression.

    @return:
      + True if compression is None or empty
      + True if given program supports the archive compression
      + False else
    Tr   r   r   F)r   r   )r   r   r   r   r   comp_command	comp_progs          r   r   r     si      t#GWc;GG t( $[,)TTTI t5r   r   c                 $   |t           vr| S t           |         }t                      }d|fD ]&}||v r ||         D ]}|                    |           'g }| D ]}||vr|                    |           |s| rt	          j        | d| d          |S )zaRemove programs if they don't support work with password for current
    format and command.
    Nr   z ' with password is not supported)rv   setaddr   r   r   )r   r   r   no_password_support_commandsno_password_support_programsr   r   programs_with_supports           r   r   r     s     555#CF#K #&55 g : :...7< : :,009999 2 2666!((111  
X 
QQQQQ
 
 	
 ! r   c                     t          dt                     t          d           t          t          j                               t                       t          D ]u} t          | d           t
          D ]Y}t          |          }||vrd|vrt          d|dd           -	 t          | |          }t          d|dd| d	
           | dk    rKd t          D             }|r7t          d	                    d
                    |                    d	
           n=| dk    r7t          j        |          rt          dd	
           nt          dd	
           t                       # t          j        $ rV |                    d|                    |                    }t          d|ddt          j        |           d           Y Ww xY wwdS )zfPrint information about available archive formats to stdout.

    :return: None
    :rtype:  None
    zArchive programs ofz;Archive programs are searched in the following directories:zfiles:Nz   z>8z: - (not supported):  )endr=   c                 :    g | ]}t          j        |          |S  )r   r   ).0xs     r   
<listcomp>z list_formats.<locals>.<listcomp>  s)    SSS!d>OPQ>R>RSASSSr   z(supported compressions: {})z, r   z(rar archives supported)z(rar archives not supported)z: - (no program found; install ))printr
   r   system_search_pathrF   r   ru   r   rG   r   r   r   r   getstrlist_with_or)r   r   r   r   encshandlerss         r   r   r     s)    

%%%	
GHHH	$
!
#
#$$$	GGG   fh& 	 	G&v.Hh&&4x+?+?;G;;;;<<<.vw??3G333'33====U??SS':SSSD :AA$))D//RR #    t^^.w77 G8cBBBBB<#FFFF#   #<<hll7.C.CDDf'fffTEYZbEcEcfff    +	 s   "CE''A!GG
operationsc                     t          t                    }t          D ]C}| D ]>}	 t          ||           # t          j        $ r |                    |           Y  nw xY wD|S )a-  Return a list of supported archive formats for an iterable of operations.

    :param operations: The operations to check for, defaults to ArchiveCommands.
    :type operations:  List|Tuple|Set|Dict[str]
    :return:           A list of supported archive formats.
    :rtype:            List[str]
    )r   rF   r   r   r   remove)r   	supportedr   r   s       r   r   r     s     ^$$I  	 	 " 	 	G$VW5555#     ((( s   4$AAoutdirc                    t          j        |           }t          |          dk    rt           j                            | |d                   }t           j                            t           j                            |           |d                   }t           j                            |          st           j                            |          rdS t          j	        ||           t          j
        |            d|d         fS dS )zMove a single file or directory inside outdir a level up.
    Never overwrite files.
    Return (True, outfile) if successful, (False, reason) if not.
    r	   r   )Fzlocal file existsT)Fzmultiple files in root)r   listdirlenpathr   dirnameexistsislinkshutilmovermdir)r   entriessrcdsts       r   move_outdir_orphanr     s    
 j  G
7||qgll671:..gll27??622GAJ??7>># 	0"'.."5"5 	0//C
gaj!!,,r   Tarchive_cmdlistinteractivec                 j    t          | t                    r| \  }}n| i }}t          j        |f||d|S )z1Run archive command.

    @return: exit code
    r   r   )
isinstancetupler   run_checked)r   r   r   cmdlist	runkwargss        r   run_archive_cmdlistr     sZ     /5)) 1,,b$+ AJ  r   archivec                     t          j        |            t          |           \  }}|r|d| dfS t          j        d|          }t	          j        | |           |d| d| dfS )zWCleanup outdir after extraction and return target file name and
    result string.
    `r    z' (r   )r   make_user_readabler   get_single_outfiler   rename)r   r   successr   outdir2s        r   cleanup_outdirr   .  s     ''''//NWc JJJJ )"g66GIfg***C*****r   c           	         |t          | |          \  }}t          ||           t          |d||||          }t          |d|          }|t	          j        d          }d}	nd}	t          j                            |          r:t          j        	                    |          sd	| d
}
t          j        |
          n2|dk    rt          j        d| d           t          j        |           	  || ||||||          }|rt          |||           |	rt!          ||           \  }}
n|d| d}
}|dk    rt          j        d|  d|
 d           ||	rt          j        	                    |          rh	 t          j        |           S # t$          $ rD}t'          j                    d         !d| d| }
t          j        |
           Y d}~S Y d}~S d}~ww xY wS S # |	rt          j        	                    |          rh	 t          j        |           w # t$          $ rD}t'          j                    d         !d| d| }
t          j        |
           Y d}~w Y d}~w d}~ww xY ww w xY w)z7Extract an archive.

    @return: output directory
    Nr   r   r   r   r   r   .)dirTFzoutput path `z' exists and is not a directoryr   z... creating output directory `z'.r   r   r   r   ... z extracted to zBextraction error, could not remove temporary extraction directory r   )r   r   r   get_archive_cmdlist_funcr   tmpdirr   r   r   isdirr   r   r   r   makedirsr   r   r   OSErrorsysexc_info	log_error)r   r   r   r   r   r   r   r   get_archive_cmdlistdo_cleanup_outdirr   r   targeterrs                 r   _extract_archiver  @  sd    ~0INNN---"  G 37IvNN~S))) !7>>&!! 	 7==(( ,MfMMM&s+++, A~~IvIIIJJJK!'%%
 
 
  	W  9+VVVV 	0(99KFCC -f---CF>>L===s===>>>  		'v!6!6 		''     ' ' '<>>!$0@06@ @:=@ @  M#&&&&&&&& 10000'		' 		' 		'v!6!6 		''     ' ' '<>>!$0@06@ @:=@ @  M#&&&&&&&& 10000'		' 		'sO   5A&G% =F
G 5GG %"I0HI0
I+'5I&
I0&I++I0	filenamesc           	          |t          | |          \  }}t          ||           t          |d||||          }t          |d|          } || ||||||          }	|	rt	          |	||           dS dS )zCreate an archive.Nr   r   r   r   r   )r   r   r   r  r   )
r   r  r   r   r   r   r   r   r	  r   s
             r   _create_archiver    s     ~0INNN---"  G 37HfMM!!  G  S 	GykRRRRRR	S Sr   c                 $   |t          | |          \  }}t          ||           |dvrt          j        d| d          t	          ||||||          }t          |||          } || |||||          }	|	rt          |	||           dS dS )	zTest and list archives.Nr   )r   r   zinvalid archive command `r   r   r   r   )r   r   r   r   r   r  r   )
r   r   r   r   r   r   r   r   r	  r   s
             r   _handle_archiver    s     ~0INNN---&&&E7EEEFFF"  G 37GVLL!!gy+  G  S 	GykRRRRRR	S Sr   c                     t          j        t          j                            |                                                     }dt                              ||          z   }t          j	        |t                    S )z(Get the patool module for given program.z
.programs.)r   stripextr   r   basenamelowerr   r   	importlibimport_module__name__)r   r   
modulenames      r   r   r     s[    

BG,,W55;;==
>
>C 2 23 < <<J":x888r   c                 2    	 t                     }n4# t          $ r'}d  dt           }t          j        |          |d}~ww xY w	 t          || d|           n2# t          $ r%}d| d| d| }t          j        |          |d}~ww xY w fd}|S )z8Get the Python function that executes the given program.zcannot import program module  in N_zcould not find c                      d|v r|d         |                     d           d|vr | i |S dt          j                  j        v r | i |S d }t	          j        |          )zIf password is None, or not set, run command as usual.
        If password is set, but can't be accepted raise appropriate
        message.
        r   Nz$There is no support for password in )popinspect	signature
parametersr   r   )argskwargsr   archive_cmdlist_funcr   s      r   +check_for_password_before_cmdlist_func_callzMget_archive_cmdlist_func.<locals>.check_for_password_before_cmdlist_func_call  s    
 F:$6$>JJz"""V##''8888*+?@@KKK''8888>W>>s###r   )r   r   r  r   r   getattrAttributeError)r   r   r   moduler  r   r&  r%  s   `      @r   r  r    s    -*733 - - -EgEE8EEs##,--&v'/D/DF/D/DEE - - ->>>&>>f>>s##,-$ $ $ $ $ $ 76s,    
A"A  A	A 
B) B		Barchive1archive2c                 H   t          j        | |          rdS t          j        d          }|sd}t          j        |          t          j                    }	 t          | |d          }t          j        |          }t          j                    }		 t          ||	d          }
t          j        |	          }t          |          dk    r`t          |          dk    rMt          j
                            ||d                   }t          j
                            |
|d                   }n|}|
}t          j        |d||gdd	          t          j        |	           t          j        |           S # t          j        |	           w xY w# t          j        |           w xY w)
z}Show differences between two archives.
    @return 0 if archives are the same, else 1
    @raises: PatoolError on errors
    r   diffzSThe diff(1) program is required for showing archive differences, please install it.r   )r   r   r	   z-urNr   r	   )r   ret_ok)r   is_same_filer   r   r   r  r  r   r   r   r   r   r   rmtree)r*  r+  r   r   r-  r   tmpdir1path1entries1tmpdir2path2entries2	diffpath1	diffpath2s                 r   _diff_archivesr:    s    Xx00 qV$$D $cs###oG! 'RHHH:g&&/##	%$XgLLLEz'**H8}}!!c(mmq&8&8GLL<<	GLL<<		!	!	#vy)4&   OG$$$     OG$$$$    s%   9F B7E2 	F 2FF F!patternc                 <   t          j        d          }|sd}t          j        |          t          j                    }	 t          ||d|          }t          j        |dd| dgdd	|
          t          j        |           S # t          j        |           w xY w)z'Search for given pattern in an archive.grepzRThe grep(1) program is required for searching archive contents, please install it.r   )r   r   r   z-rz-er   r.  r	   )r/  r   cwd)r   r   r   r   r  r  r   r1  )	r;  r   r   r   r   r=  r   r  r   s	            r   _search_archiver?  $  s     V$$D $bs###_F "xXXX4w,Vqd
 
 
 	s   /B Bc           
         t          | |          \  }}t          ||          \  }}||k    rE||k    r?|dk    r t          j        d|  d| d| d|            t          j        | ||           dS t          j                    }		 ||k    o|o|}
|
r|}nd}t          | ||	||          }t          j        	                    |          }t          t          j        |                    }t          j                    }t          j        |           	 |
r|}nd}t          ||||||	           t          j        |           n# t          j        |           w xY w	 t          j        |	           dS # t          j        |	           w xY w)
z+Repackage an archive to a different format.r   r   zcopy `z' -> `z' in same format r   N)r   r   r   r   )r   r   r   r   )r   r   r   r   link_or_copyr  r  r   r   abspathr   r   getcwdchdirr  r1  )r*  r+  r   r   r   format1compression1format2compression2r  same_formatr   r   r   filesolddirs                   r   _repack_archiverL  :  s    /x9MMMG\.x9MMMG\'ll::>>LlllllGll^jll   	hIFFFF_F# (J\Jl 	!FFF
 
 
 '//(++bj&&''
	 %#'!    HVBHVs%   BE6 E 1E6 EE6 6Fc                     t          j        |            |dk    rt          j        d|  d           t	          | |||||          S )a  Extract an archive file.

    Extracting never overwrites existing files or directories. The original archive file is kept after
    extraction, even if all files were successful extracted.

    Example: patoolib.extract_archive("archive.zip", outdir="/tmp")

    :param archive: The archive filename. Can be relative to the current working directory or absolute.
    :type archive: str
    :param verbosity: larger values print more information. 0 is the default, -1 or lower means no output,
         values >= 1 prints command output
    :type verbosity: int
    :param outdir: The directory where the archive should be extracted. A value of None (the default)
         uses the current working directory.
    :type outdir: str or None
    :param program: If None (the default), a list of suitable archive programs are checked if they
         exist in the system search path (defined by the PATH environment variable).
         If a program name is given, it is added to the list of programs that is searched for.
         The program should be a relative or absolute path name to an executable.
    :type program: str or None
    :param interactive: If True (the default), wait for user input if the extraction program asks for it.
         This should be set to True if you intend to type in a password interactively.
         If set to False, standard input will be set to an empty string to prevent simple hangs from
         programs requiring input.
    :type interactive: bool
    :param password: If an archive is encrypted, set the given password with command line options.
         Note that the password might be written to logs that keep track of your command line
         history. If an archive program does not support passwords this option is ignored by patool.
    :type password: str or None
    :raise patoolib.PatoolError: If an archive does not exist or is not a regular file, or on errors while
         extracting.
    :return: The directory where the archive has been extracted.
    :rtype: str
    r   zExtracting  ...)r   r   r   r   r   )r   check_existing_filenamer   r   r  )r   r   r   r   r   r   s         r   r   r   v  sd    T $W---A~~07000111   r   c                     t          j        |            |dk    rt          j        d|  d           t	          | d||||          S )aM  List given archive.

    Example: patoolib.list_archive("package.deb")

    :param archive: The archive filename. Can be relative to the current working directory or absolute.
    :type archive: str
    :param verbosity: larger values print more information. 0 is the default, -1 or lower means no output,
         values >= 1 prints command output
    :type verbosity: int
    :param program: If None (the default), a list of suitable archive programs are checked if they
         exist in the system search path (defined by the PATH environment variable).
         If a program name is given, it is added to the list of programs that is searched for.
         The program should be a relative or absolute path name to an executable.
    :type program: str or None
    :param interactive: If True (the default), wait for user input if the extraction program asks for it.
         This should be set to True if you intend to type in a password interactively.
         If set to False, standard input will be set to an empty string to prevent simple hangs from
         programs requiring input.
    :type interactive: bool
    :param password: If an archive is encrypted, set the given password with command line options.
         Note that the password might be written to logs that keep track of your command line
         history. If an archive program does not support passwords this option is ignored by patool.
    :type password: str or None
    :raise patoolib.PatoolError: If an archive does not exist or is not a regular file, or on errors while
         listing.
    :return: None
    :rtype: None
    r   zListing rN  r   r   r   r   r   r   rO  r   r   r  )r   r   r   r   r   s        r   r   r     sd    H $W---A~~----...   r   c                     t          j        |            |dk    rt          j        d|  d           t	          | d||||          }|dk    rt          j        d           |S )aZ  Test given archive.

    Example: patoolib.test_archive("dist.tar.gz", verbosity=1)

    :param archive: The archive filename. Can be relative to the current working directory or absolute.
    :type archive: str
    :param verbosity: larger values print more information. 0 is the default, -1 or lower means no output,
         values >= 1 prints command output
    :type verbosity: int
    :param program: If None (the default), a list of suitable archive programs are checked if they
         exist in the system search path (defined by the PATH environment variable).
         If a program name is given, it is added to the list of programs that is searched for.
         The program should be a relative or absolute path name to an executable.
    :type program: str or None
    :param interactive: If True (the default), wait for user input if the extraction program asks for it.
         This should be set to True if you intend to type in a password interactively.
         If set to False, standard input will be set to an empty string to prevent simple hangs from
         programs requiring input.
    :type interactive: bool
    :param password: If an archive is encrypted, set the given password with command line options.
         Note that the password might be written to logs that keep track of your command line
         history. If an archive program does not support passwords this option is ignored by patool.
    :type password: str or None
    :raise patoolib.PatoolError: If an archive does not exist or is not a regular file, or on errors while
         testing.
    :return: None
    :rtype: None
    r   zTesting rN  r   rQ  z... tested ok.rR  )r   r   r   r   r   ress         r   r   r     s    F $W---A~~----...
  C A~~%&&&Jr   c                     t          j        |            t          j        |           |dk    rt          j        d|  d           t          | |||||          }|dk    rt          j        d|  d           |S )a  Create given archive with given files.

    Example: patoolib.create_archive("/path/to/myfiles.zip", ("file1.txt", "dir/"))

    :param archive: The archive filename. Can be relative to the current working directory or absolute.
    :type archive: str
    :param filenames: A list of filenames to add to the archive. Can be relative to the current
          working directory or absolute.
    :type filenames: tuple of str
    :param verbosity: larger values print more information. 0 is the default, -1 or lower means no output,
         values >= 1 prints command output
    :type verbosity: int
    :param program: If None (the default), a list of suitable archive programs are checked if they
         exist in the system search path (defined by the PATH environment variable).
         If a program name is given, it is added to the list of programs that is searched for.
         The program should be a relative or absolute path name to an executable.
    :type program: str or None
    :param interactive: If True (the default), wait for user input if the extraction program asks for it.
         This should be set to True if you intend to type in a password interactively.
         If set to False, standard input will be set to an empty string to prevent simple hangs from
         programs requiring input.
    :type interactive: bool
    :param password: If an archive is encrypted, set the given password with command line options.
         Note that the password might be written to logs that keep track of your command line
         history. If an archive program does not support passwords this option is ignored by patool.
    :type password: str or None
    :raise patoolib.PatoolError: on errors while creating the archive
    :return: None
    :rtype: None
    r   z	Creating rN  rQ  r   z	 created.)r   check_new_filenamecheck_archive_filelistr   r   r  )r   r  r   r   r   r   rT  s          r   r   r     s    L (((#I...A~~....///
  C A~~.G...///Jr   c                     t          j        |            t          j        |           |dk    rt          j        d|  d| d           t	          | |||          }|dk    r|dk    rt          j        d           |S )a  Compare two archives and print their differences.

    Both archives will be extracted in temporary directories. Both directory contents will be compared
    recursively with the diff(1) tool.

    Example: patoolib.diff_archives("release1.0.tar.gz", "release2.0.zip")

    :param archive1: The first archive filename. Can be relative to the current working directory or absolute.
    :type archive1: str
    :param archive2: The second archive filename. Can be relative to the current working directory or absolute.
    :type archive2: str
    :param verbosity: larger values print more information. 0 is the default, -1 or lower means no output,
         values >= 1 prints command output
    :type verbosity: int
    :param interactive: If True (the default), wait for user input if the extraction program asks for it.
         This should be set to True if you intend to type in a password interactively.
         If set to False, standard input will be set to an empty string to prevent simple hangs from
         programs requiring input.
    :type interactive: bool
    :raise patoolib.PatoolError: on errors while comparing the archives.
    :return: None
    :rtype: None
    r   z
Comparing z with rN  r   z... no differences found.)r   rO  r   r   r:  )r*  r+  r   r   rT  s        r   r   r   H  s    4 $X...$X...A~~@(@@(@@@AAA
(i[  C axxINN0111Jr   c                    | st          j        d          t          j        |           |dk    rt	          j        d| d| d           t          | ||||          }|dk    r|dk    rt	          j        d| d	           |S )
a  Search pattern in archive members.

    The archive will be extracted in a temporary directory. The directory contents will then be searched
    with the grep(1) tool.

    Example: patoolib.search_archive("def urlopen", "python3.3.tar.gz")

    :param pattern: The pattern to search for. See the grep(1) manual page for pattern syntax.
    :type pattern: str
    :param archive: The archive filename. Can be relative to the current working directory or absolute.
    :type archive: str
    :param verbosity: larger values print more information. 0 is the default, -1 or lower means no output,
         values >= 1 prints command output
    :type verbosity: int
    :param interactive: If True (the default), wait for user input if the extraction program asks for it.
         This should be set to True if you intend to type in a password interactively.
         If set to False, standard input will be set to an empty string to prevent simple hangs from
         programs requiring input.
    :type interactive: bool
    :param password: If an archive is encrypted, set the given password with command line options.
         Note that the password might be written to logs that keep track of your command line
         history. If an archive program does not support passwords this option is ignored by patool.
    :type password: str or None
    :raise patoolib.PatoolError: on errors while extracting or searching the archive
    :return: exit code of the grep program
    :rtype: int
    zempty search patternr   z
Searching r  rN  r   r   r   r	   r   z
 not found)r   r   r   rO  r   r   r?  )r;  r   r   r   r   rT  s         r   r   r   n  s    D  75666$W---A~~>'>>>>>???
  C axxINN1G111222Jr   archive_newc                     t          j        |            t          j        |           |dk    rt          j        d|  d| d           t          | ||||          }|dk    rt          j        d           |S )a  Repack archive to different file and/or format.

    The archive will be extracted and recompressed to archive_new.

    Example: patoolib.repack_archive("linux-2.6.33.tar.gz", "linux-2.6.33.tar.bz2")

    :param archive: The archive filename. Can be relative to the current working directory or absolute.
    :type archive: str
    :param archive_new: The new archive filename. Can be relative to the current working directory or absolute.
    :type archive_new: str
    :param verbosity: larger values print more information. 0 is the default, -1 or lower means no output,
         values >= 1 prints command output
    :type verbosity: int
    :param interactive: If True (the default), wait for user input if the extraction program asks for it.
         This should be set to True if you intend to type in a password interactively.
         If set to False, standard input will be set to an empty string to prevent simple hangs from
         programs requiring input.
    :type interactive: bool
    :param password: If an archive is encrypted, set the given password with command line options.
         Note that the password might be written to logs that keep track of your command line
         history. If an archive program does not support passwords this option is ignored by patool.
    :type password: str or None
    :raise patoolib.PatoolError: on errors while extracting or creating the archive
    :return: None
    :rtype: None
    r   z
Repacking z to rN  rZ  z... repacking successful.)r   rO  rV  r   r   rL  )r   r[  r   r   r   rT  s         r   r   r     s    B $W---,,,A~~@'@@{@@@AAA
  C A~~0111Jr   )r   )NNNr   )r   N)r   T)r   TNNNNN)r   TNNNN)r   TN)r   NNTN)r	   NTN)r   NTN)D__doc__r  hasattrr   
SystemExit	functoolsr   r   r   r  r   collections.abcr   r   configurationr
   r   __version__r   r   r   r   __all__r   r   str__annotations__rF   rG   rH   dictru   rv   r   cacheboolr   r   r   r   r   intr   r   r   r   r   r   r   r   r   r   r   r  r  r  r   r  r:  r?  rL  r   r   r   r   r   r   r   r   r   r   <module>rk     s   0 / / 



 wsN## Ds'7:P'P'P
*B
C
CC      				          . . . . . . . . 7 6 6 6 6 6 6 6 ! ! ! ! ! ! ! ! ! !   $IsCx H H H)#c3h ) ) )Z( U38_   /$/$u/$ /$ .u	/$
 (/$ "4/$ /$ /$ 7/$ T/$ /$ /$ 7/$ 7/$ /$  !/$" j#/$ /$$ &%/$& #E'/$( )/$* Y+/$, "5-/$. //$0 &1/$2 &3/$4 &5/$6 7/$8 79/$: ;/$< E=/$> ?/$@ &A/$B &C/$D E/$ /$F %*$) ]/$ /$ /$ $sCx. / / /jjA1 jA
 
$ jA 
 jA  jA( 
	 )jA4 	g5jAB 
	 CjAN hOjAT 
(%%	 UjA` *B-9 ajAn 	 ojAz 
>33	 {jAF 
F1% GjAP R
 5 QjAh C88%	 ijAt 	 ujA@ :
 ( AjA jAP 
00

 #	 	QjAd 
D(ejAf 
$ gjAn 746	 ojAz I03+	 {jAF 	 GjAR 
9..	 SjA^ 
43, _jAh 
411 ijAr 
# sjA| i}jAB  CjAL  MjAT 
 UjA^ 
5 _jAf 
 gjAp 





 qjA jAT 	# *
   9+ 
 	 	  
 	i  KjA jA jAc4d
E#s(O ;<<= j j j^ 	 
 	 
 	 
 	 
 	 
 	 
 	 
 	 
 	 
 	 
 	 
 	 
 " kZR ZR  $sDtU38_1L,M'M"N Z Z Z~ #	" 	"S#X 	 	 	 '''%('7:'	' ' ' 'T , + + + + + + +$ $ $ $ $ $   U3d
?=S    .O O3: O$ O O O O "D  D D D  4ZD  Dj	D 
 tD  D  	D  D  D  D P UV %(7:TzNQ	   2!sm!%(!36!c]! ! ! !2& & & &R 3B  (3- d3i    ,-s -uT3Y'7 - - - -$ MQ c]/2EI   "+3 + +sCx + + + +( "H' H'H'H' H' $J	H'
 4ZH' $JH' tH' DjH' 	H' H' H' H'\ "$S $S$S}$S $S 	$S
 4Z$S $J$S t$S Dj$S 
$S $S $S $ST "!S !S!S!S !S 	!S
 4Z!S $J!S t!S Dj!S 
!S !S !S !SH9 9 97c 7C 7 7 7 7 7 7B KO"! "!"! "!-0"!CG"!"! "! "! "!P         	 
 Dj  	       2 6  6 6 6  6  	6 
 Dj6  
6  6  6  6 | 4 444 $J4 4Z	4
 4 Dj4 	4 4 4 4r . ... 4Z. 	.
 Dj. 
. . . .f 0 000 4Z0 	0
 Dj0 
0 0 0 0l 4 44 4 4Z	4
 4 Dj4 
4 4 4 4p KO# ## #-0#CG## # # #R 0 000 0 	0
 Dj0 	0 0 0 0l . ... . 	.
 Dj. 
. . . . . .r   