Sindbad~EG File Manager
�
'Μg�<���ddlZddlZddlZddlZddlmZddlmZddlmZdZ dZ
Gd�d�ZGd �d
ej�Z
edk(rej�yy)�N)�dedent)�captured_stdout)�captured_stderri@B�c�0�eZdZdZdd�Zd�Zd�Zd�Zd�Zy) � FakeTimergE@c�D�d|_d|_||_|t_y)Nr)�count�setup_calls�seconds_per_increment�timeit�_fake_timer)�selfrs �-/usr/local/lib/python3.12/test/test_timeit.py�__init__zFakeTimer.__init__s!����
����#8��"�!���c�N�|j|j|jzzS�N)� BASE_TIMEr
r�rs r�__call__zFakeTimer.__call__s ���~�~��
�
�T�-G�-G� G�G�Grc�.�|xjdz
c_y�N�)r
rs r�incz
FakeTimer.inc!s���
�
�a��
rc�.�|xjdz
c_yr)rrs r�setupzFakeTimer.setup$s�����A��rc�� ||_|Sr)�saved_timer)r�timers r�
wrap_timerzFakeTimer.wrap_timer's��A� ����rN)��?) �__name__�
__module__�__qualname__rrrrrr!�rrrrs!���I�"�H���rrc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d Zd
Zd�Z
d�Zd8d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd8d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z!d!Z"d9d"�Z#d#�Z$d$�Z%d%�Z&d&�Z'd'�Z(d(�Z)d)�Z*d*�Z+d+�Z,e-j\e/j`jbd,k\d-�d.��Z2d/�Z3d0�Z4d1�Z5d2�Z6d3�Z7d:d4�Z8d5�Z9d6�Z:d7�Z;y
);�
TestTimeitc�0� t`y#t$rYywxYwr)r
r�AttributeErrorrs r�tearDownzTestTimeit.tearDown.s�� ��"��� �� �s� � �c��|jtjdd�d�|jtjdd�d�y)N�r���assertEqualr
�reindentrs r�test_reindent_emptyzTestTimeit.test_reindent_empty4s8���������Q�/��4��������Q�/��4rc��|jtjdd�d�|jtjdd�d�y)N�passrr.r/rs r�test_reindent_singlezTestTimeit.test_reindent_single8s8����������3�V�<���������3�V�<rc��|jtjdd�d�|jtjdd�d�y)Nz
rr.z
r/rs r�test_reindent_multi_emptyz$TestTimeit.test_reindent_multi_empty<s8����������3�V�<���������3�^�Drc��|jtjdd�d�|jtjdd�d�y)Nzprint()
pass
breakrr.zprint()
pass
breakr/rs r�test_reindent_multizTestTimeit.test_reindent_multi@sF��������"�A�'�"� $�
������"�A�'�*� ,rc��|jttjd��|jttjd��|jttjd��|jttjd��|jttjd��|jttjd��|jttjd��|jttjd��|jttjd d
��y)N��stmt�return�yield�
yield from ()�break�continue�from timeit import *� passzwhile False:
passz break)rr<��assertRaises�
ValueErrorr
�Timer�SyntaxErrorrs r�test_timer_invalid_stmtz"TestTimeit.test_timer_invalid_stmtHs������*�f�l�l���>����+�v�|�|�(��C����+�v�|�|�'��B����+�v�|�|�/��J����+�v�|�|�'��B����+�v�|�|�*��E����+�v�|�|�:P��Q����+�v�|�|�(��C����+�v�|�|� 6�Y� � Hrc�d�|jttjd��|jttjd��|jttjd��|jttjd��|jttjd��|jttjd��|jttjd��|jttjd��y) N)rr=r>r?r@rArBrCrDrs r�test_timer_invalid_setupz#TestTimeit.test_timer_invalid_setupTs������*�f�l�l�$��?����+�v�|�|�8��D����+�v�|�|�7��C����+�v�|�|�?��K����+�v�|�|�7��C����+�v�|�|�:��F����+�v�|�|�;Q��R����+�v�|�|�8��Drc��tjd��tjd��tjd��y)Nr-r;z
z # comment)r
rGrs r�test_timer_empty_stmtz TestTimeit.test_timer_empty_stmt^s&�����"�����)�$����+�&rz(import timeit
timeit._fake_timer.setup()z&import timeit
timeit._fake_timer.inc()c�8�|jj�yr)�
fake_timerrrs r�fake_callable_setupzTestTimeit.fake_callable_setupfs�������rc�8�|jj�yr)rOrrs r�fake_callable_stmtzTestTimeit.fake_callable_stmtis�������rNc�h�t�|_tj|||j|��}i}|�t}n||d<|jdi|��}|j|jjd�|j|jj|�|j||�y)N)r<rr �globals�numberrr&)rrOr
rG�DEFAULT_NUMBERr0rr
)rr<rrUrT�t�kwargs�
delta_times rr
zTestTimeit.timeitls���#�+����L�L�d�%�t����
!�����>�#�F�%�F�8���Q�X�X�'��'�
�������4�4�a�8�������.�.��7�����V�,rc�T�|j|j|jd��y�Nr�rU�r
� fake_stmt�
fake_setuprs r�test_timeit_zero_itersz!TestTimeit.test_timeit_zero_iters~������D�N�N�D�O�O�A��>rc�T�|j|j|jd��y�N�r\r]rs r�test_timeit_few_itersz TestTimeit.test_timeit_few_iters�rarc�T�|j|j|jd��yrc)r
rRr_rs r�test_timeit_callable_stmtz$TestTimeit.test_timeit_callable_stmt�s�����D�+�+�T�_�_�Q��Grc�T�|j|j|jd��yrc)r
r^rPrs r�test_timeit_callable_setupz%TestTimeit.test_timeit_callable_setup�s�����D�N�N�D�$<�$<�Q��Grc�T�|j|j|jd��yrc)r
rRrPrs r�#test_timeit_callable_stmt_and_setupz.TestTimeit.test_timeit_callable_stmt_and_setup�s&�����D�+�+��(�(�� � 4rc��tj|j|jdt���}|j |d�y)Nr�rUr )r
r^r_rr0)rrYs r�test_timeit_function_zero_itersz*TestTimeit.test_timeit_function_zero_iters�s3���]�]�4�>�>�4�?�?�1��k�#�
�����Q�'rc�2�t�atjdt��}|j t
|jd��tjdtt
�d��t�}tjd|t�d��y)Nz_global_timer.inc())r<r rdr\)r<r rTrUzlocal_timer.inc())r�
_global_timerr
rGrE� NameErrorrT�locals)rrW�local_timers r�test_timeit_globals_argsz#TestTimeit.test_timeit_globals_args�sj��!��
��L�L�3�=�I�����)�Q�X�X�a��8��
�
�0�
�%�i�� 3��k���
�
�.�k�$�h�q� 2rc��t�|_tj|||j��}i}|�t}n||d<|�t
}n||d<|jdi|��}|j|jj|�|j|jj||z�|j||t|�gz�y)N�r<rr �repeatrUr&)rrOr
rG�DEFAULT_REPEATrVrwr0rr
�float)rr<rrwrUrWrX�delta_timess rrwzTestTimeit.repeat�s���#�+����L�L�d�%�t���G�����>�#�F�%�F�8���>�#�F�%�F�8���a�h�h�(��(��������4�4�f�=�������.�.����@�����f��f�
��&>�?rc�T�|j|j|jd��y)Nr)rw�rwr^r_rs r�test_repeat_zero_repsz TestTimeit.test_repeat_zero_reps�rarc�T�|j|j|jd��yr[r|rs r�test_repeat_zero_itersz!TestTimeit.test_repeat_zero_iters�rarc�V�|j|j|jdd��y�Nrdr)rwrUr|rs r�test_repeat_few_reps_and_itersz)TestTimeit.test_repeat_few_reps_and_iters�s�����D�N�N�D�O�O�A�a��Hrc�V�|j|j|jdd��yr�)rwrRr_rs r�test_repeat_callable_stmtz$TestTimeit.test_repeat_callable_stmt�s&�����D�+�+�T�_�_��� � $rc�V�|j|j|jdd��yr�)rwr^rPrs r�test_repeat_callable_setupz%TestTimeit.test_repeat_callable_setup�s&�����D�N�N�D�$<�$<��� � $rc�V�|j|j|jdd��yr�)rwrRrPrs r�#test_repeat_callable_stmt_and_setupz.TestTimeit.test_repeat_callable_stmt_and_setup�s(�����D�+�+�T�-E�-E��� � $rc��tj|j|jdt ���}|j|g�y)Nr)rwr )r
rwr^r_rr0�rrzs r�test_repeat_function_zero_repsz)TestTimeit.test_repeat_function_zero_reps�s3���m�m�D�N�N�D�O�O�A��k�#������b�)rc��tj|j|jdt ���}|j|tdgz�y)Nrrmg)r
rwr^r_rr0rxr�s r�test_repeat_function_zero_itersz*TestTimeit.test_repeat_function_zero_iters�s:���m�m�D�N�N�D�O�O�A��k�#������n��u�&<�=rc���|j�}|jt|�d�|j|dj d��|j|dj |��y)N�r� Traceback���)�
splitlines�
assertGreater�len�
assertTrue�
startswith)r�
exc_string�expected_exc_name� exc_liness r�assert_exc_stringzTestTimeit.assert_exc_string�s[���)�)�+� ����3�y�>�1�-���� �!��/�/��<�=���� �"�
�0�0�1B�C�Drc���tj�}tjd�} |j�|j|j
�d�y#|j |�Y�6xYw)N�1/0�ZeroDivisionError)�io�StringIOr
rG� print_excr��getvalue)r�srWs r�test_print_exczTestTimeit.test_print_exc�sT���K�K�M���L�L���� �
�H�H�J�
���q�z�z�|�-@�A�� �
�K�K��N�s�A�A1z"1 loop, best of 5: 1 sec per loop
c�Z�|�t|��}|�g}n|dd}|j|j�tjdd}t�5}t
j||j��ddd�|ddtjddj�S#1swY�/xYw)N�r)�args�_wrap_timer)
r�appendr^�sys�pathrr
�mainr!r�)rr�switchesr r��
orig_sys_pathr�s r�run_mainzTestTimeit.run_main�s����=��4I�J�E����D��A�;�D����D�N�N�#������
�
�
�!��K�K�T�u�/?�/?�@��#�A�&�������z�z�|���
�s�"B!�!B*c�`�|jdg��}|j|td��y)Nz--bad-switch�r�zk option --bad-switch not recognized
use -h/--help for command line help
�r�r0r�rr�s r�test_main_bad_switchzTestTimeit.test_main_bad_switch�s1���M�M�N�#3�M�4������F�$�� rc�L�|jd��}|j|d�y)Ng@r�z$1 loop, best of 5: 5.5 sec per loop
�r�r0r�s r�test_main_secondszTestTimeit.test_main_secondss#���M�M��M�4������C�Drc�L�|jd��}|j|d�y)Ng�I+�v?r�z'50 loops, best of 5: 5.5 msec per loop
r�r�s r�test_main_millisecondsz!TestTimeit.test_main_milliseconds s#���M�M��M�7������F�Grc�P�|jddg��}|j|d�y)Ng�h㈵��>z-n100�rr�z(100 loops, best of 5: 2.5 usec per loop
r�r�s r�test_main_microsecondsz!TestTimeit.test_main_microseconds
s'���M�M� �W�I�M�N������G�Hrc�P�|jddg��}|j|d�y)N�@�-n35r��$35 loops, best of 5: 2 sec per loop
r�r�s r�test_main_fixed_itersz TestTimeit.test_main_fixed_iterss'���M�M��v�h�M�G������C�Drc�f�|jdgd���}|j|dtzdz�y)Nr�)r��-szprint("CustomSetup")r��CustomSetup
r��r�r0rxr�s r�test_main_setupzTestTimeit.test_main_setups:���M�M��?�
�
A������O�n�<�7�8� 9rc�f�|jdgd���}|j|dtzdz�y)Nr�)r�r�za = "CustomSetup"r�zprint(a)r�r�r�r�r�s r�test_main_multiple_setupsz$TestTimeit.test_main_multiple_setupss:���M�M��N�
�
P������O�n�<�7�8� 9rc�P�|jddg��}|j|d�y)N�N@z-r9r�z#1 loop, best of 9: 60 sec per loop
r�r�s r�test_main_fixed_repszTestTimeit.test_main_fixed_reps!s'���M�M���w�M�G������B�Crc�P�|jddg��}|j|d�y)Nr�z-r-5r�z#1 loop, best of 1: 60 sec per loop
r�r�s r�test_main_negative_repsz"TestTimeit.test_main_negative_reps%s'���M�M���x�M�H������B�Crr�zneed __doc__c�p�|jdg��}|j|tjdz�y)Nz-hr�� )r�r0r
�__doc__r�s r�test_main_helpzTestTimeit.test_main_help)s/���M�M�D�6�M�*��
����F�N�N�S�0�1rc�`�|jdg��}|j|td��y)Nz-vr�z� 1 loop -> 1 secs
raw times: 1 sec, 1 sec, 1 sec, 1 sec, 1 sec
1 loop, best of 5: 1 sec per loop
r�r�s r�test_main_verbosezTestTimeit.test_main_verbose0s0���M�M�D�6�M�*������F�$�� rc�b�|jddg��}|j|td��y)NgiUMu�>z-vvr�a� 1 loop -> 3e-05 secs
2 loops -> 6e-05 secs
5 loops -> 0.00015 secs
10 loops -> 0.0003 secs
20 loops -> 0.0006 secs
50 loops -> 0.0015 secs
100 loops -> 0.003 secs
200 loops -> 0.006 secs
500 loops -> 0.015 secs
1000 loops -> 0.03 secs
2000 loops -> 0.06 secs
5000 loops -> 0.15 secs
10000 loops -> 0.3 secs
raw times: 300 msec, 300 msec, 300 msec, 300 msec, 300 msec
10000 loops, best of 5: 30 usec per loop
r�r�s r�test_main_very_verbosez!TestTimeit.test_main_very_verbose:s2���M�M� �U�G�M�L������F�$�� rc��|jdddg��}|j|d�|jdddg��}|j|d�|jdddg��}|j|d �t�5}|jddd
g��}ddd�|jj�d�y#1swY�*xYw)Ng�~j�t�h?z-u�secr�z)100 loops, best of 5: 0.003 sec per loop
�msecz&100 loops, best of 5: 3 msec per loop
�usecz*100 loops, best of 5: 3e+03 usec per loop
�parsecz;Unrecognized unit. Please select nsec, usec, msec, or sec.
)r�r0rr�)r�unit_sec� unit_msec� unit_usec�error_stringio�invalids r�test_main_with_time_unitz#TestTimeit.test_main_with_time_unitPs����=�=�u����!�(������<� >��M�M�����"�)� �����9� ;��M�M�����"�)� �����=� ?��
�.��m�m�%�"�H�-�$�/�G��
����0�0�2�R� T��
�s�B?�?Cc��t�5}|jdg��}ddd�|jj�d�y#1swY�*xYw)Nr�r�r��rr�r�r��rr�r�s r�test_main_exceptionzTestTimeit.test_main_exceptiondsD��
�
�.��
�
��w�
�/�A�����~�6�6�8�:M�N��
�s�A�Ac��t�5}|jddg��}ddd�|jj�d�y#1swY�*xYw)Nz-n1r�r�r�r�r�s r�test_main_exception_fixed_repsz)TestTimeit.test_main_exception_fixed_repsisF��
�
�.��
�
��u�~�
�6�A�����~�6�6�8�:M�N��
�s�A � Ac��t|��}tj|j|j|��}|j|�S)Nr�rv)rr
rGr^r_� autorange)rr�callbackr rWs rr�zTestTimeit.autorangens6���0E�F���L�L�d�n�n�D�O�O�5�Q���{�{�8�$�$rc�r�|j�\}}|j|d�|j|d�y)N���@�?�r�r0�r� num_loops�
time_takens r�test_autorangezTestTimeit.test_autorangess3�� $��� 0�� �:�����C�(�����X�.rc�v�|jd��\}}|j|d�|j|d�y)Nr"r�rr�r�s r�test_autorange_secondz TestTimeit.test_autorange_secondxs7�� $���S�� I�� �:�����A�&�����S�)rc��d�}t�5}|j|��\}}ddd�|jd�|jd�d}|jj�|�y#1swY�PxYw)Nc�:�tdj||��y)Nz {} {:.3f})�print�format)�a�bs rr�z9TestTimeit.test_autorange_with_callback.<locals>.callback~s���+�$�$�Q��*�+r)r�r�r�zQ1 0.001
2 0.002
5 0.005
10 0.010
20 0.020
50 0.049
100 0.098
200 0.195
500 0.488
)rr�r0r�)rr�r�r�r��expecteds r�test_autorange_with_callbackz'TestTimeit.test_autorange_with_callback}sq�� ,�
�
�!�$(�N�N�H�N�$E�!�I�z������C�(�����X�.�"��
�������x�0��
�s�A3�3A<)NN)r"NN)gP?N)<r#r$r%r+r2r5r7r9rIrKrMr_r^rPrRr
r`rergrirkrnrtrwr}rr�r�r�r�r�r�r�r��MAIN_DEFAULT_OUTPUTr�r�r�r�r�r�r�r�r�r��unittest�skipIfr��flags�optimizer�r�r�r�r�r�r�r�r�r�r&rrr(r(,sI���5�=�E�,�
H�E�'�
=�J�9�I� ��-�$?�?�H�H�4�(�
2�@�*?�?�I�$�$�$�*�
>�
E�B�@��
��E�H�I�E�9�9�D�D��X�_�_�S�Y�Y�'�'�1�,�n�=�2�>�2���,T�(O�
O�
%�
/�
*�
1rr(�__main__)r
r�r�r��textwrapr�test.supportrrrVrxr�TestCaser(r#r�r&rr�<module>rsa��
��
� ��(�(�������,a1��"�"�a1�H�z���H�M�M�O�r
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists