8fD*4ddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z mZmZejeZdaGddeZGdd eZGd d eZGd d eZGddeZGddeZedee jeiZ ddlZn#e $rddl!ZYnwxYweeej"<eeej#<eeej$<[n #e e%f$rYnwxYwdZ&iZ'dZ(ej)e*dZ+dZ,dS))unicode_literalsN)DistlibException)cached_propertyget_cache_baseCachec,eZdZdfd ZdZdZxZS) ResourceCacheNc|9tjtt d}t t ||dS)Nzresource-cache)ospathjoinrstrsuperr __init__)selfbase __class__s }/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/distlib/resources.pyrzResourceCache.__init__sP <7<< 0 0#6F2G2GHHD mT""++D11111cdS)z Is the cache stale for the given resource? :param resource: The :class:`Resource` being cached. :param path: The path of the resource in the cache. :return: True if the cache is stale. Trresourcer s ris_stalezResourceCache.is_stale"s trcZ|j|\}}||}ntj|j|||}tj|}tj|stj |tj |sd}n| ||}|rBt|d5}| |jdddn #1swxYwY|S)z Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache. NTwb)finderget_cache_infor r rr prefix_to_dirdirnameisdirmakedirsexistsropenwritebytes)rrprefixr resultr!stalefs rgetzResourceCache.get-s< 55h??  >FFW\\$)T-?-?-G-GNNFgoof--G7==)) % G$$$7>>&)) 6 h55 ,&$'',1GGHN+++,,,,,,,,,,,,,,, s9D  D$'D$N)__name__ __module__ __qualname__rrr, __classcell__rs@rr r s[222222   rr ceZdZdZdS) ResourceBasec"||_||_dSr-)rname)rrr6s rrzResourceBase.__init__Hs  rN)r.r/r0rrrrr4r4Gs#rr4c^eZdZdZdZdZedZedZedZ dS)Resourcez A class representing an in-package resource, such as a data file. This is not normally instantiated by user code, but rather by a :class:`ResourceFinder` which manages the resource. Fc6|j|S)z Get the resource as a stream. This is not a property to make it obvious that it returns a new stream each time. )r get_streamrs r as_streamzResource.as_streamUs{%%d+++rc`ttat|Sr-)cacher r,r;s r file_pathzResource.file_path^s" =!OOEyyrc6|j|Sr-)r get_bytesr;s rr'zResource.byteses{$$T***rc6|j|Sr-)rget_sizer;s rsizez Resource.sizeis{##D)))rN) r.r/r0__doc__ is_containerr<rr?r'rDrrrr8r8Ms L,,,_ ++_+**_***rr8c(eZdZdZedZdS)ResourceContainerTc6|j|Sr-)r get_resourcesr;s r resourceszResourceContainer.resourcesqs{((...rN)r.r/r0rFrrKrrrrHrHns2L//_///rrHceZdZdZejdrdZndZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZeejjZdZdS)ResourceFinderz4 Resource finder for file system resources. java).pyc.pyoz.class)rOrPc||_t|dd|_tjt|dd|_dS)N __loader____file__)modulegetattrloaderr r r!r)rrUs rrzResourceFinder.__init__sA flD99 GOOGFJ$C$CDD rc@tj|Sr-)r r realpathrr s r _adjust_pathzResourceFinder._adjust_pathsw%%%rct|trd}nd}||}|d|jt jj|}||S)N//r) isinstancer'splitinsertrr r rr[)r resource_nameseppartsr)s r _make_pathzResourceFinder._make_pathsm mU + + CCC##C(( Q """u%  (((rc@tj|Sr-)r r r$rZs r_findzResourceFinder._findsw~~d###rcd|jfSr-)r rrs rrzResourceFinder.get_cache_infosX]""rc||}||sd}n=||rt||}nt ||}||_|Sr-)rerg _is_directoryrHr8r )rrbr r)s rfindzResourceFinder.findsp}--zz$ FF!!$'' 7*4??!$ 66FK rc,t|jdSNrb)r%r ris rr:zResourceFinder.get_streamsHM4(((rct|jd5}|cdddS#1swxYwYdSrn)r%r read)rrr+s rrAzResourceFinder.get_bytess (- & & !6688                  s 7;;cJtj|jSr-)r r getsizeris rrCzResourceFinder.get_sizeswx}---rctfdtfdtj|jDS)NcF|dko|j S)N __pycache__)endswithskipped_extensions)r+rs rallowedz-ResourceFinder.get_resources..alloweds,&8JJt677,8 9rc*g|]}| |Srr).0r+rys r z0ResourceFinder.get_resources..s&GGG!GGAJJGAGGGr)setr listdirr )rrrys` @rrJzResourceFinder.get_resourcessN 9 9 9 9 9GGGGrz(-88GGGHHHrc6||jSr-)rkr ris rrFzResourceFinder.is_containers!!(-000rc#TK||}||g}|r|d}|V|jrc|j}|jD]T}|s|}nd||g}||}|jr||P|VU|dSdSdS)Nrr^)rlpoprFr6rKrappend)rrbrtodornamer6new_namechilds riteratorzResourceFinder.iterators99]++  :D (88A;;( ($ME ( 2 ( ($?'+HH'*xx '>'>H $ ( 3 3 -( KK...."'KKKK ( ( (  ( (rN)r.r/r0rEsysplatform startswithrxrr[rergrrlr:rArCrJrF staticmethodr r r"rkrrrrrMrMvs |v&&.7-EEE &&& ) ) )$$$###   )))...III 111!L//M(((((rrMcReZdZdZfdZdZdZdZdZdZ dZ d Z d Z xZ S) ZipResourceFinderz6 Resource finder for resources in .zip files. cLtt|||jj}dt |z|_t|jdr|jj|_ntj ||_t|j|_ dS)Nr_files) rrrrWarchivelen prefix_lenhasattrr zipimport_zip_directory_cachesortedindex)rrUrrs rrzZipResourceFinder.__init__s &&//777+%c'll* 4; ) ) B+,DKK#8ADKDK(( rc|Sr-rrZs rr[zZipResourceFinder._adjust_paths rc||jd}||jvrd}nu|r%|dtjkr|tjz}t j|j|} |j||}n#t$rd}YnwxYw|s't d||j j n&t d||j j |S)NTFz_find failed: %r %rz_find worked: %r %r) rrr rcbisectrr IndexErrorloggerdebugrWr()rr r)is rrgzZipResourceFinder._findsDO$$% 4;  FF %RBF**bf} dj$//A A11$77     J LL.dk6H I I I I LL.dk6H I I I s A?? B Bc`|jj}|jdt|zd}||fS)Nr)rWrr r)rrr(r s rrz ZipResourceFinder.get_cache_infos2$}QV_--.t|rc@|j|jSr-)rWget_datar ris rrAzZipResourceFinder.get_bytess{##HM222rcPtj||Sr-)ioBytesIOrAris rr:zZipResourceFinder.get_streamsz$..22333rcP|j|jd}|j|dS)N)r rrrs rrCzZipResourceFinder.get_sizes(}T_--.{4 ##rc2|j|jd}|r%|dtjkr|tjz }t |}t }t j|j|}|t |jkr|j||snk|j||d}| | tjdd|dz }|t |jk|S)Nrrr) r rr rcrr}rrraddr`)rrr plenr)rss rrJzZipResourceFinder.get_resourcess}T_--.  DH&& BFND4yy M$*d + +#dj//!!:a=++D11  1 dee$A JJqwwrvq))!, - - - FA #dj//!!  rc||jd}|r%|dtjkr|tjz }tj|j|} |j||}n#t $rd}YnwxYw|S)NrF)rr rcrrrr)rr rr)s rrkzZipResourceFinder._is_directorysDO$$%  DH&& BFND M$*d + + Z]--d33FF   FFF  s A33 BB)r.r/r0rErr[rgrrAr:rCrJrkr1r2s@rrrs ) ) ) ) )$ 333444$$$          rrc4|tt|<dSr-)_finder_registrytype)rW finder_makers rregister_finderr2s%1T&\\"""rc|tvrt|}n|tjvrt|tj|}t |dd}|t dt |dd}t t|}|t d|z||}|t|<|S)z Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package. __path__Nz8You cannot get a finder for a module, only for a packagerRzUnable to locate finder for %r) _finder_cachermodules __import__rVrrr,r)packager)rUr rWrs rrr9s -w' #+ % % w   W%vz400 <"$899 9t44'++DLL99  "#Cg#MNN Nf%%!' g Mr __dummy__c>d}tj|tj|}t t |}|r>t}tj |d|_ ||_ ||}|S)z Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path. NrT) pkgutil get_importerrpath_importer_cacher,rr _dummy_moduler r rrSrR)r r)rWrrUs rfinder_for_pathrUsF   $ ( ( . .F  ! !$v,, / /F  ',,tR00" Mr)- __future__rrrloggingr rrtypesrrTrutilrrr getLoggerr.rr>r objectr4r8rHrMrr zipimporterr_frozen_importlib_external_fi ImportError_frozen_importlibSourceFileLoader FileFinderSourcelessFileLoaderAttributeErrorrrr ModuleTyperrrrrrrs('''''   8888888888  8 $ $ )))))E)))X6 *****|***B///// ///W(W(W(W(W(VW(W(W(tKKKKKKKK^ DJJ ,  (00000 (((''''''(-;S)*'5S^$1?S-. ^$   D 222 2! [!1!122 s03B87C'8 CC'C"C''C10C1