WczddlmZddlmZddlmZGddZGddZdd ZGd d Z d Z dS))suppress) TextIOWrapper)abcc$eZdZdZdfdZdZdS)SpecLoaderAdapterz> Adapt a package spec to adapt the underlying loader. c|jSN)loaderspecs 6/usr/lib64/python3.12/importlib/resources/_adapters.pyzSpecLoaderAdapter. s $++c0||_|||_dSr )r r )selfr adapters r__init__zSpecLoaderAdapter.__init__ s gdm rc2t|j|Sr )getattrr rnames r __getattr__zSpecLoaderAdapter.__getattr__styy$''rN)__name__ __module__ __qualname____doc__rrrrrrsI&>%=$$$$(((((rrceZdZdZdZdZdS)TraversableResourcesLoaderz9 Adapt a loader to provide TraversableResources. c||_dSr r rr s rrz#TraversableResourcesLoader.__init__  rcNt|jjSr )CompatibilityFilesr _nativers rget_resource_readerz.TraversableResourcesLoader.get_resource_readers!$)),4466rN)rrrrrr'rrrr r s<77777rr rc`|dkrt|g|Ri|S|dkr|Std|d)Nr(rbzInvalid mode value 'z"', only 'r' and 'rb' are supported)r ValueError)filemodeargskwargss r _io_wrapperr0 sR s{{T3D333F333  GtGGG rceZdZdZGddej ZGddej ZGddej ZdZ e d Z d Z d Z d Zd S)r%zj Adapter for an existing or non-existent resource reader to provide a compatibility .files(). cHeZdZdZdZdZdZeZdZe dZ d dZ d S) CompatibilityFiles.SpecPathzk Path tied to a module spec. Can be read and exposes the resource reader children. c"||_||_dSr )_spec_reader)rr readers rrz$CompatibilityFiles.SpecPath.__init__6sDJ!DLLLrcjs tdStfdjjDS)Nrc3^K|]&}tjj|(dSr )r% ChildPathr6).0pathrs r z6CompatibilityFiles.SpecPath.iterdir..=s@#,,T\\4@@@@@r)r6itercontentsrs`riterdirz#CompatibilityFiles.SpecPath.iterdir:sP<<<Bx LL113 rcdSNFrr@s ris_filez#CompatibilityFiles.SpecPath.is_fileB5rc|jstj|Stj|j|Sr )r6r% OrphanPathr:rothers rjoinpathz$CompatibilityFiles.SpecPath.joinpathGs3<<<)44U;;%// eD Drc.|jjSr )r5rr@s rrz CompatibilityFiles.SpecPath.nameLs::?? "rr(cXt|jjd|g|Ri|Sr )r0r6 open_resourcerr-r.r/s ropenz CompatibilityFiles.SpecPath.openPs2t||99$?WWWWPVWW WrNr( rrrrrrArDis_dirrJpropertyrrOrrrSpecPathr30s   " " "       E E E  # #  # X X X X X XrrTcJeZdZdZdZdZdZdZdZe dZ d d Z d S) CompatibilityFiles.ChildPathzw Path tied to a resource reader child. Can be read but doesn't expose any meaningful children. c"||_||_dSr )r6_name)rr7rs rrz%CompatibilityFiles.ChildPath.__init__Ys!DLDJJJrctdSNrr>r@s rrAz$CompatibilityFiles.ChildPath.iterdir] 8OrcN|jj|jSr )r6 is_resourcerr@s rrDz$CompatibilityFiles.ChildPath.is_file`s<<++DII6 6rc&|j Sr )rDr@s rrRz#CompatibilityFiles.ChildPath.is_dircs||~% %rcFtj|j|Sr )r%rGrrHs rrJz%CompatibilityFiles.ChildPath.joinpathfs%00EB Brc|jSr )rXr@s rrz!CompatibilityFiles.ChildPath.nameis :: rr(clt|jj|j|g|Ri|Sr )r0r6rMrrNs rrOz!CompatibilityFiles.ChildPath.openmsF **4995t>BFL rNrPrQrrrr:rVSs         7 7 7 & & & C C C           rr:cHeZdZdZdZdZdZeZdZe dZ d dZ d S) CompatibilityFiles.OrphanPathz Orphan path, not tied to a module spec or resource reader. Can't be read and doesn't expose any meaningful children. cPt|dkr td||_dS)Nrz/Need at least one path part to construct a path)lenr+_path)r path_partss rrz&CompatibilityFiles.OrphanPath.__init__xs(:"" !RSS#DJJJrctdSrZr[r@s rrAz%CompatibilityFiles.OrphanPath.iterdir}r\rcdSrCrr@s rrDz%CompatibilityFiles.OrphanPath.is_filerErcFtjg|j|RSr )r%rGrgrHs rrJz&CompatibilityFiles.OrphanPath.joinpaths%%00D$**DeDDD Drc&|jdS)N)rgr@s rrz"CompatibilityFiles.OrphanPath.names::b> !rr(ctd)NzCan't open orphan path)FileNotFoundErrorrNs rrOz"CompatibilityFiles.OrphanPath.opens#$<= =rNrPrQrrrrGrdrs   $ $ $        E E E  " "  " > > > > > >rrGc||_dSr r r"s rrzCompatibilityFiles.__init__r#rctt5|jjj |jj cdddS#1swYdSxYwr )rAttributeErrorr r r'rr@s rr6zCompatibilityFiles._readers n % H H99##77 G H H H H H H H H H H H H H H H H Hs :AA"c>|j}t|dr|S|S)zB Return the native reader if it supports files(). files)r6hasattr)rr7s rr&zCompatibilityFiles._natives$ 11v;t;rc2t|j|Sr )rr6)rattrs rrzCompatibilityFiles.__getattr__st||T**rcZtj|j|jSr )r%rTr r6r@s rrtzCompatibilityFiles.filess!**499dllCCrN)rrrrr TraversablerTr:rGrrSr6r&rrtrrrr%r%*s !X!X!X!X!X3??!X!XFCOO>>>>>>S__>>:HHH<<<+++DDDDDrr%c<t|jtS)z` Construct a package spec with traversable compatibility on the spec/loader/reader. )r__spec__r )packages r wrap_specr}s W--/I JJrNrP) contextlibriorrrr r0r%r}rrrrs ( ( ( ( ( ( ( 7 7 7 7 7 7 7xDxDxDxDxDxDxDvKKKKKr