§ v<ˆjŒ3ãóæ—ddlZddlZddlZddlmZddlmZddlmZddl m Z m Z m Z m Z mZddlmZddlmZdd lmZe ee efZe rddlZGd „d ¦«Zd eegeffd „ZdS)éN)ÚPath)Úcompile)Úmkdtemp)ÚUnionÚSequenceÚ TYPE_CHECKINGÚTupleÚCallable)Úcompare)Úwrapé)Úrmtreec óÖ—eZdZdZe¦«ZdZdZ d%ddddœdee e dfde e d e d e fd „Z ed „¦«Zd&d„Zd'd„Zed'd„¦«Z d(dede de de fd„Zd)dede fd„Z d*de e dede de de f d„Zd„Zdefd„Zd%dedeee fd e fd„Zd%dee e e fd e fd„ZeZd%ded e fd „Zd%ded dfd!„Zd%ded e d eee ffd"„Zd#„Z d$„Z!dS)+Ú TempDirectoryad A class representing a temporary directory on disk. :param ignore: A sequence of strings containing regular expression patterns that match filenames that should be ignored by the :class:`TempDirectory` listing and checking methods. :param create: If `True`, the temporary directory will be created as part of class instantiation. :param path: If passed, this should be a string containing an absolute path to use as the temporary directory. When passed, :class:`TempDirectory` will not create a new directory to use. :param encoding: A default encoding to use for :meth:`read` and :meth:`write` operations when the ``encoding`` parameter is not passed to those methods. FN©)ÚignoreÚcreateÚencodingÚpathz py.path.localrrrcó—g|_|D])}|j t|¦«¦«Œ*|rt|¦«nd|_||_t |¦«|_|s|€|€| ¦«dSdSdS©N) rÚappendrÚstrrrÚboolÚ dont_remover)ÚselfrrrrÚregexs úl/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib/python3.11/site-packages/testfixtures/tempdirectory.pyÚ__init__zTempDirectory.__init__3s�€ðˆŒ Øð /ð /ˆEØ ŒK× Ò �w u™~œ~Ñ .Ô .Ð .Ð .Ø!%Ð/•C˜‘I”I�I¨4ˆŒ Ø ˆŒ Ý ™:œ:ˆÔØ ð �d�l v ~Ø �KŠK‰MŒMˆMˆMˆMð#�l ~ ~ócóŠ—|jr;tjdd d„|jD¦«¦«z¦«dSdS)Nz6TempDirectory instances not cleaned up by shutdown: %sú c3ó$K—|] }|jV—Œ dSr)r)Ú.0Úis rú z'TempDirectory.atexit..Is$èè€Ð!@Ð!@¨Q !¤&Ð!@Ð!@Ð!@Ð!@Ð!@Ð!@r )Ú instancesÚwarningsÚwarnÚjoin)Úclss rÚatexitzTempDirectory.atexitDs_€à Œ=ð Ý ŒMðØŸ š Ð!@Ð!@°#´-Ð!@Ñ!@Ô!@Ñ@Ô@ñBñ ô ð ð ð ð ð r ÚreturncóÔ—|jr|St¦«|_|j |¦«|jjs%t j|j¦«d|j_|S)zt Create a temporary directory for this instance to use if one has not already been created. T)rrr'ÚaddÚ __class__Ú atexit_setupr,Úregister©rs rrzTempDirectory.createLsb€ð Œ9ð ØˆKÝ‘I”IˆŒ Ø Œ×Ò˜4Ñ Ô Ð ØŒ~Ô*ð /Ý ŒO˜DœKÑ (Ô (Ð (Ø*.ˆDŒNÔ '؈ r cóà—|jrAtj |j¦«r|jst |j¦«|`||jvr|j |¦«dSdS)z¦ Delete the temporary directory and anything in it. This :class:`TempDirectory` cannot be used again unless :meth:`create` is called. N)rÚosÚexistsrrr'Úremover3s rÚcleanupzTempDirectory.cleanupZsu€ð Œ9ð �œŸš¨¬ Ñ2Ô2ð ¸4Ô;Kð Ý �4”9Ñ Ô Ð Ø� Ø �4”>Ð !Ð !Ø ŒN× !Ò ! $Ñ 'Ô 'Ð 'Ð 'Ð 'ð "Ð !r có\—t|j¦«D]}| ¦«ŒdS)zn Delete all temporary directories associated with all :class:`TempDirectory` objects. N)Útupler'r8)r+r%s rÚ cleanup_allzTempDirectory.cleanup_allfs6€õ �s”}Ñ%Ô%ð ð ˆAØ �IŠI‰KŒKˆKˆKð ð r Ú recursiveÚ files_onlyÚ followlinkscóº—|r| |¦«n|j}g}|r»tj||¬¦«D]£\}}}d |t |¦«dzd… tj¦«¦«}|r|dz }|D]} |s| || zdz¦«Œ t|¦«D]} | || z¦«ŒŒ¤n,tj |¦«D]} | | ¦«Œg} t|¦«D]?}d} |j D]}|  |¦«rd} nŒ| rŒ*|  |¦«Œ@| S)N)r>ú/r FT) Ú_joinrr5Úwalkr*ÚlenÚsplitÚseprÚsortedÚlistdirrÚsearch)rrr<r=r>ÚresultÚdirpathÚdirnamesÚ filenamesÚdirnameÚnameÚnÚfilteredrrs rÚactualzTempDirectory.actualos¸€ð$(Ð6ˆt�zŠz˜$ÑÔШT¬YˆàˆØ ð !Ý02´Ø kð1ñ1ô1ð 0ð 0Ñ,�˜ 9ðŸ(š( 7­3¨t©9¬9°Q©;¨<¨<Ô#8×#>Ò#>½r¼vÑ#FÔ#FÑGÔG�Øð#ؘs‘N�Gà'ð;ð;�GØ%ð;ØŸ š  g¨g¡o°cÑ&9Ñ:Ô:Ð:øå" 9Ñ-Ô-ð0ð0�DØ—M’M '¨$¡,Ñ/Ô/Ð/Ð/ð0ð 0õ”Z Ñ%Ô%ð !ð !�Ø— ’ ˜aÑ Ô Ð Ð àˆÝ˜6‘N”Nð "ð "ˆD؈FØœð ð �Ø—<’< Ñ%Ô%ðØ!�FØ�Eððð ØØ �OŠO˜DÑ !Ô !Ð !Ð !؈r có|—| ||¦«}|std¦«|D]}t|¦«ŒdS)a• Print the contents of the specified directory. :param path: The path to list, which can be: * `None`, indicating the root of the temporary directory should be listed. * A tuple of strings, indicating that the elements of the tuple should be used as directory names to traverse from the root of the temporary directory to find the directory to be listed. * A forward-slash separated string, indicating the directory or subdirectory that should be traversed to from the temporary directory and listed. :param recursive: If `True`, the directory specified will have its subdirectories recursively listed too. zNo files or directories found.N)rQÚprint)rrr<rQrOs rrGzTempDirectory.listdir—sT€ð.—’˜T 9Ñ-Ô-ˆØð 4Ý Ð2Ñ 3Ô 3Ð 3Øð ð ˆAÝ �!‰HŒHˆHˆHð ð r TÚexpectedc óŽ—d}tt|¦«t| ||||¦«¦«d¬¦«dS)a³ Compare the expected contents with the actual contents of the temporary directory. An :class:`AssertionError` will be raised if they are not the same. :param expected: A sequence of strings containing the paths expected in the directory. These paths should be forward-slash separated and relative to the root of the temporary directory. :param path: The path to use as the root for the comparison, relative to the root of the temporary directory. This can either be: * A tuple of strings, making up the relative path. * A forward-slash separated string. If it is not provided, the root of the temporary directory will be used. :param files_only: If specified, directories will be excluded from the list of actual paths used in the comparison. :param recursive: If ``False``, only the direct contents of the directory specified by ``path`` will be included in the actual contents used for comparison. :param followlinks: If ``True``, symlinks and hard links will be followed when recursively building up the actual list of directory contents. TF)rTrQr<N)r rFr:rQ)rrTrr=r<r>Ú__tracebackhide__s rr zTempDirectory.compare´sa€ðR!Ðå� Ñ)Ô)ݘTŸ[š[ؘ) Z°ñôñôð ð  !ñ !ô !ð !ð !ð !r có¬—t|t¦«r| d¦«}tj |¦« tj¦«}| tj¦«r+| |j¦«r|Std¦«‚tj |j|¦«S)Nr@z8Attempt to read or write outside the temporary Directory) Ú isinstancerrDr5rEr*ÚrstripÚ startswithrÚ ValueError)rrNÚrelatives rrAzTempDirectory._joinåsª€å �d�CÑ Ô ð #Ø—:’:˜c‘?”?ˆDÝ”6—;’;˜tÑ$Ô$×+Ò+­B¬FÑ3Ô3ˆØ × Ò �rœvÑ &Ô &ð Ø×"Ò" 4¤9Ñ-Ô-ð Ø�ÝØJñôð õŒw�|Š|˜DœI xÑ0Ô0Ð0r rJcóX—| |¦«}tj|¦«|S)a¢ Make an empty directory at the specified path within the temporary directory. Any intermediate subdirectories that do not exist will also be created. :param dirpath: The directory to create, which can be: * A tuple of strings. * A forward-slash separated string. :returns: The absolute path of the created directory. )rAr5Úmakedirs)rrJÚthepaths rÚmakedirzTempDirectory.makediròs*€ð—*’*˜WÑ%Ô%ˆÝ Œ �GÑÔÐØˆr ÚfilepathÚdatacó—t|t¦«r| d¦«}t|¦«dkrP| |dd…¦«}t j |¦«st j|¦«| |¦«}|p|j }|�|  |¦«}t|d¦«5}|  |¦«ddd¦«n #1swxYwY|S)a‚ Write the supplied data to a file at the specified path within the temporary directory. Any subdirectories specified that do not exist will also be created. The file will always be written in binary mode. The data supplied must either be bytes or an encoding must be supplied to convert the string into bytes. :param filepath: The path to the file to create, which can be: * A tuple of strings. * A forward-slash separated string. :param data: :class:`bytes` containing the data to be written, or a :class:`str` if ``encoding`` has been supplied. :param encoding: The encoding to be used if data is not bytes. Should not be passed if data is already bytes. :returns: The absolute path of the file written. r@r NéÿÿÿÿÚwb) rXrrDrCrAr5rr6r^rÚencodeÚopenÚwrite)rrarbrrJr_Úfs rrhzTempDirectory.writes!€õ4 �h¥Ñ $Ô $ð +Ø—~’~ cÑ*Ô*ˆHÝ ˆx‰=Œ=˜1Ò Ð Ø—j’j ¨#¨2¨#¤Ñ/Ô/ˆGÝ”7—>’> 'Ñ*Ô*ð %Ý” ˜GÑ$Ô$Ð$Ø—*’*˜XÑ&Ô&ˆØÐ,˜tœ}ˆØ Ð Ø—;’;˜xÑ(Ô(ˆDÝ �'˜4Ñ Ô ð  AØ �GŠG�D‰MŒMˆMð ð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð àˆsÃC5Ã5C9Ã<C9có>—|€|jn| |¦«S)ao Return the full path on disk that corresponds to the path relative to the temporary directory that is passed in. :param path: The path to the file to create, which can be: * A tuple of strings. * A forward-slash separated string. :returns: A string containing the absolute path. )rrA©rrs rÚ as_stringzTempDirectory.as_string,s €ð!˜LˆtŒyˆy¨d¯jªj¸Ñ.>Ô.>Ð>r cóX—t|€|jn| |¦«¦«S)a9 Return the :class:`~pathlib.Path` that corresponds to the path relative to the temporary directory that is passed in. :param path: The path to the file to create, which can be: * A tuple of strings. * A forward-slash separated string. )rrrArks rÚas_pathzTempDirectory.as_pathAs(€õ  �D”I�I°4·:²:¸dÑ3CÔ3CÑDÔDÐDr có\—ddlm}||€|jn| |¦«¦«S)a9 Return the :class:`py.path.local` that corresponds to the path relative to the temporary directory that is passed in. :param path: The path to the file to create, which can be: * A tuple of strings. * A forward-slash separated string. r)Úlocal)Úpy.pathrprrA)rrrps rÚas_localzTempDirectory.as_localNs<€ð "Ð!Ð!Ð!Ð!Ð!؈u $ ,�T”Y�Y°D·J²J¸tÑ4DÔ4DÑEÔEÐEr cóä—t| |¦«d¦«5}| ¦«}ddd¦«n #1swxYwY|p|j}|�| |¦«S|S)a£ Reads the file at the specified path within the temporary directory. The file is always read in binary mode. Bytes will be returned unless an encoding is supplied, in which case a unicode string of the decoded data will be returned. :param filepath: The path to the file to read, which can be: * A tuple of strings. * A forward-slash separated string. :param encoding: The encoding used to decode the data in the file. :returns: The contents of the file as a :class:`str` or :class:`bytes`, if ``encoding`` is not specified. ÚrbN)rgrAÚreadrÚdecode)rrarrirbs rruzTempDirectory.read\s¨€õ,�$—*’*˜XÑ&Ô&¨Ñ -Ô -ð °Ø—6’6‘8”8ˆDð ð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð àÐ,˜tœ}ˆØ Ð Ø—;’;˜xÑ(Ô(Ð (؈ s¤AÁA Á A có—|Srrr3s rÚ __enter__zTempDirectory.__enter__ys€Øˆ r có.—| ¦«dSr)r8)rÚtypeÚvalueÚ tracebacks rÚ__exit__zTempDirectory.__exit__|s€Ø � Š ‰Œˆˆˆr r)r-r)r-N)NFFF)NF)NFTF)"Ú__name__Ú __module__Ú __qualname__Ú__doc__Úsetr'r1rrrrrrrÚ classmethodr,rr8r;Ú PathStringsrQrGr rAr`ÚbytesrhrlÚgetpathrnrrrurxr}rr rrrs%€€€€€ððð*�‘”€IØ€Lð €Dð7;ðð%'ØØ ð ððà˜˜T ?Ð2Ô3ðð˜S”Mð ð ð ð ð ðððð"ððñ„[ðð ð ð ð ð (ð (ð (ð (ððððñ„[ðð!%Ø#Ø$Ø %ð &ð&àð&ðð&ðð &ð ð &ð&ð&ð&ðPð˜Kð¸4ððððð@!%Ø$Ø"Ø %ð /!ð/!à˜s”mð/!ðð/!ðð /!ð ð /!ð ð /!ð/!ð/!ð/!ðb 1ð 1ð 1ð˜{ððððð$&ð&˜kð&°°u¸c°zÔ1Bð&Ècð&ð&ð&ð&ðP?ð?˜e C¨°#¬Ð$6Ô7ð?À3ð?ð?ð?ð?ð&€Gð Eð E˜Kð E°4ð Eð Eð Eð Eð Fð F˜[ð F°Oð Fð Fð Fð Fðð˜[ð°CðÀ5ÈÐPSÈÔCTððððð:ðððððððr rr-cóX—d|d<t|i|¤Ž}t|j|j¦«S)zÐ A decorator for making a :class:`TempDirectory` available for the duration of a test function. All arguments and parameters are passed through to the :class:`TempDirectory` constructor. Fr)rr rr8)ÚargsÚkwÚls rÚtempdirr‹€s3€ð€B€x�LÝ�tÐ"˜rÐ"Ð"€AÝ �”˜!œ)Ñ $Ô $Ð$r )r,r5r(ÚpathlibrÚrerÚtempfilerÚtypingrrrr r Útestfixtures.comparisonr Útestfixtures.utilsr rrr„rqÚpyrr‹rr rúr“s?ðØ € € € Ø € € € Ø€€€ØÐÐÐÐÐàÐÐÐÐÐØÐÐÐÐÐØBÐBÐBÐBÐBÐBÐBÐBÐBÐBÐBÐBÐBÐBà+Ð+Ð+Ð+Ð+Ð+Ø#Ð#Ð#Ð#Ð#Ð#àÐÐÐÐÐð�C˜˜sœ�OÔ$€ ððØ€N€N€NðfðfðfðfðfñfôfðfðR %˜H h Z°Ð%9Ô:ð %ð %ð %ð %ð %ð %r