Hacked By AnonymousFox

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

�

�Q�fS��2�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZmZm
Z
ddlmZmZddlmZeej&efZeZd�Zeddeedefd	��Zd
ej&deefd�Zej4deedej&fd
��Zej8dedej&fd��Zej8dddej&fd��Zd�Zd
ej&fd�Zej@	dejBd�d��Z"d�Z#dede$fd�Z%ej4d��Z&e&j9ejN�ej@d���Zej@dejPfd��Z)ej@d��Z*d�Z+y)�N)�Union�Optional�cast�)�ResourceReader�Traversable)�	wrap_specc�`���t��tj����f��fd�	�}|S)a
    Replace 'package' parameter as 'anchor' and warn about the change.

    Other errors should fall through.

    >>> files('a', 'b')
    Traceback (most recent call last):
    TypeError: files() takes from 0 to 1 positional arguments but 2 were given
    c���|�ur1|�ur	�||�Stjdtd���|�S|�ur��S�|�S)Nz/First parameter to files is renamed to 'anchor'�)�
stacklevel)�warnings�warn�DeprecationWarning)�anchor�package�func�	undefineds  ���B/opt/alt/python312/lib64/python3.12/importlib/resources/_common.py�wrapperz"package_to_anchor.<locals>.wrapper!sZ����)�#��Y�&��F�G�,�,��M�M�A�"��
�
��=� �
�y�
 ��6�M��F�|��)�object�	functools�wraps)rrrs` @r�package_to_anchorrs3�����I��_�_�T�� �)�����Nrr�returnc�*�tt|��S)z3
    Get a Traversable resource for an anchor.
    )�from_package�resolve)rs r�filesr 3s��
����(�(rrc�r�|j}t|jdd�}|�y||j�S)z?
    Return the package's loader if it's a ResourceReader.
    �get_resource_readerN)�__spec__�getattr�loader�name�r�spec�readers   rr"r";s9�����D�
�T�[�[�"7��
>�F�
�~���$�)�)��r�candc�6�ttj|�S�N)r�types�
ModuleType�r*s rrrKs���� � �$�'�'rc�,�tj|�Sr,)�	importlib�
import_moduler/s r�_r3Ps���"�"�4�(�(rc�B�tt�jd�S)N�__name__)r�
_infer_caller�	f_globalsr/s rr3r3Us���=�?�,�,�Z�8�9�9rc��d�}d�}tj|tj��}tj||�}t	|�j
S)zS
    Walk the stack and find the frame of the first caller not in this module.
    c�(�|jtk(Sr,)�filename�__file__��
frame_infos r�is_this_filez#_infer_caller.<locals>.is_this_file_s���"�"�h�.�.rc� �|jdk(S)Nr)�functionr<s r�
is_wrapperz!_infer_caller.<locals>.is_wrapperbs���"�"�i�/�/r)�	itertools�filterfalse�inspect�stack�next�frame)r>rA�
not_this_file�callerss    rr6r6ZsH��
/�0��)�)�,��
�
��H�M��#�#�J�
�>�G���=���rc��t|�}|jj|j�}|j	�S)z=
    Return a Traversable object for the given package.

    )r	r%r"r&r r's   rrrks2��
�W��D�
�[�[�
,�
,�T�Y�Y�
7�F��<�<�>�r)�
_os_removec#�pK�tj|��\}}		tj||��tj|�~tj|���	||�y#tj|�wxYw#t$rYywxYw#	||�w#t$rYwwxYwxYw�w�N)�suffix)�tempfile�mkstemp�os�write�close�pathlib�Path�FileNotFoundError)r)rNrK�fd�raw_paths     r�	_tempfilerYus������#�#�6�2�L�B���	��H�H�R���"��H�H�R�L���l�l�8�$�$�	��x� ��
�H�H�R�L��!�	��	��	��x� �� �	��	�so�B6�A0�-B�'B
�/B6�0B�B�
	B�B6�B�B6�B3�B$�#B3�$	B0�-B3�/B0�0B3�3B6c�D�t|j|j��SrM)rY�
read_bytesr&��paths r�
_temp_filer^�s���T�_�_�T�Y�Y�7�7rr]c��tjt�5|j�cddd�S#1swYyxYw)a
    Some Traversables implement ``is_dir()`` to raise an
    exception (i.e. ``FileNotFoundError``) when the
    directory doesn't exist. This function wraps that call
    to always return a boolean and only return True
    if there's a dir and it exists.
    NF)�
contextlib�suppressrV�is_dirr\s r�_is_present_dirrc�s-��
�	�	�.�	/��{�{�}���	/��s�4�=c�D�t|�rt|�St|�S)zu
    Given a Traversable object, return that object as a
    path on the local file system in a context manager.
    )rc�	_temp_dirr^r\s r�as_filerf�s��.�d�3�9�T�?�I��D�9I�Irc#�K�|��y�w)z7
    Degenerate behavior for pathlib.Path objects.
    N�r\s rr3r3�s
�����J�s��dirc#�hK�|5}tj|���ddd�y#1swYyxYw�w)zD
    Wrap tempfile.TemporyDirectory to return a pathlib object.
    N)rTrU)ri�results  r�
_temp_pathrl�s%����


���l�l�6�"�"�

���s�2�&�	2�/�2c#�K�ttj��5}t||���ddd�y#1swYyxYw�w)zt
    Given a traversable dir, recursively replicate the whole tree
    to the file system in a context manager.
    N)rlrO�TemporaryDirectory�_write_contents)r]�temp_dirs  rrere�s3����
�H�/�/�1�	2�h��h��-�-�
3�	2�	2�s�A�8�	A�A�Ac��|j|j�}|j�r3|j�|j	�D]}t||��|S|j
|j��|Sr,)�joinpathr&rb�mkdir�iterdirro�write_bytesr[)�target�source�child�items    rroro�sf���O�O�F�K�K�(�E�
�}�}��
���
��N�N�$�D��E�4�(�%��L�	���&�+�+�-�.��Lrr,)�),rQrTrOrr`r-r1rDrrB�typingrrr�abcrr�	_adaptersr	r.�str�Package�Anchorrr r"�singledispatchr�registerr3r6r�contextmanager�removerYr^�boolrcrfrUrnrlrerorhrr�<module>r�s��	����������(�(�,� �
�� � �#�%�
&��	���<�)�(�6�"�)�k�)��)�
��!1�!1�
�h�~�6N�
� ���(�(�6�"�(�u�'7�'7�(��(�	���)�C�)�E�$�$�)��)�	���:�D�:�U�%�%�:��:��"�%�*�*��������y�y�
���48�
�+�
�$�
����J��J�	���'�,�,������� �����#�H�/�/�#��#����.��.�r

Hacked By AnonymousFox1.0, Coded By AnonymousFox