-a, d Z ddlZddlZddlZddlmZmZ ddlmZmZ G d dej Z
G d d e Z G d
de Z G d d
ee
Z
dS )z+
Interface adapters for low-level readers.
N)BinaryIOList )TraversableTraversableResourcesc e Zd ZdZej d Zej d Zej d Z ej d Z
ed ZdS )SimpleReaderzQ
The minimum, low-level interface required from a resource
provider.
c dS )zP
The name of the package for which this reader loads resources.
N selfs G/opt/alt/python-internal/lib64/python3.11/importlib/resources/simple.pypackagezSimpleReader.package c dS )zo
Obtain an iterable of SimpleReader for available
child containers (e.g. directories).
Nr r s r childrenzSimpleReader.children r r c dS )zL
Obtain available named resources for this virtual package.
Nr r s r resourceszSimpleReader.resources" r r c dS )z:
Obtain a File-like for a named resource.
Nr )r
resources r open_binaryzSimpleReader.open_binary) r r c B | j d d S )N.)r splitr s r namezSimpleReader.name0 s |!!#&&r**r N)
__name__
__module____qualname____doc__abcabstractpropertyr abstractmethodr r r propertyr r r r r r
s
+ + X+ + +r r c 2 e Zd ZdZd Zd Zd Zd dZd ZdS )
ResourceHandlez9
Handle to a named resource in a ResourceReader.
c " || _ || _ d S N)parentr )r
r* r s r __init__zResourceHandle.__init__: s r c dS NTr r s r is_filezResourceHandle.is_file? tr c dS NFr r s r is_dirzResourceHandle.is_dirB ur rc | j j | j }d|vrt j |g|R i |}|S )Nb)r* readerr r io
TextIOWrapper)r
modeargskwargsstreams r openzResourceHandle.openE sJ #// ::d??%f>t>>>v>>F
r c t d )NzCannot traverse into a resource)RuntimeError)r
r s r joinpathzResourceHandle.joinpathK s <===r N)r4 ) r r r r! r+ r. r2 r> rA r r r r' r' 5 sn
> > > > >r r' c L e Zd ZdZd Zd Zd Zd Zd Ze d Z
d Zd S )
ResourceContainerzI
Traversable container for a package's resources via its reader.
c || _ d S r) )r7 )r
r7 s r r+ zResourceContainer.__init__T s
r c dS r- r r s r r2 zResourceContainer.is_dirX r/ r c dS r1 r r s r r. zResourceContainer.is_file[ r3 r c fd j j D }t t j }t j || S )Nc 3 8 K | ]}t | V d S r) )r' ).0r r
s r