Hacked By AnonymousFox

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

�

�܋f���8�dZddlmZddlZddlZddlZddlmZm	Z	m
Z
mZmZddl
mZddlmZmZddlmZmZmZddlmZmZmZdd	lmZdd
lmZmZddlm Z ddl!m"Z"m#Z#m$Z$m%Z%erdd
l
m&Z&ee��Zdd�Z'dd�Z(dd�Z)dd�Z*dd�Z+Gd�de ��Z,dS) z'Python source expertise for coverage.py�)�annotationsN)�Dict�Iterable�Optional�Set�
TYPE_CHECKING)�env)�CoverageException�NoSource)�canonical_filename�relative_filename�zip_location)�	expensive�isolate_module�
join_regex)�PythonParser)�source_token_lines�source_encoding)�FileReporter)�TArc�TLineNo�TMorf�TSourceTokenLines)�Coverage�filename�str�return�bytesc���t|d��5}|���}ddd��n#1swxYwY|�dd���dd��S)zFRead the Python source text from `filename`.

    Returns bytes.

    �rbNs
�
�
)�open�read�replace)r�f�sources   �b/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/coverage/python.py�read_python_sourcer)s���
�h��	�	����������������������������>�>�'�5�)�)�1�1�%��?�?�?s�2�6�6c���tj�|��\}}|dkrtjrddg}n|g}|D]J}||z}tj�|��rt
|��}n't|��}|�n�Ktd|�d����|�	dd��}|�
t|��d��}|r|d	d
kr|d
z
}|S)z#Return the source code, as unicode.�.pyz.pywNzNo source for code: 'z'.�� r%����
)�os�path�splitextr	�WINDOWS�existsr)�
get_zip_bytesrr%�decoder)r�base�ext�exts�try_filename�source_bytesr's       r(�get_python_sourcer<)s���� � ��*�*�I�D�#�
�e�|�|���|��v�����u���
=�
=���c�z��
�7�>�>�,�'�'�	�-�l�;�;�L��E�%�\�2�2���#��E�$��;�x�;�;�;�<�<�<� �'�'��t�4�4�L�
�
 �
 ���!>�!>�	�
J�
J�F���&��*��$�$��$����M��Optional[bytes]c���t|��}|�[|\}}	tj|��}n#tj$rYdSwxYw	|�|��}n#t
$rYdSwxYw|SdS)z�Get data from `filename` if it is a zip file path.

    Returns the bytestring data read from the zip file, or None if no zip file
    could be found or `filename` isn't in it.  The data returned will be
    an empty string if the file is empty.

    N)r�	zipimport�zipimporter�ZipImportError�get_data�OSError)r�
zipfile_inner�zipfile�inner�zi�datas      r(r5r5Ls���!��*�*�M�� �&����	��&�w�/�/�B�B���'�	�	�	��4�4�	����	��;�;�u�%�%�D�D���	�	�	��4�4�	�������4s �-�A�A�A�
A(�'A(c��|�d��r|S|�d��r_|dd�}tj�|��r|Stjr&|dz}tj�|��r|S|S|S)z�Return the source filename for `filename`.

    Given a file name being traced, return the best guess as to the source
    file to attribute it to.

    r+)z.pycz.pyoNr.�w)�endswithr0r1r4r	r3)r�py_filename�pyw_filenames   r(�source_for_filerOcs������������	�	�	�+�	,�	,���s��s�m��
�7�>�>�+�&�&�	����;�	$�&��,�L��w�~�~�l�+�+�
$�#�#����Or=�morfrc��t|d��r|jr|j}n/t|tj��rtd|�d����|}t
|��}|S)z6Get the source filename for the module-or-file `morf`.�__file__zModule z has no file)�hasattrrR�
isinstance�types�
ModuleTyper
rO)rPrs  r(�source_for_morfrW�sn���t�Z� � ��T�]���=���	�D�%�*�	+�	+�� � <�$� <� <� <�=�=�=����x�(�(�H��Or=c����eZdZdZd(d)�fd	�
Zd*d�Zd*d�Zed+d���Zd,d�Z	d,d�Z
d-d�Zd.d�Ze
d,d���Ze
d/d���Ze
d0d���Z	d(d1d"�Zd*d#�Zd2d%�Zd3d'�Z�xZS)4�PythonFileReporterz!Report support for a Python file.NrPr�coverage�Optional[Coverage]r�Nonec�(��||_t|��}|}d}|j�|jjjrd}|rt	|��}t���|��t|d��ro|j�	dtj��}tj�
|���d��r|tjdzz
}|dz
}nt|��}||_d|_d|_d|_dS)NTF�__name__�.z	__init__.�__init__r+)rZrW�config�relative_filesr�superr`rSr^r%r0�sepr1�basename�
startswithr
�relname�_source�_parser�	_excluded)�selfrPrZr�fname�canonicalize�name�	__class__s       �r(r`zPythonFileReporter.__init__�s��� ��
�"�4�(�(�������=�$��}�#�2�
%�$���	1�&�x�0�0�E�
����������4��$�$�	/��=�(�(��b�f�5�5�D��w����)�)�4�4�[�A�A�
,�����+�+���E�M�D�D�$�X�.�.�D����&*���/3�������r=rc��d|j�d�S)Nz<PythonFileReporter �>)r�rks r(�__repr__zPythonFileReporter.__repr__�s��8�d�m�8�8�8�8r=c��|jS�N)rgrrs r(r
z$PythonFileReporter.relative_filename�s
���|�r=rc���|j�J�|j�Lt|j|j�d�����|_|j���|jS)z&Lazily create a :class:`PythonParser`.N�exclude)rrw)rZrirr�_exclude_regex�parse_sourcerrs r(�parserzPythonFileReporter.parser�sf���}�(�(�(��<��'����
�4�4�Y�?�?����D�L�
�L�%�%�'�'�'��|�r=�Set[TLineNo]c��|jjS�z2Return the line numbers of statements in the file.)rz�
statementsrrs r(�lineszPythonFileReporter.lines�s
���{�%�%r=c��|jjSr})rz�excludedrrs r(�excluded_linesz!PythonFileReporter.excluded_lines�s
���{�#�#r=r�Iterable[TLineNo]c�6�|j�|��Sru)rz�translate_lines)rkrs  r(r�z"PythonFileReporter.translate_lines�s���{�*�*�5�1�1�1r=�arcs�Iterable[TArc]�	Set[TArc]c�6�|j�|��Sru)rz�translate_arcs)rkr�s  r(r�z!PythonFileReporter.translate_arcs�s���{�)�)�$�/�/�/r=c��|j�J�|j�t|jjj��t|jjj����}|Sru)rZrz�lines_matchingrra�partial_list�partial_always_list)rk�	no_branchs  r(�no_branch_linesz"PythonFileReporter.no_branch_lines�sU���}�(�(�(��K�.�.��t�}�+�8�9�9��t�}�+�?�@�@�
�
�	��r=c�4�|j���Sru)rzr�rrs r(r�zPythonFileReporter.arcs�s���{���!�!�!r=�Dict[TLineNo, int]c�4�|j���Sru)rz�exit_countsrrs r(r�zPythonFileReporter.exit_counts�s���{�&�&�(�(�(r=�startr�end�
executed_arcs�Optional[Iterable[TArc]]c�:�|j�|||��Sru)rz�missing_arc_description)rkr�r�r�s    r(r�z*PythonFileReporter.missing_arc_description�s���{�2�2�5�#�}�M�M�Mr=c�P�|j�t|j��|_|jSru)rhr<rrrs r(r'zPythonFileReporter.source�s#���<��,�T�]�;�;�D�L��|�r=�boolc��tj�|j��\}}|�d��rdS|sdSdS)z�Does it seem like this file should contain Python?

        This is used to decide if a file reported as part of the execution of
        a program was really likely to have contained Python in the first
        place.

        r+TF)r0r1r2rrf)rk�_r8s   r(�should_be_pythonz#PythonFileReporter.should_be_python�sL����!�!�$�-�0�0���3��>�>�%� � �	��4��	��4��ur=rc�D�t|�����Sru)rr'rrs r(rz%PythonFileReporter.source_token_lines�s��!�$�+�+�-�-�0�0�0r=ru)rPrrZr[rr\)rr)rr)rr{)rr�rr{)r�r�rr�)rr�)rr�)r�rr�rr�r�rr)rr�)rr)r^�
__module__�__qualname__�__doc__r`rsr
�propertyrzrr�r�r�rr�r�r�r�r'r�r�
__classcell__)ros@r(rYrY�s��������+�+��������69�9�9�9������	�	�	��X�	�&�&�&�&�$�$�$�$�2�2�2�2�0�0�0�0������Y���"�"�"��Y�"��)�)�)��Y�)�37�	N�N�N�N�N�����
����(1�1�1�1�1�1�1�1r=rY)rrrr)rrrr)rrrr>)rPrrr)-r��
__future__r�os.pathr0rUr@�typingrrrrrrZr	�coverage.exceptionsr
r�coverage.filesrr
r�
coverage.miscrrr�coverage.parserr�coverage.phystokensrr�coverage.pluginr�coverage.typesrrrrrr)r<r5rOrWrY�r=r(�<module>r�s���.�-�"�"�"�"�"�"�������������?�?�?�?�?�?�?�?�?�?�?�?�?�?�������;�;�;�;�;�;�;�;�N�N�N�N�N�N�N�N�N�N�?�?�?�?�?�?�?�?�?�?�(�(�(�(�(�(�C�C�C�C�C�C�C�C�(�(�(�(�(�(�B�B�B�B�B�B�B�B�B�B�B�B��"�!�!�!�!�!�!��^�B����	@�	@�	@�	@� � � � �F����.����:����q1�q1�q1�q1�q1��q1�q1�q1�q1�q1r=

Hacked By AnonymousFox1.0, Coded By AnonymousFox