ef ddlZddlZddlZddlZddlZddlZddlZejdkrddlm Z ne Z dgZ dZ dZ e jZ dZGdd ejZGd d eZd ZGd dZdS)N)) OrderedDictPathcHtjt|ddS)a2 Given a path with elements separated by posixpath.sep, generate all parents of that path. >>> list(_parents('b/d')) ['b'] >>> list(_parents('/b/d/')) ['/b'] >>> list(_parents('b/d/f/')) ['b/d', 'b'] >>> list(_parents('b')) [] >>> list(_parents('')) [] N) itertoolsislice _ancestrypaths z/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pkg_resources/_vendor/zipp.py_parentsrs  IdOOQ 5 55c#K|tj}|r?|tjkr3|Vtj|\}}|r|tjk-dSdSdSdS)aR Given a path with elements separated by posixpath.sep, generate all elements of that path >>> list(_ancestry('b/d')) ['b/d', 'b'] >>> list(_ancestry('/b/d/')) ['/b/d', '/b'] >>> list(_ancestry('b/d/f/')) ['b/d/f', 'b/d', 'b'] >>> list(_ancestry('b')) ['b'] >>> list(_ancestry('')) [] N)rstrip posixpathsepsplit)r tails rr r %s ;;y} % %D +49=(( _T** d +49=((((++++((rcPtjt|j|S)zZ Return items in minuend not in subtrahend, retaining order with O(1) lookup. )r filterfalseset __contains__)minuend subtrahends r _differencer?s  Z!=w G GGrcZeZdZdZedZfdZdZdZe dZ xZ S) CompleteDirszk A ZipFile subclass that ensures that implied directories are always included in the namelist. ctjtt|}d|D}t t ||S)Nc34K|]}|tjzVdSN)rr).0ps r z-CompleteDirs._implied_dirs..Ps)661y}$666666r)r chain from_iterablemapr_deduper)namesparentsas_dirss r _implied_dirszCompleteDirs._implied_dirsMsL///He0D0DEE66g666{7E22333rctt|}|t||zSr")superrnamelistlistr-)selfr* __class__s rr0zCompleteDirs.namelistSs?lD))2244tD..u556666rcDt|Sr")rr0r2s r _name_setzCompleteDirs._name_setWs4==??###rcP|}|dz}||vo||v}|r|n|S)zx If the name represents a directory, return that name as a directory (with the trailing slash). /)r6)r2namer*dirname dir_matchs r resolve_dirzCompleteDirs.resolve_dirZs?   *%:'U*: #-ww-rct|tr|St|tjs|t |Sd|jvrt}||_|S)zl Given a source (filename or zipfile), return an appropriate CompleteDirs subclass. r) isinstancerzipfileZipFile_pathlib_compatmoder3)clssources rmakezCompleteDirs.makedsh fl + + M&'/22 03v..// / fk ! !C r) __name__ __module__ __qualname____doc__ staticmethodr-r0r6r< classmethodrF __classcell__r3s@rrrGs 44\4 77777$$$...[rrc,eZdZdZfdZfdZxZS) FastLookupzV ZipFile subclass to ensure implicit dirs exist and are resolved rapidly. ctjt5|jcdddS#1swxYwYt t ||_|jSr") contextlibsuppressAttributeError_FastLookup__namesr/rPr0r2r3s rr0zFastLookup.namelist~s   0 0  <                Z..7799 | /33ctjt5|jcdddS#1swxYwYt t ||_|jSr")rRrSrT_FastLookup__lookupr/rPr6rVs rr6zFastLookup._name_sets   0 0 ! != ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !j$//99;; }rW)rGrHrIrJr0r6rMrNs@rrPrPxs[  rrPcj |S#t$rt|cYSwxYw)zi For path-like objects, convert to a filename for compatibility on Python 3.6.1 and earlier. ) __fspath__rTstrr s rrBrBsD    4yys 22ceZdZdZdZddZddddZed Zed Z ed Z ed Z ed Z dZ dZdZdZdZdZdZdZdZdZdZeZedZdS)ru4 A pathlib-compatible interface for zip files. Consider a zip file with this structure:: . ├── a.txt └── b ├── c.txt └── d └── e.txt >>> data = io.BytesIO() >>> zf = zipfile.ZipFile(data, 'w') >>> zf.writestr('a.txt', 'content of a') >>> zf.writestr('b/c.txt', 'content of c') >>> zf.writestr('b/d/e.txt', 'content of e') >>> zf.filename = 'mem/abcde.zip' Path accepts the zipfile object itself or a filename >>> root = Path(zf) From there, several path operations are available. Directory iteration (including the zip file itself): >>> a, b = root.iterdir() >>> a Path('mem/abcde.zip', 'a.txt') >>> b Path('mem/abcde.zip', 'b/') name property: >>> b.name 'b' join with divide operator: >>> c = b / 'c.txt' >>> c Path('mem/abcde.zip', 'b/c.txt') >>> c.name 'c.txt' Read text: >>> c.read_text() 'content of c' existence: >>> c.exists() True >>> (b / 'missing.txt').exists() False Coercion to string: >>> import os >>> str(c).replace(os.sep, posixpath.sep) 'mem/abcde.zip/b/c.txt' At the root, ``name``, ``filename``, and ``parent`` resolve to the zipfile. Note these attributes are not valid and will raise a ``ValueError`` if the zipfile has no filename. >>> root.name 'abcde.zip' >>> str(root.filename).replace(os.sep, posixpath.sep) 'mem/abcde.zip' >>> str(root.parent) 'mem' z>{self.__class__.__name__}({self.root.filename!r}, {self.at!r})cRt||_||_dS)aX Construct a Path from a ZipFile or filename. Note: When the source is an existing ZipFile object, its type (__class__) will be mutated to a specialized type. If the caller wishes to retain the original type, the caller should either create a separate ZipFile object or pass a filename. N)rPrFrootat)r2r`ras r__init__z Path.__init__s"OOD)) rr>NpwdcJ|rt||d}|s|dkrt||j|j||}d|vr|s|rtd|Stj |g|Ri|S)z Open this entry as text or binary following the semantics of ``pathlib.Path.open()`` by passing arguments through to io.TextIOWrapper(). rr>rcbz*encoding args invalid for binary operation) is_dirIsADirectoryErrorexistsFileNotFoundErrorr`openra ValueErrorio TextIOWrapper)r2rCrdargskwargszip_modestreams rrkz Path.opens ;;== *#D)) )7{{}} *S#D)) )s;; $;; Ov O !MNNNM8888888rcVtj|jjp |jjSr")pathlibrrar9filenamer5s rr9z Path.name!|DG$$)?T]-??rcVtj|jjp |jjSr")rtrrasuffixrur5s rrxz Path.suffix s!|DG$$+Ct}/CCrcVtj|jjp |jjSr")rtrrasuffixesrur5s rrzz Path.suffixes s!|DG$$-G1GGrcVtj|jjp |jjSr")rtrrastemrur5s rr|z Path.stemrvrcntj|jj|jSr")rtrr`rujoinpathrar5s rruz Path.filenames'|DI.//88AAArc|jdg|Ri|5}|cdddS#1swxYwYdS)Nr>rkread)r2rorpstrms r read_textzPath.read_texts TYs ,T , , ,V , , 99;;                  s 377c|d5}|cdddS#1swxYwYdS)Nrbr)r2rs r read_byteszPath.read_bytess~ YYt__ 99;;                  s 7;;ctj|jd|jdkSNr8)rr:rar)r2r s r _is_childzPath._is_child!s4 !4!4559L9LLLrc8||j|Sr")r3r`)r2ras r_nextz Path._next$s~~di,,,rcF|j p|jdSr)raendswithr5s rrgz Path.is_dir's!7{3dg..s333rcT|o| Sr")rirgr5s ris_filez Path.is_file*s {{}}2T[[]]!22rcB|j|jvSr")rar`r6r5s rriz Path.exists-sw$)--////rc|stdt|j|j}t |j|S)NzCan't listdir a file)rgrlr(rr`r0filterr)r2subss riterdirz Path.iterdir0sR{{}} 5344 44:ty113344dnd+++rcJtj|jj|jSr")rjoinr`rurar5s r__str__z Path.__str__6s~di0$':::rc8|j|S)Nr5) _Path__reprformatr5s r__repr__z Path.__repr__9s{!!t!,,,rctj|jgtt|R}||j|Sr")rrrar(rBrr`r<)r2othernexts rr~z Path.joinpath<sG~dgDOU(C(CDDDzz$)//55666rc|js |jjStj|jd}|r|dz }||Sr)raruparentrr:rr)r2 parent_ats rrz Path.parentBsYw (=' '%dgnnS&9&9::    Izz)$$$r)r^)r>)rGrHrIrJrrbrkpropertyr9rxrzr|rurrrrrgrrirrrr~ __truediv__rrrrrsKKZNF    999999$@@X@DDXDHHXH@@X@BBXBMMM---444333000,,, ;;;---777K %%X%%%r)rmrr@r rRsysrt version_info collectionsrdict__all__rr fromkeysr)rrArrPrBrrrrrs]  f'''''''K (666&+++,  /HHH.....7?...b&s%s%s%s%s%s%s%s%s%s%r