Your IP : 18.227.52.111


Current Path : /opt/alt/python312/lib64/python3.12/importlib/resources/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/importlib/resources/__pycache__/readers.cpython-312.pyc

�

�Q�f�����ddlZddlZddlZddlZddlZddlmZddlmZd�Z	Gd�dej�ZGd�d	ej�ZGd
�dej�ZGd�d
ej�Zy)�N�)�abc)�onlyc�R�ttjj|��S�N)�iter�collections�OrderedDict�fromkeys)�itemss �B/opt/alt/python312/lib64/python3.12/importlib/resources/readers.py�remove_duplicatesrs����'�'�0�0��7�8�8�c��eZdZd�Zd�Zd�Zy)�
FileReaderc�`�tj|j�j|_yr)�pathlib�Path�path�parent)�self�loaders  r
�__init__zFileReader.__init__s���L�L����-�4�4��	rc�J�t|jj|��S�z{
        Return the file system path to prevent
        `resources.path()` from creating a temporary
        copy.
        ��strr�joinpath�r�resources  r
�
resource_pathzFileReader.resource_path����4�9�9�%�%�h�/�0�0rc��|jSr�r�rs r
�fileszFileReader.files����y�y�rN��__name__�
__module__�__qualname__rr!r&�rr
rrs��5�1�rrc�0��eZdZd�Z�fd�Zd�Zd�Z�xZS)�	ZipReaderc��|jd�\}}}|jjdd�|zdz|_|j|_y)N�.�\�/)�
rpartition�prefix�replace�archive)rr�module�_�names     r
rzZipReader.__init__!sE���&�&�s�+�
��1�d��m�m�+�+�D�#�6��=��C����~�~��rc�v��	t�|�|�S#t$r}t|jd��d}~wwxYw�Nr)�super�
open_resource�KeyError�FileNotFoundError�args)rr �exc�	__class__s   �r
r=zZipReader.open_resource&s;���	1��7�(��2�2���	1�#�C�H�H�Q�K�0�0��	1�s��	8�3�8c��|j�j|�}|j�xr|j�S)zf
        Workaround for `zipfile.Path.is_file` returning true
        for non-existent paths.
        )r&r�is_file�exists)rr�targets   r
�is_resourcezZipReader.is_resource,s2��
����&�&�t�,���~�~��3�F�M�M�O�3rc�V�tj|j|j�Sr)�zipfilerr6r4r%s r
r&zZipReader.files4s���|�|�D�L�L�$�+�+�6�6r)r)r*r+rr=rGr&�
__classcell__�rBs@r
r.r. s���&�
1�4�7rr.c�r��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	�fd�Z
ed	��Zd
�Z
ed��Zd�Z�xZS)
�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.
    c���tttjt	|���|_|j
s
d}t
|��td�|j
D��std��y)Nz.MultiplexedPath must contain at least one pathc3�<K�|]}|j����y�wr)�is_dir��.0rs  r
�	<genexpr>z+MultiplexedPath.__init__.<locals>.<genexpr>Es����9�[�T�4�;�;�=�[�s�z)MultiplexedPath only supports directories)	�list�maprrr�_pathsr?�all�NotADirectoryError)r�paths�messages   r
rzMultiplexedPath.__init__@sY���3�w�|�|�->�u�-E�F�G����{�{�F�G�#�G�,�,��9�T�[�[�9�9�$�%P�Q�Q�:rc���d�|jD�}tjd�}tjt||��|��}t
|jd�|D��S)Nc3�JK�|]}|j�D]}|����y�wr)�iterdir)rRr�childs   r
rSz*MultiplexedPath.iterdir.<locals>.<genexpr>Is����N�k�d�t�|�|�~�e�E�~�E�k�s�!#r9)�keyc3�&K�|]	\}}|���y�wrr,)rRr9�locss   r
rSz*MultiplexedPath.iterdir.<locals>.<genexpr>Ls����!@��:�4��$��s�)rV�operator�
attrgetter�	itertools�groupby�sortedrU�_follow)r�children�by_name�groupss    r
r]zMultiplexedPath.iterdirHsP��N�d�k�k�N���%�%�f�-���"�"�6�(��#@�g�N���4�<�<�!@��!@�A�Arc��t|�d����Nz is not a file�r?r%s r
�
read_byteszMultiplexedPath.read_bytesN����4�&�� 7�8�8rc��t|�d���rlrm�rr@�kwargss   r
�	read_textzMultiplexedPath.read_textQrorc��y)NTr,r%s r
rPzMultiplexedPath.is_dirTs��rc��y)NFr,r%s r
rDzMultiplexedPath.is_fileWs��rc���	t�|�|�S#tj$r|jdj|�cYSwxYwr;)r<rr�TraversalErrorrV)r�descendantsrBs  �r
rzMultiplexedPath.joinpathZsJ���	9��7�#�[�1�1���!�!�	9�+�4�;�;�q�>�*�*�K�8�8�	9�s��/A�Ac��tj|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.
        �)rd�teer�
ValueErrorrX�next)�clsrh�subdirs�one_dir�one_files     r
rgzMultiplexedPath._followbsa��&/�]�]�8�Q�%?�"���(�	&���=� ���	&�
&��G�}�$��%�
&��H�~�%�
&��	&�s)�
'�	A�8�A�A�A�A�Ac��t|�d���rlrmrqs   r
�openzMultiplexedPath.openurorc�4�|jdjSr;)rVr9r%s r
r9zMultiplexedPath.namexs���{�{�1�~�"�"�"rc�R�djd�|jD��}d|�d�S)Nz, c3�(K�|]
}d|�d����y�w)�'Nr,rQs  r
rSz+MultiplexedPath.__repr__.<locals>.<genexpr>}s����>�+�$�A�d�V�1�+�+�s�zMultiplexedPath(�))�joinrV)rrYs  r
�__repr__zMultiplexedPath.__repr__|s)���	�	�>�$�+�+�>�>��!�%���*�*r)r)r*r+�__doc__rr]rnrsrPrDr�classmethodrgr��propertyr9r�rJrKs@r
rMrM8s_����R�B�9�9���9��&��&�$9��#��#�+rrMc��eZdZd�Zd�Zd�Zy)�NamespaceReaderc�`�dt|�vrtd��tt|��|_y)N�
NamespacePathzInvalid path)rr|rMrTr)r�namespace_paths  r
rzNamespaceReader.__init__�s+���#�n�"5�5��^�,�,�#�T�.�%9�:��	rc�J�t|jj|��Srrrs  r
r!zNamespaceReader.resource_path�r"rc��|jSrr$r%s r
r&zNamespaceReader.files�r'rNr(r,rr
r�r��s��;�
1�rr�)r	rdrrbrI�r�
_itertoolsrr�TraversableResourcesrr.�TraversablerMr�r,rr
�<module>r�sh���������9�
��)�)�
� 7��(�(�7�0F+�c�o�o�F+�R�c�.�.�r

?>