Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/coverage/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/coverage/__pycache__/misc.cpython-311.pyc

�

�܋f�/��|�UdZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlmZddlmZmZmZmZmZmZmZmZmZmZmZmZmZddlm Z ddl!m"Z"ddl#m$Z$dd	l!TiZ%d
e&d<dXd�Z'e'e��ZGd�d��Z(ej)dYd���Z*dZd�Z+d[d�Z,ed��Z-ed��Z.d\d�Z/d]d#�Z0d^d&�Z1d_d)�Z2d`d+�Z3d_d,�Z4dadbd/�Z5Gd0�d1��Z6dcd4�Z7Gd5�d6��Z8ddd:�Z9ded=�Z:dadfd@�Z;dgdC�Z<dhdF�Z=edGee�H��Z>	didjdO�Z?dkdldU�Z@dmdW�ZAdS)nz$Miscellaneous stuff for coverage.py.�)�annotationsN)�
ModuleType)
�Any�Callable�Dict�IO�Iterable�Iterator�List�Mapping�Optional�Sequence�Tuple�TypeVar�Union)�env)�CoverageException)�TArc)�*zDict[ModuleType, ModuleType]�ISOLATED_MODULES�modr�returnc�,�|tvrtj|j��}|t|<t	|��D]L}t||��}t
|tj��rt|��}t|||���Mt|S)aJCopy a module so that we are isolated from aggressive mocking.

    If a test suite mocks os.path.exists (for example), and then we need to use
    it during the test, everything will get tangled up if we use their mock.
    Making a copy of the module when we import it will isolate coverage.py from
    those complications.
    )	r�typesr�__name__�dir�getattr�
isinstance�isolate_module�setattr)r�new_mod�name�values    �`/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/coverage/misc.pyrr(s����"�"�"��"�3�<�0�0�� '������H�H�	*�	*�D��C��&�&�E��%��!1�2�2�
.�&�u�-�-���G�T�5�)�)�)�)��C� � �c�"�eZdZdZdd�Zdd�ZdS)�SysModuleSaverzASaves the contents of sys.modules, and removes new modules later.r�Nonec�B�ttj��|_dS�N��set�sys�modules�old_modules��selfs r$�__init__zSysModuleSaver.__init__?s���s�{�+�+����r%c�l�ttj��|jz
}|D]}tj|=�dS)z6Remove any modules imported since this object started.Nr+)r1�new_modules�ms   r$�restorezSysModuleSaver.restoreBs=���#�+�&�&��)9�9���	�	�A���A���	�	r%N�rr()r�
__module__�__qualname__�__doc__r2r6�r%r$r'r'=sB������K�K�,�,�,�,������r%r'�Iterator[None]c#�K�t��}	dV�|���dS#|���wxYw)z@A context manager to remove any modules imported during a block.N)r'r6)�savers r$�sys_modules_savedr?IsD����
���E��
����
�
�
��������
�
�������s	�,�A�modname�str�Tuple[ModuleType, bool]c���t��5	tj|��dfcddd��S#t$rtdfcYcddd��SwxYw#1swxYwYdS)a�Import a third-party module we need, but might not be installed.

    This also cleans out the module after the import, so that coverage won't
    appear to have imported it.  This lets the third party use coverage for
    their own tests.

    Arguments:
        modname (str): the name of the module to import.

    Returns:
        The imported module, and a boolean indicating if the module could be imported.

    If the boolean is False, the module returned is not the one you want: don't use it.

    TNF)r?�	importlib�
import_module�ImportErrorr-)r@s r$�import_third_partyrGSs��� 
�	�	���	��*�7�3�3�T�9�����������	�	�	���:���	��������	����������������s,�A�3�A�A�A�A�A�A�pairrc�0�|\}}||krd|zSd||fzS)z�Make a nice string representation of a pair of numbers.

    If the numbers are equal, just return the number, otherwise return the pair
    with a dash between them, indicating the range.

    z%dz%d-%dr;)rH�start�ends   r$�	nice_pairrLjs/���J�E�3���|�|��e�|���%���%�%r%�TSelf�TRetVal�fn�Callable[[TSelf], TRetVal]c�H���tjrd�jz�d��fd�}|S�S)	z�A decorator to indicate that a method shouldn't be called more than once.

    Normally, this does nothing.  During testing, this raises an exception if
    called more than once.

    �_once_r1rMrrNc���t|���rtd�j�d����t|�d���|��S)NzShouldn't have called z more than onceT)�hasattr�AssertionErrorrr )r1�attrrOs ��r$�_wrapperzexpensive.<locals>._wrapper�sQ����t�T�"�"�
\�$�%Z�b�k�%Z�%Z�%Z�[�[�[��D�$��%�%�%��2�d�8�8�Or%N)r1rMrrN)r�TESTINGr)rOrWrVs` @r$�	expensiverY{sK�����{�
��"�+�%��	�	�	�	�	�	�	�
���	r%�br�Optional[bool]c�(�|�dSt|��S)z"Return bool(b), but preserve None.N)�bool)rZs r$�bool_or_noner^�s���y��t��A�w�w�r%�regexes�
Iterable[str]c��t|��}t|��dkr|dSd�d�|D����S)zDCombine a series of regex strings into one that matches any of them.�r�|c3�"K�|]
}d|�d�V��dS)z(?:�)Nr;)�.0�rs  r$�	<genexpr>zjoin_regex.<locals>.<genexpr>�s*����4�4�q�
�a�
�
�
�4�4�4�4�4�4r%)�list�len�join)r_s r$�
join_regexrl�sI���7�m�m�G�
�7�|�|�q����q�z���x�x�4�4�G�4�4�4�4�4�4r%�pathr(c��	tj|��dS#t$r!}|jtjkr�Yd}~dSd}~wwxYw)z9Remove a file, and don't get annoyed if it doesn't exist.N)�os�remove�OSError�errno�ENOENT)rm�es  r$�file_be_goneru�s]���
�	�$������������7�e�l�"�"��#�"�"�"�"�"��������s��
A�>�A�	directoryc�:�|rtj|d���dSdS)zVMake sure the directory exists.

    If `directory` is None or empty, do nothing.
    T)�exist_okN)ro�makedirs)rvs r$�
ensure_dirrz�s1��
�.�
��I��-�-�-�-�-�-�.�.r%c�^�ttj�|����dS)z,Make sure the directory for the path exists.N)rzrorm�dirname)rms r$�ensure_dir_for_filer}�s$���r�w���t�$�$�%�%�%�%�%r%�outfile�Optional[IO[str]]c��|�tj}t|dd��p-ttjdd��pt	j��}|S)zHDetermine the encoding to use for output written to `outfile` or stdout.N�encoding)r-�stdoutr�
__stdout__�locale�getpreferredencoding)r~r�s  r$�output_encodingr��sP�����*�����T�*�*�	&����
�D�1�1�	&��#�%�%�
�
�Or%c�*�eZdZdZdd�Zdd�Zd
d	�Zd
S)�Hasherz&Hashes Python data for fingerprinting.rr(c�8�tjd��|_dS)N�sha3_256)�hashlib�new�hashr0s r$r2zHasher.__init__�s���K�
�+�+��	�	�	r%�vrc��|j�tt|�����d����t|t��r/|j�|�d�����n�t|t��r|j�|���nv|��nrt|ttf��r<|j�t|���d�����nt|ttf��r|D]}|�|���n�t|t��rW|���}t|��D]2}|�|��|�||���3nwt|��D]g}|�d��r�t!||��}t#j|��r�=|�|��|�|���h|j�d��dS)z+Add `v` to the hash, recursively if needed.zutf-8N�__�.)r��updaterA�type�encoder�bytes�int�float�tupleri�dict�keys�sortedr�
startswithr�inspect�	isroutine)r1r�rtr��k�as      r$r�z
Hasher.update�s���	����T�!�W�W���,�,�W�5�5�6�6�6��a����	��I���Q�X�X�g�.�.�/�/�/�/�
��5�
!�
!�	��I���Q�����
�Y��
��C��<�
(�
(�	��I���S��V�V�]�]�7�3�3�4�4�4�4�
��E�4�=�
)�
)�	��
�
�����A�����
�
��4�
 �
 �
	��6�6�8�8�D��D�\�\�
"�
"�����A�������A�a�D�!�!�!�!�
"���V�V�
�
���<�<��%�%����A�q�M�M���$�Q�'�'������A�������A������	��������r%rAc�D�|j���dd�S)z$Retrieve the hex digest of the hash.N� )r��	hexdigestr0s r$r�zHasher.hexdigest�s���y�"�"�$�$�S�b�S�)�)r%Nr7)r�rrr(�rrA)rr8r9r:r2r�r�r;r%r$r�r��sV������0�0�,�,�,�,�����<*�*�*�*�*�*r%r��that�	func_namec��t|d��r
d}|j}nd}|j}|j�d|j��}t|�d|�d|�d����)z7Helper to raise NotImplementedError in interface stubs.�_coverage_plugin_name�Plugin�Class�.� z needs to implement z())rTr��	__class__r8r�NotImplementedError)r�r��thingr"�klasss     r$�_needs_to_implementr��sv���t�,�-�-�6����)���������"�5�5�U�^�5�5��
��<�<�4�<�<�y�<�<�<���r%c�"�eZdZdZd	d�Zd
d�ZdS)�DefaultValuez�A sentinel object to use for unusual default-value needs.

    Construct with a string that will be used as the repr, for display in help
    and Sphinx output.

    �
display_asrArr(c��||_dSr*�r�)r1r�s  r$r2zDefaultValue.__init__s
��$����r%c��|jSr*r�r0s r$�__repr__zDefaultValue.__repr__s
����r%N)r�rArr(r�)rr8r9r:r2r�r;r%r$r�r��sF��������%�%�%�%������r%r��text�	variables�Mapping[str, str]c�P����d}d�d���fd�}tj||�����S)	a�Substitute ``${VAR}`` variables in `text` with their values.

    Variables in the text can take a number of shell-inspired forms::

        $VAR
        ${VAR}
        ${VAR?}             strict: an error if VAR isn't defined.
        ${VAR-missing}      defaulted: "missing" if VAR isn't defined.
        $$                  just a dollar sign.

    `variables` is a dictionary of variable values.

    Returns the resulting text with values substituted.

    a5(?x)   # Use extended regex syntax
        \$                      # A dollar sign,
        (?:                     # then
            (?P<dollar>\$) |        # a dollar sign, or
            (?P<word1>\w+) |        # a plain word, or
            {                       # a {-wrapped
                (?P<word2>\w+)          # word,
                (?:
                    (?P<strict>\?) |        # with a strict marker
                    -(?P<defval>[^}]*)      # or a default value
                )?                      # maybe.
            }
        )
        )�dollar�word1�word2�match�
re.Match[str]rrAc���td�|j��D����}|dkrdS|�vr�|S|drd|�d���}t|���|dS)zCalled for each $replacement.c3�K�|]}|�|V��	dSr*r;)rf�gs  r$rhz?substitute_variables.<locals>.dollar_replace.<locals>.<genexpr>,s'����@�@�!�a�@�A�@�@�@�@�@�@r%�$�strictz	Variable z is undefined: �defval)�next�groupr)r��word�msg�
dollar_groupsr�r�s   ���r$�dollar_replacez,substitute_variables.<locals>.dollar_replace)s�����@�@�{�u�{�M�:�@�@�@�@�@���3�;�;��3�
�Y�
�
��T�?�"�
�8�_�	#�;�d�;�;�4�;�;�C�#�C�(�(�(���?�"r%)r�r�rrA)�re�sub)r�r��dollar_patternr�r�s``  @r$�substitute_variablesr�sU����� 
�N�1�M�#�#�#�#�#�#�#�#��6�.�.�$�7�7�D��Kr%�dt�datetime.datetimec�P�|����d��S)z?Return a string with local timezone representing the date.
    z%Y-%m-%d %H:%M %z)�
astimezone�strftime)r�s r$�format_local_datetimer�;s!���=�=�?�?�#�#�$7�8�8�8r%�modfile�
Optional[str]c��|�|dz}tj�||��}|�J�tj�|��}|tj|<|j�J�|j�|��|S)z�Import a local file as a module.

    Opens a file in the current directory named `modname`.py, imports it
    as `modname`, and returns the module object.  `modfile` is the file to
    import if it isn't in the current directory.

    Nz.py)rD�util�spec_from_file_location�module_from_specr-r.�loader�exec_module)r@r��specrs    r$�import_local_filer�As�����E�/���>�1�1�'�7�C�C�D�����
�.�
)�
)�$�
/�
/�C��C�K����;�"�"�"��K���C� � � ��Jr%�s�List[Union[str, int]]c�N��dd���fd�tjd|��D��S)	z\Turn a string into a list of string and number chunks.
        "z23a" -> ["z", 23, "a"]
    r�rAr�Union[str, int]c�F�	t|��S#t$r|cYSwxYw)z6If `s` is a number, return an int, else `s` unchanged.)r��
ValueError)r�s r$�tryintz_human_key.<locals>.tryintYs6��	��q�6�6�M���	�	�	��H�H�H�	���s�� � c�&��g|]
}�|����Sr;r;)rf�cr�s  �r$�
<listcomp>z_human_key.<locals>.<listcomp>`s!���5�5�5�!�F�F�1�I�I�5�5�5r%z(\d+))r�rArr�)r��split)r�r�s @r$�
_human_keyr�Us?�������6�5�5�5�r�x��!�4�4�5�5�5�5r%�strings�	List[str]c�.�t|t���S)z�Sort the given iterable of strings the way that humans expect.

    Numeric components in the strings are sorted as numbers.

    Returns the sorted list.

    )�key)r�r�)r�s r$�human_sortedr�bs���'�z�*�*�*�*r%�SortableItem)�boundF�items�Iterable[SortableItem]�reverser]�List[SortableItem]c�(�t|d�|���S)z�Sort (string, ...) items the way humans expect.

    The elements of `items` can be any tuple/list. They'll be sorted by the
    first element (a string), with ties broken by the remaining elements.

    Returns the sorted list of items.
    c�D�t|d��g|dd��RS)Nrrb)r�)�items r$�<lambda>z$human_sorted_items.<locals>.<lambda>ys%��:�d�1�g�+>�+>�*J��a�b�b��*J�*J�r%)r�r�)r�)r�r�s  r$�human_sorted_itemsr�ns���%�J�J�T[�\�\�\�\r%��nr�r��thingsc� �|dkr|S|p|dzS)zZPluralize a word.

    If n is 1, return thing.  Otherwise return things, or thing+s.
    rbr�r;)r�r�rs   r$�pluralr|s!��
	�A�v�v����&�%�#�+�&r%�urlc��ttjd��r'tj���r	d|�d|�d�S|S)z�Format text+url as a clickable link for stdout.

    If attached to a terminal, use escape sequences. Otherwise, just return
    the text.
    �isattyz]8;;�z]8;;)rTr-r�r)r�rs  r$�stdout_linkr�sK���s�z�8�$�$����):�):�)<�)<��1�#�1�1��1�1�1�1��r%)rrrr)rr<)r@rArrB)rHrrrA)rOrPrrP)rZrrr[)r_r`rrA)rmrArr()rvrArr(r*)r~rrrA)r�rr�rArr()r�rAr�r�rrA)r�r�rrA)r@rAr�r�rr)r�rArr�)r�r`rr�)F)r�r�r�r]rr�)r�r�)r�r�r�rArrArrA)r�rArrArrA)Br:�
__future__r�
contextlib�datetimerrr�rD�importlib.utilr�r�ro�os.pathr�r-rr�typingrrrrr	r
rrr
rrrr�coverager�coverage.exceptionsr�coverage.typesrr�__annotations__rr'�contextmanagerr?rGrLrMrNrYr^rlrurzr}r�r�r�r�r�r�r�r�r�r�r�rrr;r%r$�<module>rs-��+�*�*�"�"�"�"�"�"�����������������������������
�
�
�
�	�	�	�	�����	�	�	�	�
�
�
�
�����������������������������������������
������1�1�1�1�1�1�������
"�!�!�!�13��3�3�3�3�!�!�!�!�$�^�B����	�	�	�	�	�	�	�	�������������.&�&�&�&�	������
�'�)�
�
������(����5�5�5�5�����.�.�.�.�&�&�&�&�
	�	�	�	�	�%*�%*�%*�%*�%*�%*�%*�%*�P������������0�0�0�0�f9�9�9�9������(6�6�6�6�+�+�+�+��w�~�X�c�]�;�;�;���]�]�]�]�]�'�'�'�'�'�	�	�	�	�	�	r%

Hacked By AnonymousFox1.0, Coded By AnonymousFox