wAh͒ddlZddlZddlZddlZddlZddlmZddlmZdZ GddejZ Gdd ejZ Gd d ejZGd d ejZy)N)abc)onlycRttjj|SN)iter collections OrderedDictfromkeys)itemss B/opt/alt/python312/lib64/python3.12/importlib/resources/readers.pyremove_duplicatesr s  ''007 88ceZdZdZdZdZy) FileReaderc`tj|jj|_yr)pathlibPathpathparent)selfloaders r __init__zFileReader.__init__sLL-44 rcJt|jj|Sz{ Return the file system path to prevent `resources.path()` from creating a temporary copy. strrjoinpathrresources r resource_pathzFileReader.resource_path 499%%h/00rc|jSrrrs r fileszFileReader.files yyrN__name__ __module__ __qualname__rr!r&rr rrs51rrc0eZdZdZfdZdZdZxZS) ZipReaderc|jjdd|_|j|r-|jd\}}}|xj|dzz c_|j|_y)N\/.)prefixreplace is_package rpartitionarchive)rrmodule_names r rzZipReader.__init__!s[mm++D#6   V $**3/JAq$ KK4#: %K~~ rcv t||S#t$r}t|jdd}~wwxYwNr)super open_resourceKeyErrorFileNotFoundErrorargs)rr exc __class__s r r>zZipReader.open_resource(s; 17(2 2 1#CHHQK0 0 1s 838c|jj|}|jxr|jS)zf Workaround for `zipfile.Path.is_file` returning true for non-existent paths. )r&ris_fileexists)rrtargets r is_resourcezZipReader.is_resource.s2 &&t,~~3FMMO3rcVtj|j|jSr)zipfilerr7r3r%s r r&zZipReader.files6s||DLL$++66r)r)r*r+rr>rHr& __classcell__rCs@r r.r. s&1 47rr.creZdZdZdZdZdZdZdZdZ fdZ e d Z d Z ed Zd ZxZS) MultiplexedPathz Given a series of Traversable objects, implement a merged version of the interface across all objects. Useful for namespace packages which may be multihomed at a single name. ctttjt ||_|j s d}t |td|j Ds tdy)Nz.MultiplexedPath must contain at least one pathc3<K|]}|jywr)is_dir.0rs r z+MultiplexedPath.__init__..Gs9[T4;;=[sz)MultiplexedPath only supports directories) listmaprrr_pathsr@allNotADirectoryError)rpathsmessages r rzMultiplexedPath.__init__BsY3w||->u-EFG {{FG#G, ,9T[[99$%PQ Q:rcd|jD}tjd}tjt |||}t |jd|DS)Nc3JK|]}|jD]}|ywr)iterdir)rSrchilds r rTz*MultiplexedPath.iterdir..KsNkdt||~eE~Eks!#r:)keyc3&K|] \}}| ywrr,)rSr:locss r rTz*MultiplexedPath.iterdir..Ns!@:4$s)rWoperator attrgetter itertoolsgroupbysortedrV_follow)rchildrenby_namegroupss r r^zMultiplexedPath.iterdirJsPNdkkN%%f-""6(#@gN4<**K8 8 9s /AActj|d\}}} t|S#t$r% ||cYS#t$rt |cYcYSwxYwwxYw)z Construct a MultiplexedPath if needed. If children contains a sole element, return it. Otherwise, return a MultiplexedPath of the items. Unless one of the items is not a Directory, then return the first. )reteer ValueErrorrYnext)clsrisubdirsone_dirone_files r rhzMultiplexedPath._followdsa&/]]8Q%?"( &=  & &G}$% &H~% & &s) ' A8AA AAAct|drmrnrrs r openzMultiplexedPath.openwrprc4|jdjSr<)rWr:r%s r r:zMultiplexedPath.namezs{{1~"""rcRdjd|jD}d|dS)Nz, c3(K|] }d|d yw)'Nr,rRs r rTz+MultiplexedPath.__repr__..s>+$AdV1++szMultiplexedPath())joinrW)rrZs r __repr__zMultiplexedPath.__repr__~s) >$++>>!%**r)r)r*r+__doc__rr^rortrQrEr classmethodrhrpropertyr:rrKrLs@r rNrN:s_RB 999&&$9##+rrNceZdZdZdZdZy)NamespaceReaderc`dt|vr tdtt||_y)N NamespacePathz Invalid path)rr}rNrUr)rnamespace_paths r rzNamespaceReader.__init__s+ #n"5 5^, ,#T.%9: rcJt|jj|Srrrs r r!zNamespaceReader.resource_pathr"rc|jSrr$r%s r r&zNamespaceReader.filesr'rNr(r,rr rrs; 1rr)r rerrcrJr _itertoolsrrTraversableResourcesrr. TraversablerNrr,rr rsh9 ))  7((74F+cooF+Rc..r