=OgddlmZddlmZddlmZGddZGddZdd ZGd d Z d Z dS))suppress) TextIOWrapper)abcc$eZdZdZdfdZdZdS)SpecLoaderAdapterz> Adapt a package spec to adapt the underlying loader. c|jSN)loaderspecs D/opt/alt/python311/lib64/python3.11/importlib/resources/_adapters.pyzSpecLoaderAdapter. s$+c4||_|||_dSr )r r )selfr adapters r__init__zSpecLoaderAdapter.__init__ s gdmm rc,t|j|Sr )getattrr rnames r __getattr__zSpecLoaderAdapter.__getattr__sty$'''rN)__name__ __module__ __qualname____doc__rrrrrrsI&>%=$$$$(((((rrceZdZdZdZdZdS)TraversableResourcesLoaderz9 Adapt a loader to provide TraversableResources. c||_dSr r rr s rrz#TraversableResourcesLoader.__init__  rcNt|jSr )CompatibilityFilesr _nativers rget_resource_readerz.TraversableResourcesLoader.get_resource_readers!$),,44666rN)rrrrrr'rrrr r s<77777rr rc|dkrt|g|Ri|S|dkr|Std|)Nr(rbz8Invalid mode value '{}', only 'r' and 'rb' are supported)r ValueErrorformat)filemodeargskwargss r _io_wrapperr1 sZ s{{T3D333F333  BII$OO  rceZdZdZGddejZGddejZGddejZdZ 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(). cLeZdZdZdZdZdZeZdZe 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!DLLLrcjstdStfdjDS)Nrc3XK|]$}tj|V%dSr )r% ChildPathr7).0pathrs r z6CompatibilityFiles.SpecPath.iterdir..=sI#,,T\4@@r)r7itercontentsrs`riterdirz#CompatibilityFiles.SpecPath.iterdir:s^< Bxx L1133 rcdSNFrrAs ris_filez#CompatibilityFiles.SpecPath.is_fileB5rc|jst|St|j|Sr )r7r% OrphanPathr;rothers rjoinpathz$CompatibilityFiles.SpecPath.joinpathGs8< <)44U;;;%// eDD Drc|jjSr )r6rrAs rrz CompatibilityFiles.SpecPath.nameLs :? "rr(cTt|jd|g|Ri|Sr )r1r7 open_resourcerr.r/r0s ropenz CompatibilityFiles.SpecPath.openPs3t|99$??WWWWPVWW WrNr( rrrrrrBrEis_dirrKpropertyrrPrrrSpecPathr40s   " " "       E E E  # #  # X X X X X XrrUcNeZdZdZdZdZdZdZdZe 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 )r7_name)rr8rs rrz%CompatibilityFiles.ChildPath.__init__Ys!DLDJJJrc tdSNrr?rAs rrBz$CompatibilityFiles.ChildPath.iterdir] 88Orc@|j|jSr )r7 is_resourcerrAs rrEz$CompatibilityFiles.ChildPath.is_file`s<++DI66 6rc,| Sr )rErAs rrSz#CompatibilityFiles.ChildPath.is_dircs||~~% %rcBt|j|Sr )r%rHrrIs rrKz%CompatibilityFiles.ChildPath.joinpathfs%00EBB Brc|jSr )rYrAs rrz!CompatibilityFiles.ChildPath.nameis : rr(c^t|j|j|g|Ri|Sr )r1r7rNrrOs rrPz!CompatibilityFiles.ChildPath.openmsE **4955t>BFL rNrQrRrrrr;rWSs         7 7 7 & & & C C C           rr;cLeZdZdZdZdZdZeZdZe 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. cXt|dkrtd||_dS)Nrz/Need at least one path part to construct a path)lenr+_path)r path_partss rrz&CompatibilityFiles.OrphanPath.__init__xs-:"" !RSSS#DJJJrc tdSr[r\rAs rrBz%CompatibilityFiles.OrphanPath.iterdir}r]rcdSrDrrAs rrEz%CompatibilityFiles.OrphanPath.is_filerFrc2tjg|j|RSr )r%rHrhrIs rrKz&CompatibilityFiles.OrphanPath.joinpaths %0D$*DeDDD Drc|jdS)N)rhrAs rrz"CompatibilityFiles.OrphanPath.names:b> !rr(c td)NzCan't open orphan path)FileNotFoundErrorrOs rrPz"CompatibilityFiles.OrphanPath.opens#$<== =rNrQrRrrrrHrers   $ $ $        E E E  " "  " > > > > > >rrHc||_dSr r r"s rrzCompatibilityFiles.__init__r#rctt5|jj|jjcdddS#1swxYwYdSr )rAttributeErrorr r r'rrAs rr7zCompatibilityFiles._readers n % % H H9#77 GG H H H H H H H H H H H H H H H H H Hs)A  AAc8|j}t|dr|n|S)zB Return the native reader if it supports files(). files)r7hasattr)rr8s rr&zCompatibilityFiles._natives$ 11;vvt;rc,t|j|Sr )rr7)rattrs rrzCompatibilityFiles.__getattr__st|T***rcLt|j|jSr )r%rUr r7rAs rruzCompatibilityFiles.filess!**49dlCCCrN)rrrrr TraversablerUr;rHrrTr7r&rrurrrr%r%*s  !X!X!X!X!X3?!X!X!XFCO>>>>>>S_>>>:HHXH<<<+++DDDDDrr%c6t|jtS)z` Construct a package spec with traversable compatibility on the spec/loader/reader. )r__spec__r )packages r wrap_specr~s W-/I J JJrNrQ) contextlibriorrrr r1r%r~rrrrs ( ( ( ( ( ( ( ( 7 7 7 7 7 7 7 7xDxDxDxDxDxDxDxDvKKKKKr