Your IP : 18.188.114.150


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/timeit.cpython-310.opt-2.pyc

o

6��f�4�@s�	ddlZddlZddlZddlZgd�ZdZdZdZejZ	e
ZdZdd�Z
Gd	d
�d
�Zdde	edfdd
�Zdde	eedfdd�Zddd�dd�ZedkrVe�e��dSdS)�N)�Timer�timeit�repeat�
default_timerz<timeit-src>i@B�z�
def inner(_it, _timer{init}):
    {setup}
    _t0 = _timer()
    for _i in _it:
        {stmt}
        pass
    _t1 = _timer()
    return _t1 - _t0
cCs	|�ddd|�S)N�
� )�replace)�src�indent�r�-/opt/alt/python310/lib64/python3.10/timeit.py�reindentPsrc@sNeZdZ	ddedfdd�Zd
dd�Zefdd�Zeefd	d
�Z	d
dd�Z
dS)r�passNcCs�	||_i}|dur
t�n|}d}t|t�r&t|td�|d}t|d�}nt|�r7||d<|d7}d}d}ntd��t|t�rNt||td�t|d	�}nt|�r]||d
<|d7}d}ntd
��t	j
|||d�}	|	|_t|	td�}
t|
||�|d|_
dS)N��execr��_setupz, _setup=_setupz_setup()z&setup is neither a string nor callable�Z_stmtz
, _stmt=_stmtz_stmt()z%stmt is neither a string nor callable)�stmt�setup�init�inner)�timer�_globals�
isinstance�str�compile�dummy_src_namer�callable�
ValueError�template�formatr
rr)�selfrrr�globalsZlocal_nsZ	global_nsrZ
stmtprefixr
�coderrr
�__init__fs8

zTimer.__init__cCsL	ddl}ddl}|jdurt|j�d|j�d�tf|jt<|j|d�dS)Nrr��file)�	linecache�	tracebackr
�len�splitr�cache�	print_exc)r#r(r)r*rrr
r.�s


�zTimer.print_exccCsP	t�d|�}t��}t��z|�||j�}W|rt��|S|r't��ww�N)�	itertoolsr�gcZ	isenabledZdisablerrZenable)r#�number�itZgcoldZtimingrrr
r�s	�
�zTimer.timeitcCs,	g}t|�D]}|�|�}|�|�q|Sr/)�ranger�append)r#rr2�r�i�trrr
r�s
zTimer.repeatcCsP	d}	dD]}||}|�|�}|r|||�|dkr"||fSq|d9}q)N�T)r9�rg�������?�
)r)r#�callbackr7�jr2�
time_takenrrr
�	autorange�s	

��zTimer.autoranger/)�__name__�
__module__�__qualname__rr&r.�default_numberr�default_repeatrr?rrrr
rTs
�
#rrcCs	t||||��|�Sr/)rr)rrrr2r$rrr
r�srcCs	t||||��||�Sr/)rr)rrrrr2r$rrr
r�sr)�_wrap_timerc
s�	|durtjdd�}ddl}z
|�|dgd��\}}Wn|jy9}zt|�td�WYd}~dSd}~wwt}d�|�pBd}d�g}t}d}	d�d	d
ddd
��d�|D]Z\}
}|
dvrdt|��|
dvrm|�	|�|
dvr�|�vrx|�n
tdtj
d�dS|
dvr�t|�}|dkr�d}|
dvr�tj}|
dvr�|	r��d7�|	d7}	|
dvr�tt
dd�dSqXd�|�p�d}ddl}tj�d|j�|dur�||�}t|||�}
�dkr�d}|	r�fdd�}z	|
�|�\�}Wn
|
��YdS|	r�t�z|
�|��}Wn
|
��YdS���fdd�}|	�r(tdd�t||���t��fd d!�|D�}t|�}td"��dk�r?d#nd$|||�f�t|�}t|�}||d%k�rkddl}|�d&||�||�ftd$d�dS)'Nr9rz
n:u:s:r:tcpvh)	znumber=zsetup=zrepeat=�timeZclockZprocess�verbosezunit=�helpz#use -h/--help for command line helpr:rrg��&�.>g���ư>g����MbP?g�?)ZnsecZusecZmsecZsec�)z-nz--number)z-sz--setup)z-uz--unitz:Unrecognized unit. Please select nsec, usec, msec, or sec.r')z-rz--repeat)z-pz	--process)z-vz	--verbose)z-hz--helpr)�endcs.d}|dk}t|j||rdnd|�d��dS)Nz%{num} loop{s} -> {secs:.{prec}g} secsr9�sr)ZnumrKZsecsZprec)�printr")r2r>�msgZplural)�	precisionrr
r<@s
�zmain.<locals>.callbackcs`�}|dur�|}ndd����D�}|jdd�|D]
\}}||kr&nqd�|||fS)NcSsg|]\}}||f�qSrr)�.0�unit�scalerrr
�
<listcomp>Zsz-main.<locals>.format_time.<locals>.<listcomp>T)�reversez%.*g %s)�items�sort)�dtrPrQZscales)rN�	time_unit�unitsrr
�format_timeTs
�zmain.<locals>.format_timez
raw times: %sz, csg|]}|��qSrr)rOrV)r2rr
rReszmain.<locals>.<listcomp>z"%d loop%s, best of %d: %s per looprKrrztThe test results are likely unreliable. The worst time (%s) was more than four times slower than the best time (%s).)�sys�argv�getopt�errorrLr�joinrD�intr5�stderrrF�process_time�__doc__�os�path�insert�curdirrr?r.r�map�min�max�warnings�
warn_explicit�UserWarning)�argsrEr\Zopts�errrrrrrG�o�arcr8r<�_Zraw_timingsrYZtimingsZbestZworstrjr)r2rNrWrXr
�main�s����
������rr�__main__r/)r1rZrFr0�__all__rrCrD�perf_counterrr$rr!rrrrrrr@�exitrrrr
�<module>s41
�
��

?>