Your IP : 18.119.166.34


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

�

�Q�f�*���dZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
ddlmZd
dlZd
dlZd
dlZd�Zd�Zdd�Zdd�ZGd�d�ZGd�dej.�ZGd�de�Zy)z-Utility code for constructing importers, etc.�)�Loader)�module_from_spec)�
_resolve_name)�spec_from_loader)�
_find_spec)�MAGIC_NUMBER)�_RAW_MAGIC_NUMBER)�cache_from_source)�
decode_source)�source_from_cache)�spec_from_file_location�Nc�6�tjt|�S)zBReturn the hash of *source_bytes* as used in hash-based pyc files.)�_imp�source_hashr	)�source_bytess �5/opt/alt/python312/lib64/python3.12/importlib/util.pyrrs�����-�|�<�<�c��|jd�s|S|stdt|��d���d}|D]}|dk7rn|dz
}�t||d||�S)z2Resolve a relative module name to an absolute one.�.zno package specified for z% (required for relative module names)rrN)�
startswith�ImportError�reprr)�name�package�level�	characters    r�resolve_namersw���?�?�3����
��5�d�4�j�\�BA�A�B�	B�
�E��	�����
��
�����e�f��w��6�6rc���|tjvrt||�Stj|}|�y	|j}|�t	|�d���|S#t
$rt	|�d��d�wxYw)a�Return the spec for the specified module.

    First, sys.modules is checked to see if the module was already imported. If
    so, then sys.modules[name].__spec__ is returned. If that happens to be
    set to None, then ValueError is raised. If the module is not in
    sys.modules, then sys.meta_path is searched for a suitable spec with the
    value of 'path' given to the finders. None is returned if no spec could
    be found.

    Dotted names do not have their parent packages implicitly imported. You will
    most likely need to explicitly import all parent packages in the proper
    order for a submodule to get the correct spec.

    N�.__spec__ is None�.__spec__ is not set)�sys�modulesr�__spec__�
ValueError�AttributeError)r�path�module�specs    r�_find_spec_from_pathr*'s����3�;�;���$��%�%����T�"���>��	��?�?�D��|� �D�6�):�!;�<�<��K���	F���v�%9�:�;��E�	F�s�A�A-c���|jd�rt||�n|}|tjvr@|j	d�d}|rt|dg��}	|j}nd}t||�Stj|}|�y	|j}|�t|�d	���|S#t$r}td|�d|��|��|�d}~wwxYw#t$rt|�d
��d�wxYw)a�Return the spec for the specified module.

    First, sys.modules is checked to see if the module was already imported. If
    so, then sys.modules[name].__spec__ is returned. If that happens to be
    set to None, then ValueError is raised. If the module is not in
    sys.modules, then sys.meta_path is searched for a suitable spec with the
    value of 'path' given to the finders. None is returned if no spec could
    be found.

    If the name is for submodule (contains a dot), the parent module is
    automatically imported.

    The name and package arguments work the same as importlib.import_module().
    In other words, relative module names (with leading dots) work.

    rr�__path__)�fromlistz __path__ attribute not found on z while trying to find )rNr r!)rrr"r#�
rpartition�
__import__r,r&�ModuleNotFoundErrorrr$r%)	rr�fullname�parent_name�parent�parent_path�er(r)s	         r�	find_specr6Fs��"/3�o�o�c�.B�|�D�'�*��H��s�{�{�"��)�)�#�.�q�1�����z�l�C�F�
P�$�o�o���K��(�K�0�0����X�&���>��	��?�?�D��|� �D�6�):�!;�<�<��K��%"�
P�)�6�{�o�F,�,4�<�9�?G�I�NO�P��
P���	F���v�%9�:�;��E�	F�s$�B'�	C�'	C	�0C�C	�C%c�2�eZdZdZd�Zd�Zd�Zed��Zy)�+_incompatible_extension_module_restrictionsagA context manager that can temporarily skip the compatibility check.

    NOTE: This function is meant to accommodate an unusual case; one
    which is likely to eventually go away.  There's is a pretty good
    chance this is not what you were looking for.

    WARNING: Using this function to disable the check can lead to
    unexpected behavior and even crashes.  It should only be used during
    extension module development.

    If "disable_check" is True then the compatibility check will not
    happen while the context manager is active.  Otherwise the check
    *will* happen.

    Normally, extensions that do not support multiple interpreters
    may not be imported in a subinterpreter.  That implies modules
    that do not implement multi-phase init or that explicitly of out.

    Likewise for modules import in a subinterpeter with its own GIL
    when the extension does not support a per-interpreter GIL.  This
    implies the module does not have a Py_mod_multiple_interpreters slot
    set to Py_MOD_PER_INTERPRETER_GIL_SUPPORTED.

    In both cases, this context manager may be used to temporarily
    disable the check for compatible extension modules.

    You can get the same effect as this function by implementing the
    basic interface of multi-phase init (PEP 489) and lying about
    support for multiple interpreters (or per-interpreter GIL).
    c�$�t|�|_y�N)�bool�
disable_check)�selfr<s  r�__init__z4_incompatible_extension_module_restrictions.__init__�s��!�-�0��rc�N�tj|j�|_|Sr:)r�'_override_multi_interp_extensions_check�override�old�r=s r�	__enter__z5_incompatible_extension_module_restrictions.__enter__�s���?�?��
�
�N����rc�J�|j}|`tj|�yr:)rBrr@)r=�argsrBs   r�__exit__z4_incompatible_extension_module_restrictions.__exit__�s���h�h���H��4�4�S�9rc�"�|jrdSdS)N���r)r<rCs rrAz4_incompatible_extension_module_restrictions.override�s���'�'�r�.�Q�.rN)	�__name__�
__module__�__qualname__�__doc__r>rDrG�propertyrA�rrr8r8ws*���>1��:�
�/��/rr8c��eZdZdZd�Zd�Zy)�_LazyModulezKA subclass of the module type which triggers loading upon attribute access.c��tj|d�}|j}|d5tj|d�tu�r#|drtj||�cddd�Sd|d<tj|d�}|j}|d}|}i}|j�D]2\}	}
|	|vr|
||	<�t
||	�t
||	�k7s�.|
||	<�4|jj|�|tjvr7t
|�t
tj|�k7rtd|�d	���|j|�tj|_ddd�t!||�S#1swY�xYw)
z8Trigger the load of the module and return the attribute.r$�lock�	__class__�
is_loadingNT�__dict__zmodule object for z. substituted in sys.modules during a lazy load)�object�__getattribute__�loader_staterQr�items�id�loader�exec_moduler"r#r%�update�types�
ModuleTyperT�getattr)r=�attrr$rYrV�
original_name�
attrs_then�	attrs_now�
attrs_updated�key�values           rrXz_LazyModule.__getattribute__�s����*�*�4��<���,�,��
�&�
!��&�&�t�[�9�[�H�
 ��-�!�2�2�4��>�+	2�+	2�.2��\�*�!�2�2�4��D��!)�
�
�
�*�*�5�
�$�	� "�
�"+�/�/�"3�J�C���*�,�-2�
�c�*��I�c�N�+�r�*�S�/�/B�B�-2�
�c�*�
#4����+�+�D�1�!�C�K�K�/��$�x�2�c�k�k�-�&@�#A�A�(�+=�m�=N�O1�*1�2�2�
���
�.�!&�!1�!1���W"�Z�t�T�"�"�["�
!�s�8E=�*A-E=�BE=�=Fc�>�|j|�t||�y)z/Trigger the load and then perform the deletion.N)rX�delattr)r=rbs  r�__delattr__z_LazyModule.__delattr__�s��	
���d�#���d�rN)rJrKrLrMrXrkrOrrrQrQ�s��U�1#�frrQc�B�eZdZdZed��Zed��Zd�Zd�Z	d�Z
y)�
LazyLoaderzKA loader that creates a module which defers loading until attribute access.c�2�t|d�std��y)Nr]z loader must define exec_module())�hasattr�	TypeError)r\s r�__check_eager_loaderzLazyLoader.__check_eager_loader�s���v�}�-��>�?�?�.rc�4����j����fd�S)z>Construct a callable which returns the eager loader made lazy.c� ����|i|���Sr:rO)rF�kwargs�clsr\s  ��r�<lambda>z$LazyLoader.factory.<locals>.<lambda>�s���s�6�4�+B�6�+B�'Cr)�_LazyLoader__check_eager_loader)rur\s``r�factoryzLazyLoader.factory�s���	� � ��(�C�Crc�4�|j|�||_yr:)rwr\)r=r\s  rr>zLazyLoader.__init__�s���!�!�&�)���rc�8�|jj|�Sr:)r\�
create_module)r=r)s  rr{zLazyLoader.create_module�s���{�{�(�(��.�.rc�(�ddl}|j|j_|j|_i}|jj�|d<|j|d<|j�|d<d|d<||j_t|_y)zMake the module load lazily.rNrVrTrSFrU)
�	threadingr\r$�
__loader__rV�copyrT�RLockrYrQ)r=r(r}rYs    rr]zLazyLoader.exec_module�s���	�!%������� �K�K���
��#)�?�?�#7�#7�#9��Z� �$*�$4�$4��[�!�(���0��V��%*��\�"�'3����$�&��rN)rJrKrLrM�staticmethodrw�classmethodrxr>r{r]rOrrrmrm�s>��U��@��@��D��D�
�/�'rrmr:)rM�_abcr�
_bootstraprrrr�_bootstrap_externalrr	r
rrr
rr"r_rrr*r6r8r`rQrmrOrr�<module>r�sq��3��(�%�(�"�-�2�2�.�2�8��
��=�
7��>*�b./�./�b<�%�"�"�<�~''��''r

?>