PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/hc_python/lib/python3.12/site-packages/nose/plugins/__pycache__/
Upload File :
Current File : //opt/hc_python/lib/python3.12/site-packages/nose/plugins/__pycache__/cover.cpython-312.pyc

�

���g�-��~�dZddlZddlZddlZddlZddlmZddlmZm	Z	eje�ZGd�de�Z
y)a�If you have Ned Batchelder's coverage_ module installed, you may activate a
coverage report with the ``--with-coverage`` switch or NOSE_WITH_COVERAGE
environment variable. The coverage report will cover any python source module
imported after the start of the test run, excluding modules that match
testMatch. If you want to include those modules too, use the ``--cover-tests``
switch, or set the NOSE_COVER_TESTS environment variable to a true value. To
restrict the coverage report to modules from a particular package or packages,
use the ``--cover-package`` switch or the NOSE_COVER_PACKAGE environment
variable.

.. _coverage: http://www.nedbatchelder.com/code/modules/coverage.html
�N)�Plugin)�src�tolistc�h��eZdZdZdZdZdZdZdZdZ	iZ
�fd�Z�fd�Zd�Z
d�Zd	�Zd
�Zdd�Z�xZS)
�CoveragezL
    Activate a coverage report using Ned Batchelder's coverage module.
    FN��c���tt|�||�|jdd|j	d�ddd��|jdd	|j	d
�dd�
�|jdd	d|j	d�d��|jddd|j	d�d��|jdd	d|j	d�d��|jdd	|j	d�dd�
�|jd d|j	d!d"�d#d$d%�&�|jd'd	|j	d(�d)d*�
�|jd+d	|j	d,�d-d.�
�|jd/d|j	d0d1�d2d3d4�&�y5)6z.
        Add options to command line.
        z--cover-package�append�NOSE_COVER_PACKAGE�PACKAGE�cover_packageszBRestrict coverage output to selected packages [NOSE_COVER_PACKAGE])�action�default�metavar�dest�helpz
--cover-erase�
store_true�NOSE_COVER_ERASE�cover_erasez9Erase previously collected coverage statistics before run)rrrrz
--cover-tests�cover_tests�NOSE_COVER_TESTSz:Include test modules in coverage report [NOSE_COVER_TESTS])rrrrz--cover-min-percentage�store�cover_min_percentage�NOSE_COVER_MIN_PERCENTAGEzLMinimum percentage of coverage for tests to pass [NOSE_COVER_MIN_PERCENTAGE]z--cover-inclusive�cover_inclusive�NOSE_COVER_INCLUSIVEz�Include all python files under working directory in coverage report.  Useful for discovering holes in test coverage if not all files are imported by the test suite. [NOSE_COVER_INCLUSIVE]z--cover-html�NOSE_COVER_HTML�
cover_htmlz!Produce HTML coverage informationz--cover-html-dir�NOSE_COVER_HTML_DIR�cover�cover_html_dir�DIRz(Produce HTML coverage information in dir)rrrrrz--cover-branches�NOSE_COVER_BRANCHES�cover_branchesz@Include branch coverage in coverage report [NOSE_COVER_BRANCHES]z--cover-xml�NOSE_COVER_XML�	cover_xmlz Produce XML coverage informationz--cover-xml-file�NOSE_COVER_XML_FILEzcoverage.xml�cover_xml_file�FILEz(Produce XML coverage information in fileN)�superr�options�
add_option�get)�self�parser�env�	__class__s   ��A/opt/hc_python/lib/python3.12/site-packages/nose/plugins/cover.pyr+zCoverage.options#s����	�h��%�f�c�2����+�H�"%�'�'�*>�"?�"+�/� 1�		�	2�	���/�,�"%�'�'�*<�"=�,� 2�	�	3�
	���/�,�,�"%�'�'�*<�"=� /�	�	0�
	���2�7�5�"%�'�'�*E�"F� @�	�	A�
	���-�l�0�"%�'�'�*@�"A� 3�	�	4�	���.��"%�'�'�*;�"<�+�B�	�	D�	���,�W�"%�'�'�*?��"I�/�"'�I�		�	K�
	���,�\�"%�'�'�*?�"@�/� 2�	�	3�
	���-��"%�'�'�*:�";�*�A�	�	C�	���,�W�"%�'�'�*?��"P�/�"(�I�		�	K�c���	|jjd�tt|�||�|jr	ddl}t|d�std��	||_|j|_|j|_g|_|j$rst'|j$t(t*f�r
|j$}n
|j$g}|D�cgc]
}t-|���c}D]}|j"j/|��|j0|_|j"r tj5d|j"�d|_|j8r1|j:|_tj=d	|j6�|j>|_ d|_!|jDr)tG|jDjId
��|_%|jLr1|jN|_!tj=d|jB�|j�rsd|jd<jd|j@|jP|j"�
�|_)d|jR_*|jP|jR_+|jRjYd�tj=d�t)tZj\j_��dd|_0|jrItj=d�|jRjc�|jRje�|jRjVs5|jRjg�|jRji�yyy#t$rY���wxYw#t$rtjd�d|_YywxYwcc}w)z#
        Configure plugin.
        �activerN�coveragez Unable to import coverage modulez8Coverage not available: unable to import coverage moduleFz.Coverage report will include only packages: %sz#Will put HTML coverage report in %s�%z"Will put XML coverage report in %sT)�	auto_data�branch�data_suffix�sourcez)#pragma[: ]+[nN][oO] [cC][oO][vV][eE][rR]zCoverage beginz1Clearing previously collected coverage statistics)5�status�pop�KeyErrorr*r�	configure�enabledr6�hasattr�ImportError�log�error�confr�
coverEraser�
coverTests�
coverPackagesr
�
isinstance�list�tupler�extendr�coverInclusive�info�coverHtmlDirrr!�debugr$�
coverBranches�coverXmlFiler�int�rstrip�coverMinPercentager&r(�worker�
coverInstance�
_warn_no_data�	is_worker�exclude�sys�modules�keys�skipModules�combine�erase�load�start)r.r+rEr6r
�x�pkgsr1s       �r2r?zCoverage.configure]s���	��K�K�O�O�H�%�	�h��'���6��<�<�
���x��4�%�&H�I�I�5���	�!�-�-���!�-�-�������!�!��'�0�0�4��-�@�!(�!7�!7��")�"8�"8�!9��,:�;�N�q����N�;���"�"�)�)�$�/�<�%�5�5�������H�H�E��'�'�
)� ������ '� 6� 6�D���I�I�;�T�=N�=N�O�$�3�3��� ����'�'�&)�'�*F�*F�*M�*M�c�*R�&S�D�#���� '� 6� 6�D���I�I�:�D�<M�<M�N��<�<�$(�D�K�K��!�!)�!2�!2�U��)�)�t�{�{��)�)�"3�"+�D��05�D���,�+/�;�;�D���(����&�&�'R�S��I�I�&�'�#�C�K�K�$4�$4�$6�7��:�D������	�	�M�N��"�"�*�*�,��"�"�(�(�*��%�%�/�/��"�"�'�'�)��"�"�(�(�*�0�!��O�	��	���
��	�	�=�>�$����	
��<s(�N�N&�O�	N#�"N#�&%O�
Oc��|jjr5|jj�|jj�yy)z7
        Begin recording coverage information.
        N)rWrYrarb�r.�args�kwargss   r2�
beforeTestzCoverage.beforeTest�s<��
���'�'����#�#�%����$�$�&�(r3c��|jjr5|jj�|jj�yy)z6
        Stop recording coverage information.
        N)rWrY�stop�saverfs   r2�	afterTestzCoverage.afterTest�s<��
���'�'����#�#�%����#�#�%�(r3c�(�tjd�|jj�|jj	�|jj�t
tjj��D��cgc]\}}|j||�r|��}}}tjd|�|jj||��ddl}|jr<tjd�	|jj||j�|j&r<tjd�	|jj)||j&�|j*r�t-j.�}|jj||��d
}d}	t1j2||j5��}
|
�$t1j2|	|j5��}
|
rdt7|
j9�d�}||j*kr8tj;d|j*z�tj<d
�yytj;d�yycc}}w#|jj $r,}tj#dt%|�z�Yd}~���d}~wwxYw#|jj $r,}tj#d	t%|�z�Yd}~���d}~wwxYw)z.
        Output code coverage report.
        zCoverage reportz&Coverage report will cover modules: %s)�filerNzGenerating HTML coverage reportz"Failed to generate HTML report: %szGenerating XML coverage reportz!Failed to generate XML report: %sz@-------\s\w+\s+\d+\s+\d+(?:\s+\d+\s+\d+)?\s+(\d+)%\s+\d*\s{0,1}$zM-------\s[\w./]+\s+\d+\s+\d+(?:\s+\d+\s+\d+)?\s+(\d+)%(?:\s+[-\d, ]+)\s{0,1}$z3TOTAL Coverage did not reach minimum required: %d%%�zGNo total percentage was found in coverage output, something went wrong.)rCrPrWrkr_rlrJr[r\�items�wantModuleCoverage�reportr6rO�html_report�misc�CoverageException�warning�strrR�
xml_reportrU�io�StringIO�re�search�getvaluerS�groupsrD�exit)r.�stream�name�moduler\r6�e�f�multiPackageRe�singlePackageRe�m�
percentages            r2rszCoverage.report�s}��	�	�	�#�$������!����"�"�$������!�(,�S�[�[�->�->�-@�(A�>�(A���f��.�.�t�V�<��(A�	�>�	�	�	�:�G�D����!�!�'��!�7������I�I�7�8�
K��"�"�.�.�w��8I�8I�J�����I�I�6�7�
J��"�"�-�-�g�t�7H�7H�I�
�"�"����
�A����%�%�g�A�%�6�9�N� C�O��	�	�.�!�*�*�,�7�A��y��I�I�o�q�z�z�|�<��� �����A��/�
��� 7� 7�7��I�I�/�15�1H�1H�I�J��H�H�Q�K�8�
�	�	�2�3�)#��->���=�=�2�2�
K����@�3�q�6�I�J�J��
K���=�=�2�2�
J����?�#�a�&�H�I�I��
J�s6�I>�&J�&K�K	�!K�K	�L�%!L�Lc���t|d�stjd|�yt|j�}|r|jd�stjd|�y|jr�|jD]x}tjdtj|�z|�s�0|js&|jjj|�r�btjd|�y||jvrtjd	|�y|jjj|�r#|jstjd
|�y|jS)N�__file__zno coverage of %s: no __file__F�.pyz$no coverage of %s: not a python filez^%s\bzcoverage for %sTz0no coverage for %s: loaded before coverage startzno coverage for %s: is a test)rArCrPrr��endswithrHr|�findall�escaperGrE�	testMatchr}r^)r.r�r��module_file�packages     r2rrzCoverage.wantModuleCoverage�s���v�z�*��I�I�6��=���&�/�/�*���+�"6�"6�u�"=��I�I�<�d�C������-�-���J�J�x�"�)�)�G�*<�<�d�C���� $�	�	� 3� 3� :� :�4� @��I�I�/��6��.��4�#�#�#��I�I�H��
���9�9���%�%�d�+�D�O�O��I�I�5�t�<���%�%�%�%r3c��|jrE|jd�r4|r1|jr%|jD]}|j|�s�yyyy)zdIf inclusive coverage enabled, return true for all source files
        in wanted packages.
        r�TN)rMr�rH�
startswith)r.ror��wants    r2�wantFilezCoverage.wantFilesR������}�}�U�#��t�1�1� $� 2� 2��"�-�-�d�3�#'�!3�
� �r3)N)�__name__�
__module__�__qualname__�__doc__rGrHrWrFrU�scorer<r+r?rirmrsrrr��
__classcell__)r1s@r2rrsU�����J��M��M��J����E�
�F�8K�t?+�D'�&�33�l&�6r3r)r��loggingr|r[rz�nose.plugins.baser�	nose.utilrr�	getLoggerr�rCr�r3r2�<module>r�s>����	�
�	�$�!��g����!��x�v�xr3

if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic