Your IP : 18.226.4.246
�
�/�g>`����dZddlmZddlmZddlZddlZddlZddl Z ddl
Z ddlZddlm
Z
ddlZgd�Zedd��Zd e_d
�Zd�Zdd
�Zd d�Zed!d���Zd!d�Ze�ejje��d�ZGd�d��ZGd�d��Z ddlZddlmZd!d�Ze�ee��n#e $rYnwxYwd�Z!d!d�Z"d�Z#d�Z$d�Z%d�Z&da'd�Z(dS)"zUtilities to support packages.�)�
namedtuple)�singledispatchN)�
ModuleType)�get_importer�iter_importers�
get_loader�find_loader�
walk_packages�iter_modules�get_data�ImpImporter� ImpLoader� read_code�extend_path�
ModuleInforzmodule_finder name ispkgz.A namedtuple with minimal info about a module.c�� |j}||��S#t$r=|�|��}|�YdStj�||��cYSwxYw)z'Return the finder-specific module spec.N)� find_spec�AttributeError�find_module� importlib�util�spec_from_loader)�finder�namer�loaders �./opt/alt/python311/lib64/python3.11/pkgutil.py� _get_specrsy����$� ��y������
�=�=�=��#�#�D�)�)���>��4�4��~�.�.�t�V�<�<�<�<�<� =���s��!A� A�Ac��ddl}|�d��}|tjjkrdS|�d��|�|��S)Nr��)�marshal�readrr�MAGIC_NUMBER�load)�streamr!�magics rrr(sR���N�N�N��K�K��N�N�E�� ��+�+�+��t�
�K�K��O�O�O��<�<������c#��K�ifd��t||��D]�}|V�|jr� t|j��t t
j|jdd��pg}�fd�|D��}t||jdz|��Ed{V���x#t$r|�||j��Y��t$r|�||j��n�Y��wxYw��dS)a�Yields ModuleInfo for all modules recursively
on path, or, if path is None, all accessible modules.
'path' should be either None or a list of paths to look for
modules in.
'prefix' is a string to output on the front of every module name
on output.
Note that this function must import all *packages* (NOT all
modules!) on the given path, in order to access the __path__
attribute to find submodules.
'onerror' is a function which gets called with one argument (the
name of the package which was being imported) if any exception
occurs while trying to import a package. If no onerror function is
supplied, ImportErrors are caught and ignored, while all other
exceptions are propagated, terminating the search.
Examples:
# list all modules python can access
walk_packages()
# list all submodules of ctypes
walk_packages(ctypes.__path__, ctypes.__name__+'.')
c��||vrdSd||<dS)NT�)�p�ms r�seenzwalk_packages.<locals>.seenRs����6�6��4���!���r'�__path__Nc�*��g|]}�|���
|��Sr+r+)�.0r,r.s �r�
<listcomp>z!walk_packages.<locals>.<listcomp>is&���7�7�7�a�t�t�A�w�w�7��7�7�7r'�.)
r�ispkg�
__import__r�getattr�sys�modulesr
�ImportError� Exception)�path�prefix�onerror�infor.s @rr
r
5sQ�����:�����
�T�6�*�*�G�G���
�
�
��:� G�
G��4�9�%�%�%��s�{�4�9�5�z�4�H�H�N�B��8�7�7�7�4�7�7�7��(��t�y��}�g�F�F�F�F�F�F�F�F�F�F���
'�
'�
'��&��G�D�I�&�&�&����
�
�
��&��G�D�I�&�&�&�&��'�&�
����
G�G�Gs�B�C�/C�Cc#�K�|�t��}n9t|t��rtd���t t
|��}i}|D]4}t
||��D]!\}}||vrd||<t|||��V��"�5dS)aYields ModuleInfo for all submodules on path,
or, if path is None, all top-level modules on sys.path.
'path' should be either None or a list of paths to look for
modules in.
'prefix' is a string to output on the front of every module name
on output.
Nz9path must be None or list of paths to look for modules in�)r�
isinstance�str�
ValueError�mapr�iter_importer_modulesr)r;r<� importers�yielded�irr4s rrrns������|�"�$�$� � � �D�#� � �,��%�&�&� &���d�+�+� ��G�
�1�1��0��F�;�;� 1� 1�K�D�%��7�"�"� !���
� ��D�%�0�0�0�0�0�� 1�1�1r'c�P�t|d��sgS|�|��S)Nr)�hasattrr)�importerr<s rrErE�s-���8�^�,�,��� �� � ��(�(�(r'c#�K�|j�$tj�|j��sdSi}ddl} tj|j��}n#t
$rg}YnwxYw|���|D]�}|�|��}|dks||vr�"tj�|j|��}d}|srtj�|��rSd|vrO|} tj|��} n#t
$rg} YnwxYw| D]!}|�|��}
|
dkrd}n�"��|rd|vrd||<||z|fV���dS�Nr�__init__Fr3Tr@� r;�os�isdir�inspect�listdir�OSError�sort�
getmodulename�join)rKr<rGrR� filenames�fn�modnamer;r4�dircontents�subnames r�_iter_file_finder_modulesr]�s������}��B�G�M�M�(�-�$@�$@�����G��N�N�N���J�x�}�-�-� � ������� � � ������N�N�����*�*���'�'��+�+���J���'�W�"4�"4���w�|�|�H�M�2�.�.�����
�2�7�=�=��.�.�
�3�b�=�=��G�
!� �j��.�.�����
!�
!�
!� ����
!����"�
�
��!�/�/��3�3���J�&�&� �E��E�'��� *�s�'�)�)� �G�G���7�"�E�)�)�)�)��3*�*�#�A�A �A �*C?�?D�
Dc��tj��5tjdt��t jd��addd��dS#1swxYwYdS)N�ignore�imp)�warnings�catch_warnings�simplefilter�DeprecationWarningr�
import_modulerar+r'r�_import_imprg�s��� � � "� "�-�-���h�(:�;�;�;��%�e�,�,��-�-�-�-�-�-�-�-�-�-�-�-����-�-�-�-�-�-s�/A�A�Ac�*�eZdZdZdd�Zdd�Zdd�ZdS) r
aPEP 302 Finder that wraps Python's "classic" import algorithm
ImpImporter(dirname) produces a PEP 302 finder that searches that
directory. ImpImporter(None) produces a PEP 302 finder that searches
the current sys.path, plus any modules that are frozen or built-in.
Note that ImpImporter does not currently support being used by placement
on sys.meta_path.
Nc�d�tjdt��t��||_dS�Nz[This emulation is deprecated and slated for removal in Python 3.12; use 'importlib' instead)rb�warnrergr;)�selfr;s rrNzImpImporter.__init__�s5���
�@�
� !� !� !� �
�
�
��� � � r'c�<�|�d��d}||kr |j�dS|j�d}n%tj�|j��g} t�||��\}}}n#t$rYdSwxYwt||||��S)Nr3���)�splitr;rP�realpathrarr9r)rl�fullnamer;r\�file�filename�etcs rrzImpImporter.find_module�s����.�.��%�%�b�)���h���4�9�#4��4��9���D�D��G�$�$�T�Y�/�/�0�D� �"%�/�/�'�4�"@�"@��D�(�C�C��� � � ��4�4� ������4��3�7�7�7s�A;�;
B �B r(c#�K�|j�$tj�|j��sdSi}ddl} tj|j��}n#t
$rg}YnwxYw|���|D]�}|�|��}|dks||vr�"tj�|j|��}d}|srtj�|��rSd|vrO|} tj|��} n#t
$rg} YnwxYw| D]!}|�|��}
|
dkrd}n�"��|rd|vrd||<||z|fV���dSrMrO)rlr<rGrRrXrYrZr;r4r[r\s rrzImpImporter.iter_modules�s������9��B�G�M�M�$�)�$<�$<���F������� ��
�4�9�-�-�I�I��� � � ��I�I�I� ���� ������� .� .�B��+�+�B�/�/�G��
�"�"�g��&8�&8���7�<�<�� �2�.�.�D��E��
�r�w�}�}�T�2�2�
�s�"�}�}���%�"$�*�T�"2�"2�K�K���%�%�%�"$�K�K�K�%����&���B�%�3�3�B�7�7�G��
�*�*� $����+���
.�3�g�-�-�#$��� ��w�&��-�-�-�-��3 .� .r^�N�r()�__name__�
__module__�__qualname__�__doc__rNrrr+r'rr
r
�sZ������������
8�
8�
8�
8�&.�&.�&.�&.�&.�&.r'r
c�\�eZdZdZdxZZd�Zd�Zd�Zd�Z d�Z
d�Zd
d �Zd
d
�Z
d�Zd
d�ZdS)rzBPEP 302 Loader that wraps Python's "classic" import algorithm
Nc��tjdt��t��||_||_||_||_dSrj)rbrkrergrrrsrqrt)rlrqrrrsrts rrNzImpLoader.__init__sI���
�=�(� *� *� *� �
�
�
��� � ��
� ��
�����r'c��|��� t�||j|j|j��}|jr|j���n&#|jr|j���wwxYw|Srv)�_reopenra�load_modulerrrsrt�close)rlrq�mods rr�zImpLoader.load_modules�������� "��/�/�(�D�I�t�}�d�h�O�O�C��y�
"�� ���!�!�!����y�
"�� ���!�!�!�!�
"�����
s�,A#�##Bc�~�t|d��5}|���cddd��S#1swxYwYdS)N�rb)�openr")rl�pathnamerrs rrzImpLoader.get_data's~��
�(�D�
!�
!� �T��9�9�;�;� � � � � � � � � � � � ���� � � � � � s�2�6�6c��|jr{|jjrq|jd}|tjkrt|jd��|_dS|tjtjfvr t|jd��|_dSdSdSdS)N��rr�) rr�closedrtra� PY_SOURCEr�rs�PY_COMPILED�C_EXTENSION)rl�mod_types rrzImpLoader._reopen+s����9� 6���)� 6��x��{�H����&�&� ����4�4�� � � ��c�o�s��?�?�?� ����5�5�� � � � 6� 6� 6� 6�@�?r'c�d�|�|j}n%||jkrtd|j�d|�����|S)NzLoader for module z cannot handle module )rqr9�rlrqs r� _fix_namezImpLoader._fix_name3sM�����}�H�H�
���
&�
&��+�-1�]�]�]�H�H�F�G�G�
G��r'c�b�|�|��}|jdtjkS�Nr�)r�rtra�
PKG_DIRECTORYr�s r�
is_packagezImpLoader.is_package;s'���>�>�(�+�+���x��{�C�-�-�-r'c�F�|�|��}|j��|jd}|tjkr1|�|��}t
||jd��|_n�|tjkrf|� �� t|j��|_|j���nY#|j���wxYw|tj
kr+|������|_|jS)Nr��exec)r��codertrar��
get_source�compilersr�rrrrr�r��
_get_delegate�get_code)rlrqr��sources rr�zImpLoader.get_code?s����>�>�(�+�+���9���x��{�H����&�&�����2�2��#�F�D�M�6�B�B�� � ��3�?�*�*�������&� )�$�)� 4� 4�D�I��I�O�O�%�%�%�%��D�I�O�O�%�%�%�%�����3�,�,�,� �.�.�0�0�9�9�;�;�� ��y�s�C�Cc���|�|��}|j��N|jd}|tjkrk|��� |j���|_|j���n�#|j���wxYw|tj kr{tj�|j
dd���rNt|j
dd�d��5}|���|_ddd��n#1swxYwYn;|tjkr+|������|_|jS)Nr�rnr�)r�r�rtrar�rrrr"r�r�rPr;�existsrsr�r�r�r�)rlrqr��fs rr�zImpLoader.get_sourcePse���>�>�(�+�+���;���x��{�H����&�&�������&�"&�)�.�.�"2�"2�D�K��I�O�O�%�%�%�%��D�I�O�O�%�%�%�%�����3�?�*�*��7�>�>�$�-����"4�5�5�/��d�m�C�R�C�0�#�6�6�/�!�&'�f�f�h�h���/�/�/�/�/�/�/�/�/�/�/����/�/�/�/���3�,�,�,�"�0�0�2�2�=�=�?�?����{�s�B�B#�?D%�%D)�,D)c�X�t|j��}t|d��}|jS)NrN)r
rsrr)rlr�specs rr�zImpLoader._get_delegatebs(���T�]�+�+�����,�,���{�r'c��|�|��}|jd}|tjkr&|������S|tjtjtjfvr|j SdSr�)
r�rtrar�r��get_filenamer�r�r�rs)rlrqr�s rr�zImpLoader.get_filenamegso���>�>�(�+�+���8�A�;���S�&�&�&��%�%�'�'�4�4�6�6�6�
�#�-���#�/�J�
J�
J��=� ��tr'rv)rxryrzr{r�r�rNr�rrr�r�r�r�r�r�r+r'rrr
s�����������D�6���� � � ����6�6�6����.�.�.�����"����$���
�����r'r)�zipimporterc#�NK�ttj|j��}|j}t|��}i}ddl}|D]�}|�|��s�||d��tj
��}t|��dkr?|d�d��r$|d|vrd||d<||dzdfV�t|��dkr��|�|d��}|dkr��|rd|vr||vrd||<||zdfV���dS) Nrr�r@z__init__.pyTrNr3F)�sorted� zipimport�_zip_directory_cache�archiver<�lenrR�
startswithrorP�seprV) rKr<�dirlist�_prefix�plenrGrRrYrZs r�iter_zipimport_modulesr�usW������7��8H�I�J�J���/���7�|�|��������� .� .�B��=�=��)�)�
���D�E�E������(�(�B��2�w�w��z�z�b��e�.�.�}�=�=�z��a�5��'�'�%&�G�B�q�E�N� �2�a�5�.�$�.�.�.�.��2�w�w��z�z���+�+�B�q�E�2�2�G��
�"�"���
.�3�g�-�-�'��2H�2H�#$��� ��w�&��-�-�-�-��) .� .r'c��tj|��} tj|}n^#t$rQtjD]?} ||��}tj�||��n#t$rY�<wxYwd}YnwxYw|S)z�Retrieve a finder for the given path item
The returned finder is cached in sys.path_importer_cache
if it was newly created by a path hook.
The cache (or part of it) can be cleared manually if a
rescan of sys.path_hooks is necessary.
N)rP�fsdecoder7�path_importer_cache�KeyError�
path_hooks�
setdefaultr9)� path_itemrK� path_hooks rrr�s�����I�&�&�I���*�9�5����� � � ��� � �I�
�$�9�Y�/�/���'�2�2�9�h�G�G�G�����
�
�
���
�����H��� �����Os3�)�B�+A/�-B�/
A<�9B�;A<�<B�Bc#�vK�|�d��r$d�|��}t|���d|vrE|�d��d}t j|��}t
|dd��}|�dSntjEd{V��tj }|D]}t|��V��dS)a�Yield finders for the given module name
If fullname contains a '.', the finders will be for the package
containing fullname, otherwise they will be all registered top level
finders (i.e. those on both sys.meta_path and sys.path_hooks).
If the named module is in a package, that package is imported as a side
effect of invoking this function.
If no module name is specified, all top level finders are produced.
r3�'Relative module name {!r} not supportedrr/N)r��formatr9�
rpartitionrrfr6r7� meta_pathr;r)rq�msg�pkg_name�pkgr;�items rrr�s��������3����7�>�>�x�H�H���#����
�h����&�&�s�+�+�A�.���%�h�/�/���s�J��-�-���<��F���=� � � � � � � ��x���!�!���4� � � � � � �!�!r'c��|tjvrtj|}|�dSt|t��r2|}t |dd��}|�|St |dd���dS|j}n|}t
|��S)z�Get a "loader" object for module_or_name
Returns None if the module cannot be found or imported.
If the named module is not already imported, its containing package
(if any) is imported, in order to establish the package __path__.
N�
__loader__�__spec__)r7r8rArr6rxr )�module_or_name�modulerrqs rrr�s������$�$���^�4���!��4��.�*�-�-� "������t�4�4�����M��6�:�t�,�,�4��4��?���!���x� � � r'c �~�|�d��r$d�|��}t|��� tj�|��}nY#ttttf$r9}d}t|�|t|��|����|�d}~wwxYw|�|j
ndS)z�Find a "loader" object for fullname
This is a backwards compatibility wrapper around
importlib.util.find_spec that converts most failures to ImportError
and only returns the loader rather than the full spec
r3r�z,Error while finding loader for {!r} ({}: {})N)r�r�r9rrrr� TypeErrorrC�typer)rqr�r��exs rr r �s������3����7�>�>�x�H�H���#����F��~�'�'��1�1�������J�?�F�F�F�=���#�*�*�X�t�B�x�x��<�<�=�=�2�E�����F�����*�4�;�;��4s�A�B1�84B,�,B1c �4�t|t��s|S|dz}|dd�}|�d��\}}}|r2 tj|j}n%#ttf$r|cYSwxYwtj}|D�]�}t|t��s�t|��}|�yg} t|d��r!|�|��}
|
� |
j
pg} n(t|d��r|�|��\}} | D]}||vr|�|���t j�||��}t j�|��r� t'|��}
|
5|
D]D}|�d��}|r|�d��r�/|�|���E ddd��n#1swxYwY��V#t,$r1}tj�d|�d |�d���Yd}~���d}~wwxYw���|S)
a�Extend a package's path.
Intended use is to place the following code in a package's __init__.py:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
For each directory on sys.path that has a subdirectory that
matches the package name, add the subdirectory to the package's
__path__. This is useful if one wants to distribute different
parts of a single logical package as multiple directories.
It also looks for *.pkg files beginning where * matches the name
argument. This feature is similar to *.pth files (see site.py),
except that it doesn't special-case lines starting with 'import'.
A *.pkg file is trusted at face value: apart from checking for
duplicates, all entries found in a *.pkg file are added to the
path, regardless of whether they are exist the filesystem. (This
is a feature.)
If the input path is not a list (as is the case for frozen
packages) it is returned unchanged. The input path is not
modified; an extended copy is returned. Items are only appended
to the copy at the end.
It is assumed that sys.path is a sequence. Items of sys.path that
are not (unicode or 8-bit) strings referring to existing
directories are ignored. Unicode items of sys.path that cause
errors when used as filenames may cause this function to raise an
exception (in line with os.path.isdir() behavior).
z.pkgNr3rr �
�#zCan't open z: )rA�listr�r7r8r/r�rr;rBrrJr�submodule_search_locationsr �appendrPrW�isfiler��rstripr�rT�stderr�write)r;r� sname_pkg�parent_package�_�
final_name�search_path�dirr�portionsr��portion�pkgfiler��liner�s rrr�s���B�d�D�!�!�����v�
�I�����7�D�$(�O�O�C�$8�$8�!�N�A�z��� ��+�n�5�>�K�K���.�)� � � ��K�K�K� ����
�h���$*�$*���#�s�#�#� ���c�"�"�����H��v�{�+�+�
=��'�'�
�3�3���#�#�>�D�"�H�����/�/�
=�$�0�0��<�<���8�#�
)�
)���$�&�&��K�K��(�(�(���'�,�,�s�I�.�.��
�7�>�>�'�"�"� *�
*���M�M��
�*�*� !�*�*��#�{�{�4�0�0��#�%�t���s�';�';�%�$����D�)�)�)�)� *�*�*�*�*�*�*�*�*�*�*�*����*�*�*�*��� �
1�
1�
1��
� � � �")�'�'�3�3�3�"0�1�1�1�1�1�1�1�1�����
1���� *��Ks=�A�A1�0A1�%G�6AG�G �G �
H�"&H�Hc��tj�|��}|�dS|j}|�t |d��sdSt
j�|��ptj� |��}|�t |d��sdS|�
d��}|�dtj
�|j����tj
j|�}|�|��S)afGet a resource from a package.
This is a wrapper round the PEP 302 loader get_data API. The package
argument should be the name of a package, in standard module format
(foo.bar). The resource argument should be in the form of a relative
filename, using '/' as the path separator. The parent directory name '..'
is not allowed, and nor is a rooted name (starting with a '/').
The function returns a binary string, which is the contents of the
specified resource.
For packages located in the filesystem, which have already been imported,
this is the rough equivalent of
d = os.path.dirname(sys.modules[package].__file__)
data = open(os.path.join(d, resource), 'rb').read()
If the package cannot be located or loaded, or it uses a PEP 302 loader
which does not support get_data(), then None is returned.
Nr�__file__�/r)rrrrrJr7r8�get�
_bootstrap�_loadro�insertrPr;�dirnamer�rWr)�package�resourcer�rr��parts�
resource_names rrrXs���,�>�#�#�G�,�,�D��|��t�
�[�F�
�~�W�V�Z�8�8�~��t��;�?�?�7�#�#�,���%�%�d�+�+��
�{�'�#�z�2�2�{��t�
�N�N�3���E� �L�L��B�G�O�O�C�L�1�1�2�2�2��G�L�%�(�M��?�?�=�)�)�)r'c���t�(ddl}d}|�d|�d|�d�|j��at�|��}|std|�����|���}|�d��rItj |d ��}|�d
��}|r|�
d��ng}n�|�
d��}|�d��}tj |��}|rN|d}|�d|��} tj | ��}|�d��| }n#t$rYnwxYw|�N|}
|D]}t|
|��}
�|
S)a�
Resolve a name to an object.
It is expected that `name` will be a string in one of the following
formats, where W is shorthand for a valid Python identifier and dot stands
for a literal period in these pseudo-regexes:
W(.W)*
W(.W)*:(W(.W)*)?
The first form is intended for backward compatibility only. It assumes that
some part of the dotted name is a package, and the rest is an object
somewhere within that package, possibly nested inside other objects.
Because the place where the package stops and the object hierarchy starts
can't be inferred by inspection, repeated attempts to import must be done
with this form.
In the second form, the caller makes the division point clear through the
provision of a single colon: the dotted name to the left of the colon is a
package to be imported, and the dotted name to the right is the object
hierarchy within that package. Only one import is needed in this form. If
it ends with the colon, then a module object is returned.
The function will return an object (which might be a module), or raise one
of the following exceptions:
ValueError - if `name` isn't in a recognised format
ImportError - if an import failed when it shouldn't have
AttributeError - if a failure occurred when traversing the object hierarchy
within the imported package to get to the desired object.
Nrz(?!\d)(\w+)(\.(?!\d)(\w+))*z ^(?P<pkg>z)(?P<cln>:(?P<obj>z)?)?$zinvalid format: �clnr��objr3)�
_NAME_PATTERN�rer��UNICODE�matchrC� groupdictr�rrfro�popr9r6)rr��dotted_wordsr-�gdr�r�rZr,�s�results r�resolve_namer��s���B��� � � �5���
�
�$K�|�$K�$K�7C�$K�$K�$K�#%�:�/�/�
� ���D�!�!�A��6��4�D�4�4�5�5�5�
�����B� �v�v�e�}�}���%�b��i�0�0�����u�
�
��$)�1����C� � � �r����
�
�3�����)�)�A�,�,���%�g�.�.��� ��a��A�� � �Q� � �A�
��-�a�0�0��� � �!���������
�
�
���
����� ��F�
�$�$�����#�#����Ms� +E�
E�E)Nr(N)Nr(rw))r{�collectionsr� functoolsr�
simplegenericr�importlib.util�importlib.machineryrP�os.pathr7�typesrrb�__all__rrrr
rrEr]�register� machinery�
FileFinderrgr
rr�r�r�r9rrrr rrr�r�r+r'r�<module>rs���$�$�"�"�"�"�"�"�5�5�5�5�5�5������������� � � � �����
�
�
�
����������������Z��&@�
A�
A�
�E�
�����
�
�
�6G�6G�6G�6G�r1�1�1�1�4�)�)�)���)�&*�&*�&*�&*�P���
��"�$=�?�?�?�-�-�-�H.�H.�H.�H.�H.�H.�H.�H.�Va�a�a�a�a�a�a�a�H# �����%�%�%�%�%�%�.�.�.�.�8�"�"�;�0F�G�G�G�G��� � � ��D� �������2!�!�!�!�:!�!�!�05�5�5�*[�[�[�|(*�(*�(*�V�
�G�G�G�G�Gs�$$C � C�C
?>