AlkantarClanX12

Your IP : 18.227.72.24


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

�

�Q�fiG���dZddlmZddlmZddlZddlZddlZddl	Z	ddl
Z	ddlZddlm
Z
ddlZgd�Zedd�Zd	e_d
�Zdd�Zdd�Zedd
��Zdd�Zej-ej.j0e�	ddlZddlmZdd�Zej-ee�d�Zdd�Zd�Zd�Z d�Z!d�Z"da#d�Z$y#e$rY� wxYw)zUtilities to support packages.�)�
namedtuple)�singledispatchN)�
ModuleType)
�get_importer�iter_importers�
get_loader�find_loader�
walk_packages�iter_modules�get_data�	read_code�extend_path�
ModuleInforzmodule_finder name ispkgz.A namedtuple with minimal info about a module.c��ddl}|jd�}|tjjk7ry|jd�|j|�S)Nr��)�marshal�read�	importlib�util�MAGIC_NUMBER�load)�streamr�magics   �./opt/alt/python312/lib64/python3.12/pkgutil.pyr
r
sC����K�K��N�E��	���+�+�+��
�K�K��O��<�<����c#��K�ifd�}t||�D]�}|��|js�	t|j�t	t
j|jdd�xsg}|D�cgc]
}||�r�|��}}t||jdz|�Ed{�����ycc}w7�#t$r|�||j�Y��t$r|�||j�n�Y��wxYw�w)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��||vryd||<y)NT�)�p�ms  r�seenzwalk_packages.<locals>.seenDs����6����!�r�__path__N�.)
r�ispkg�
__import__�name�getattr�sys�modulesr
�ImportError�	Exception)�path�prefix�onerrorr"�infor s      rr
r
's�����:��
�T�6�*���
��:�:�
G��4�9�9�%��s�{�{�4�9�9�5�z�4�H�N�B��$(�7�4�a�t�A�w��4��7�(��t�y�y��}�g�F�F�F�)+��$8�F���
'��&��D�I�I�&���
��&��D�I�I�&��'�
�sQ�%C1�B.�0C1�.
B'�<B'�C1�B,� 
C1�.C.�C1�
C.�+C1�-C.�.C1c#��K�|�t�}n+t|t�rtd��t	t
|�}i}|D]/}t
||�D]\}}||vs�d||<t|||���� �1y�w)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�ir'r%s       rrr`s������|�"�$�	�	�D�#�	��%�&�	&���d�+�	��G�
��0��F�;�K�D�%��7�"� !���
� ��D�%�0�0�<��s�AA2�A2c�@�t|d�sgS|j|�S)Nr)�hasattrr)�importerr.s  rr7r7zs"���8�^�,��	�� � ��(�(rc#�K�|j�)tjj|j�syi}ddl}	tj|j�}|j
�|D]�}|j|�}|dk(s||vr�tjj|j|�}d}|s]tjj|�r>d|vr:|}	tj|�}	|	D]}|j|�}
|
dk(s�d}n��|s��d|vs��d||<||z|f����y#t
$rg}Y��wxYw#t
$rg}	Y�YwxYw�w)Nr�__init__Fr$Tr2)	r-�os�isdir�inspect�listdir�OSError�sort�
getmodulename�join)r=r.r9rB�	filenames�fn�modnamer-r%�dircontents�subnames           r�_iter_file_finder_modulesrM�sI�����}�}��B�G�G�M�M�(�-�-�$@���G����J�J�x�}�}�-�	��N�N�����'�'��+���J��'�W�"4���w�w�|�|�H�M�M�2�.�����2�7�7�=�=��.�3�b�=��G�
!� �j�j��.��"��!�/�/��3���J�&� �E��	"���s�'�)� �G�G���7�"�E�)�)�3�����	���"�
!� ��
!�s`�=E�D3�BE�#E�8E�E�E�"E�3E�>E�E�E�E�E�E�E)�zipimporterc#�
K�ttj|j�}|j}t|�}i}ddl}|D]�}|j|�s�||djtj�}t|�dk(r/|djd�r|d|vrd||d<||dzdf��t|�dk7r��|j|d�}|dk(r��|s��d|vs��||vs��d||<||zdf����y�w)	Nr�r2z__init__.pyTr?r$F)�sorted�	zipimport�_zip_directory_cache�archiver.�lenrB�
startswith�splitr@�seprF)	r=r.�dirlist�_prefix�plenr9rBrIrJs	         r�iter_zipimport_modulesr\�s������7�7��8H�8H�I�J���/�/���7�|������B��=�=��)���D�E�������(�B��2�w��z�b��e�.�.�}�=��a�5��'�%&�G�B�q�E�N� �2�a�5�.�$�.�.��2�w��z���+�+�B�q�E�2�G��
�"���3�g�-�'��2H�#$��� ��w�&��-�-�)�s�C%D�(D�-D�2Dc��tj|�}	tj|}|S#t$rVtj
D]=}	||�}tjj
||�Y|S#t$rY�;wxYwd}Y|SwxYw)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)r@�fsdecoder)�path_importer_cache�KeyError�
path_hooks�
setdefaultr+)�	path_itemr=�	path_hooks   rrr�s������I�&�I���*�*�9�5���O���	����I�
�$�Y�/���'�'�2�2�9�h�G��
�O��	�
��
��(��H��O�	�s3�,�B�	(A5�1B�5	B�>B�B�B�
Bc#�\K�|jd�rdj|�}t|��d|vr9|jd�d}t	j
|�}t
|dd�}|�)ytjEd{���tj}|D]}t|����y7�)�w)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.
    r$�'Relative module name {!r} not supportedrr#N)rV�formatr+�
rpartitionr�
import_moduler(r)�	meta_pathr-r)�fullname�msg�pkg_name�pkgr-�items      rrr�s��������3��7�>�>�x�H���#���
�h���&�&�s�+�A�.���%�%�h�/���s�J��-���<���=�=� � ��x�x�����4� � ��	!�s�A>B,�B*�*B,c�N�tjdtj�d�d��|tjvrtj|}|�yt|t�r8|}t|dd�}|�|St|dd��y|j}t|�S|}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__.
    zpkgutil.get_loader�(; use importlib.util.find_spec() instead�����removeN�
__loader__�__spec__)
�warnings�_deprecated�_DEPRECATED_MSGr)r*r3rr(�__name__r	)�module_or_name�module�loaderrks    rrr
s���
���-�$�4�4�5�6B�B� '�)�����$����^�4���!���.�*�-������t�4�����M��6�:�t�,�4���?�?���x� � �"���x� � rc	��tjdtj�d�d��|jd�rdj	|�}t|��	tjj|�}|�|jSdS#t
tttf$r-}d}t|j	|t|�|��|�d}~wwxYw)	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
    zpkgutil.find_loaderrqrrrur$rfz,Error while finding loader for {!r} ({}: {})N)ryrzr{rVrgr+rr�	find_spec�AttributeError�	TypeErrorr5�typer)rkrl�spec�exs    rr	r	&s���
���.�$�4�4�5�6B�B� '�)����3��7�>�>�x�H���#���F��~�~�'�'��1���*�4�;�;�4��4��

���J�?�F�=���#�*�*�X�t�B�x��<�=�2�E��F�s�B�C
� (C�C
c	���t|t�s|S|dz}|dd}|jd�\}}}|r	tj|j
}ntj}|D�]%}t|t�s�t|�}|�og}	t|d�r$|j|�}
|
�1|
jxsg}	n t|d�r|j|�\}}	|	D]}||vs�|j|��t jj#||�}t jj%|�s��	t'|�}
|
5|
D]8}|j)d�}|r|j+d�r�(|j|��:	ddd���(|S#ttf$r|cYSwxYw#1swY��LxYw#t,$r1}tj.j1d|�d	|�d��Yd}~���d}~wwxYw)
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.pkgNr$r�r	�
�#zCan't open z: )r3�listrhr)r*r#r`r�r-r4rr<r��submodule_search_locationsr	�appendr@rG�isfile�open�rstriprVrD�stderr�write)r-r'�	sname_pkg�parent_package�_�
final_name�search_path�dir�finder�portionsr��portion�pkgfile�f�linerls                rrr?s���B�d�D�!����v�
�I���7�D�$(�O�O�C�$8�!�N�A�z��	��+�+�n�5�>�>�K��h�h�����#�s�#���c�"�����H��v�{�+��'�'�
�3���#�#�>�>�D�"�H����/�$�0�0��<���8�#���$�&��K�K��(�	$��'�'�,�,�s�I�.��
�7�7�>�>�'�"�
*���M��
� !��#�{�{�4�0��#�t���s�';�$����D�)�	!"��Q�?�L�K��[�.�)�	��K�	��L�Q��	�
1��
�
� � �")�3�"0�1�1��
1�s5�F�7F4�>F'�F$�#F$�'F1	�4	G.�=&G)�)G.c��tjj|�}|�y|j}|�t	|d�syt
jj|�xstjj|�}|�t	|d�sy|jd�}|jdtjj|j��tjj |�}|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)rrr�rr<r)r*�get�
_bootstrap�_loadrW�insertr@r-�dirnamer�rGr)�package�resourcer�r�mod�parts�
resource_names       rrr�s���,�>�>�#�#�G�,�D��|��
�[�[�F�
�~�W�V�Z�8���;�;�?�?�7�#�,����%�%�d�+��
�{�'�#�z�2��

�N�N�3��E�	�L�L��B�G�G�O�O�C�L�L�1�2��G�G�L�L�%�(�M��?�?�=�)�)rc��t�)ddl}d}|jd|�d|�d�|j�atj	|�}|std|����|j
�}|jd�r?tj|d	�}|jd
�}|r|jd�ng}nq|jd�}|jd�}tj|�}|r8|d}|�d|��}		tj|	�}|jd�|	}|r�8|}
|D]}t|
|�}
�|
S#t$rY�"wxYw)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: �clnrn�objr$)�
_NAME_PATTERN�re�compile�UNICODE�matchr5�	groupdictr�rrirW�popr+r()r'r��dotted_wordsr!�gdr�r�rJr �s�results           r�resolve_namer��sY��B���5���
�
�Y�|�n�=7�7C�n�E�$K�#%�:�:�/�
�	���D�!�A���+�D�8�4�5�5�	
����B�	�v�v�e�}��%�%�b��i�0�����u�
��$)����C� �r���
�
�3����)�)�A�,���%�%�g�.����a��A��)�1�Q�C� �A�
��-�-�a�0���	�	�!����
��F�
�����#����M���
��
�s�;(D=�=	E	�E	)N�N)Nr�)r�)%�__doc__�collectionsr�	functoolsr�
simplegenericr�importlib.util�importlib.machineryr@�os.pathr)�typesrry�__all__rr
r
rr7rM�register�	machinery�
FileFinderrRrNr\r+rrrr	rrr�r�rrr�<module>r�s���$�"�5����	��
�������&@�
A�
�E�
��
 �6G�r1�4�)��)�&*�P���
���"�"�$=�?�#	��%�.�8�"�"�;�0F�G��2!�:!�85�2[�|(*�V�
�G��u�	��	�s� B=�=C�C