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__/prof.cpython-312.pyc

�

���g����dZ	ddlZddlmZddlZddlZddlZddlZddlm	Z	ddl
mZejd�Z
Gd�d	e	�Zy#e$rd\ZZY�FwxYw)
a/This plugin will run tests using the hotshot profiler, which is part
of the standard library. To turn it on, use the ``--with-profile`` option
or set the NOSE_WITH_PROFILE environment variable. Profiler output can be
controlled with the ``--profile-sort`` and ``--profile-restrict`` options,
and the profiler output file may be changed with ``--profile-stats-file``.

See the `hotshot documentation`_ in the standard library documentation for
more details on the various output options.

.. _hotshot documentation: http://docs.python.org/library/hotshot.html
�N)�stats)NN)�Plugin)�tolistznose.pluginsc�X�eZdZdZdZdZd�Zd�Zee�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zy)�ProfilezC
    Use this plugin to run tests using the hotshot profiler. 
    NFc	�:�|j�sytj|||�|jddd|j	dd�dd�	�|jd
ddd|j	d
�d��|jdddd|j	d�d��y)z&Register commandline options.
        Nz--profile-sort�store�profile_sort�NOSE_PROFILE_SORT�
cumulative�SORTz"Set sort order for profiler output)�action�dest�default�metavar�helpz--profile-stats-file�profile_stats_file�FILE�NOSE_PROFILE_STATS_FILEz;Profiler stats file; default is a new temp file on each run)rrrrrz--profile-restrict�append�profile_restrict�RESTRICT�NOSE_PROFILE_RESTRICTz?Restrict profiler output. See help for pstats.Stats for details)�	availabler�options�
add_option�get)�self�parser�envs   �@/opt/hc_python/lib/python3.12/site-packages/nose/plugins/prof.pyrzProfile.options!s����~�~������t�V�S�)����*�7��"%�'�'�*=�|�"L�"(�C�	�	E�	���0��3�"(�"%�'�'�*C�"D� 2�		�	3�	���.�x�1�",�"%�'�'�*A�"B� 5�		�	6�c��tduS�N)�hotshot)�clss r!rzProfile.available8s
���d�"�"r"c��|j�sy|j�tj|j�|_y)z5Create profile stats file and load profiler.
        N)r�
_create_pfiler%r�pfile�prof�rs r!�beginz
Profile.begin<s1���~�~��������O�O�D�J�J�/��	r"c�:�|j�sd|_ytj|||�||_|j
r|j
|_d|_nd|_d|_d|_|j|_
t|j�|_
y)zConfigure plugin.
        FNT)r�enabledr�	configure�confrr)�clean_stats_file�filenor
�sortrr�restrict)rrr0s   r!r/zProfile.configureDs����~�~�� �D�L������w��-���	��%�%� �3�3�D�J�$)�D�!��D�J�$(�D�!�����(�(��	��w�7�7�8��
r"c�~���j�sytjd|z��j|f�fd�	}|S)z6Wrap entire test run in :func:`prof.runcall`.
        Nzpreparing test %sc�J���j�|j||�yr$)r(�runcall)�resultr*�testrs   �r!�run_and_profilez,Profile.prepareTest.<locals>.run_and_profile\s������ ��L�L��v�&r")r�log�debugr*)rr9r:s`  r!�prepareTestzProfile.prepareTestVs:����~�~����	�	�%��,�-�)-����	'��r"c�\�tjd�|jj�t	j
|j�}|j|j�t|d�}|r|j}||_
ntj}|t_	|jr:tjd|j�|j|j�n|j�|r||_
y|t_y#|r||_
w|t_wxYw)z Output profiler report.
        zprinting profiler report�streamz"setting profiler restriction to %sN)r;r<r*�closer�loadr)�
sort_statsr3�hasattrr?�sys�stdoutr4�print_stats)rr?�
prof_stats�	compat_25�tmps     r!�reportzProfile.reportas���	�	�	�,�-��	�	�����Z�Z��
�
�+�
����d�i�i�(�
�J��1�	���#�#�C� &�J���*�*�C��C�J�
	!��}�}��	�	�>��
�
�N�&�
�&�&��
�
�6��&�&�(��$'�
�!� ��
���$'�
�!� ��
�s
�(AD�D+c�h�|j�sy	|jj�|jrM|j
r 	t
j|j
�	t
j|j�yy#t$rY�ewxYw#t$rY�<wxYw#t$rYywxYw)z5Clean up stats file, if configured to do so.
        N)
rr*r@�AttributeErrorr1r2�os�OSError�unlinkr))rr8s  r!�finalizezProfile.finalizes����~�~���	��I�I�O�O��� � ��{�{���H�H�T�[�[�)�
��	�	�$�*�*�%����	�
�		��������
���
�s5�B�B�&B%�	B�B�	B"�!B"�%	B1�0B1c�n�|js)tj�\|_|_d|_yy)NT)r)�tempfile�mkstempr2r1r+s r!r(zProfile._create_pfile�s-���z�z�&.�&6�&6�&8�#�D�K���$(�D�!�r")�__name__�
__module__�__qualname__�__doc__r)r1rr�classmethodr,r/r=rJrPr(�r"r!rrsF���
�E���6�.#��I�&�I�0�9�$	�!�<�0)r"r)rWr%r�ImportError�loggingrMrDrR�nose.plugins.baser�	nose.utilr�	getLoggerr;rrYr"r!�<module>r_sc��
� ����	�
��$���g����'��)�f�)��� ��N�G�U� �s�
A�
A�A

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