Sindbad~EG File Manager
�
(Μg�)���ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl m
Z
mZejdd��Z
d�Zd�Zd�Zdd d
�d�Zd�Zejdd
��Zejdd��Zdddd�d�ZGd�de�ZGd�de�Zd�Zd�Zejd��Zd�Zejdd��Zy)�N�)�unlink�temp_dirc#�K�|r=tj�5tjddt�d��ddd�yd��y#1swYyxYw�w)z�Context manager to suppress package and module deprecation
warnings when importing them.
If ignore is False, this context manager has no effect.
�ignorez.+ (module|package)N)�warnings�catch_warnings�filterwarnings�DeprecationWarning)rs �7/usr/local/lib/python3.12/test/support/import_helper.py�_ignore_deprecated_importsr
sE�����
�
$�
$�
&��#�#�H�.C�$6�
8��'�
&�
�'�
&�s�A� A�A�A�Ac�F� tj|=y#t$rYywxYw�N)�sys�modules�KeyError)�names r�unloadrs%��
��K�K�����
��
�s�� � c��t|�tjD]d}tjj ||dz�}t|dz�dD],}ttjj||����.�fy)z�'Forget' a module was ever imported.
This removes the module from sys.modules and deletes any PEP 3147/488 or
legacy .pyc files.
z.py�c)�r�)�optimizationN) rr�path�os�joinr� importlib�util�cache_from_source)�modname�dirname�source�opts r�forgetr$%se���7�O��8�8�������g�w���7�� �v��|���C��9�>�>�3�3�F��3�M�N���c�.�tjj|�}tjjtjj
|��}tjj||dz�}tj||�|S)aMove a PEP 3147/488 pyc file to its legacy pyc location.
:param source: The file system path to the source file. The source file
does not need to exist, however the PEP 3147/488 pyc file must exist.
:return: The file system path to the legacy pyc file.
r)
rrrrrr!�abspathr�shutil�move)r"�pyc_file�up_one�
legacy_pycs r�make_legacy_pycr-5sc���~�~�/�/��7�H�
�W�W�_�_�R�W�W�_�_�V�4�
5�F������f�f�s�l�3�J�
�K�K��*�%��r%F�)�required_onc� �t|�5 tj|�cddd�S#t$rL}tj
j
t|��r�tjt|���d}~wwxYw#1swYyxYw)acImport and return the module to be tested, raising SkipTest if
it is not available.
If deprecated is True, any module or package deprecation messages
will be suppressed. If a module is required on a platform but optional for
others, set required_on to an iterable of platform prefixes which will be
compared against sys.platform.
N)r
r�
import_module�ImportErrorr�platform�
startswith�tuple�unittest�SkipTest�str)r�
deprecatedr/�msgs rr1r1Csq��
$�J� /� .��*�*�4�0�
0� /��� .��|�|�&�&�u�[�'9�:���#�#�C��H�-�-�� .��
0� /�s&�B�,� B�AA<�<B�B�B
c���i}td�|D��}ttj�D]:}||vs|j |�s�tjj|�||<�<|S)Nc3�&K�|] }|dz���y�w)�.Nr.)�.0rs r� <genexpr>z+_save_and_remove_modules.<locals>.<genexpr>Ws����2�E�D�T�C�Z�E�s�)r5�listrrr4�pop)�names�orig_modules�prefixesr s r�_save_and_remove_modulesrEUs^���L��2�E�2�2�H�����$���e��w�1�1�(�;�$'�K�K�O�O�G�$<�L��!�%��r%c#�K�tj|rdnd� d��tjd�y#tjd�wxYw�w)z�Force frozen modules to be used (or not).
This only applies to modules that haven't been imported yet.
Also, some essential modules will always be imported frozen.
r���Nr)�_imp�"_override_frozen_modules_for_tests)�enableds r�frozen_modulesrK^s>���� �+�+��A�b�A�3�
��/�/��2���/�/��2���A�7�A�A�Ac#�K�tj|rdnd�} d��tj|�y#tj|�wxYw�w)a�Force legacy modules to be allowed in subinterpreters (or not).
("legacy" == single-phase init)
This only applies to modules that haven't been imported yet.
It overrides the PyInterpreterConfig.check_multi_interp_extensions
setting (see support.run_in_subinterp_with_config() and
_xxsubinterpreters.create()).
Also see importlib.utils.allowing_all_extensions().
rrGN)rH�'_override_multi_interp_extensions_check)rJ�olds r�multi_interp_extensions_checkrPls@�����
6�
6�G�q��
L�C�:�
��4�4�S�9���4�4�S�9�rL)r9� usefrozenc��t|�5t|�}t|�}|h|�|�}t|�}|D]}dtj|<� t|�5 |D]
}t
|�� tj|�cddd�t|�tjj|�cddd�S#t$r=Yddd�t|�tjj|�ddd�ywxYw#1swYnxYw t|�tjj|�n/#t|�tjj|�wxYw ddd�y#1swYyxYw)a�Import and return a module, deliberately bypassing sys.modules.
This function imports and returns a fresh copy of the named Python module
by removing the named module from sys.modules before doing the import.
Note that unlike reload, the original module is not affected by
this operation.
*fresh* is an iterable of additional module names that are also removed
from the sys.modules cache before doing the import. If one of these
modules can't be imported, None is returned.
*blocked* is an iterable of module names that are replaced with None
in the module cache during the import to ensure that attempts to import
them raise ImportError.
The named module and any modules named in the *fresh* and *blocked*
parameters are saved before starting the import and then reinserted into
sys.modules when the fresh import is complete.
Module and package deprecation messages are suppressed during this import
if *deprecated* is True.
This function will raise ImportError if the named module cannot be
imported.
If "usefrozen" is False (the default) then the frozen importer is
disabled (except for essential modules like importlib._bootstrap).
N)r
r@rErrrK�
__import__r2�updaterr1)r�fresh�blockedr9rQrBrCr s r�import_fresh_modulerW�sG��D
$�J� /��U����w�-���(��(��(��/��6���G�#'�C�K�K�� �� -�� �*� �#(��"�7�+�$)�!�.�.�t�4�+�*�
%�U�+��K�K���|�,�+
0� /�� #� ��
+�
%�U�+��K�K���|�,�+
0� /� ��+�*��*�
%�U�+��K�K���|�,��
%�U�+��K�K���|�,��,�+
0� /� /�sr�AE;�E�D
�C�/D
� E�
*E;� D�
D
�E�*E;�D�D
�
D �E�+E;�,E.�.E;�;Fc�(�eZdZdZdd�d�Zd�Zd�Zy)�CleanImporta�Context manager to force import to return a new module reference.
This is useful for testing module-level behaviours, such as
the emission of a DeprecationWarning on import.
Use like this:
with CleanImport("foo"):
importlib.import_module("foo") # new reference
If "usefrozen" is False (the default) then the frozen importer is
disabled (except for essential modules like importlib._bootstrap).
F)rQc�:�tjj�|_|D]c}|tjvs�tj|}|j|k7rtj|j=tj|=�et|�|_yr)rr�copy�original_modules�__name__rK�_frozen_modules)�selfrQ�module_names�module_name�modules r�__init__zCleanImport.__init__�st�� #��� 0� 0� 2���'�K��c�k�k�)����[�1��
�?�?�k�1����F�O�O�4��K�K��,�(� .�i�8��r%c�:�|jj�|Sr)r^� __enter__�r_s rrezCleanImport.__enter__�s�����&�&�(��r%c��tjj|j�|jj
|�yr)rrrTr\r^�__exit__�r_�
ignore_excs rrhzCleanImport.__exit__�s0�������4�0�0�1�%����%�%�z�2r%N�r]�
__module__�__qualname__�__doc__rcrerhr.r%rrYrY�s���16�9��3r%rYc�"�eZdZdZd�Zd�Zd�Zy)�
DirsOnSysPatha�Context manager to temporarily add directories to sys.path.
This makes a copy of sys.path, appends any directories given
as positional arguments, then reverts sys.path to the copied
settings when the context ends.
Note that *all* sys.path modifications in the body of the
context manager, including replacement of the object,
will be reverted at the end of the block.
c��tjdd|_tj|_tjj |�yr)rr�original_value�original_object�extend)r_�pathss rrczDirsOnSysPath.__init__�s.��!�h�h�q�k���"�x�x���������r%c��|Srr.rfs rrezDirsOnSysPath.__enter__�s���r%c�h�|jt_|jtjddyr)rsrrrrris rrhzDirsOnSysPath.__exit__�s"���'�'����)�)�����r%Nrkr.r%rrprp�s�� ��
�*r%rpc�@�tjj�fSr)rrr[r.r%r�
modules_setupry�s���;�;�����r%c�N�tjj�D��cgc]\}}|jd�r||f��}}}tjj �tjj|�tjj|�ycc}}w)Nz
encodings.)rr�itemsr4�clearrT)�
oldmodules�k�v� encodingss r�modules_cleanupr��s}��%(�K�K�$5�$5�$7�0�$7�D�A�q��L�L��.��Q��$7�I�0��K�K�����K�K���y�!��K�K���z�"��0s�B!c#�dK�t�\} d��t|�y#t|�wxYw�w)z4
Save modules on entry and cleanup on exit.
N)ryr�)�saveds r�isolated_modulesr�s)����
��H�U��
��������s�
0� �0�
-�0c�@�ddlm}|jdd��|�S)Nr)�mockzos.register_at_forkT)�create)r6r��patch)�funcr�s r�mock_register_at_forkr�s"���9�4�:�:�+�D�:�9�$�?�?r%c#�8K�ddlm}|xsd}t�5}|j|||�}tj
j
|d�} tjjd|�||f��tjj|�|�|tj
|<n!tj
j
|d� ddd�y#|�|tj
|<wtj
j
|d�wxYw#1swYyxYw�w)Nr)�
script_helper�spam)
�test.supportr�r�make_scriptrrrAr�insert�remove)rr"r��tempdirr�
old_modules r�ready_to_importr�#s�����*��>�6�D� ��w��(�(��$��?���[�[�_�_�T�4�0�
� ,��H�H�O�O�A�w�'���*���H�H�O�O�G�$��%�$.����D�!�������d�+�
����%�$.����D�!�������d�+��
��s5�D�4D�AC�7D�
D�8D�D�D�D)T)F)r.r.)Nr)�
contextlibrHr�importlib.utilrr(rr6r� os_helperrr�contextmanagerr
rr$r-r1rErKrPrW�objectrYrpryr�r�r�r�r.r%r�<module>r�s������ �
�
���'�������
�
O� �.��.�$����
3��
3����:��:�&7-�#(�"'�7-�t#3�&�#3�L*�F�*�2�#�$������@����,��,r%
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists