Your IP : 3.138.137.244


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/timeit.cpython-35.opt-2.pyc



���]h0�@s�ddlZddlZddlZddlZddddgZdZdZdZejZ	e
Zd	Zd
d�Z
Gdd�d�Zd
d
e	eddd�Zd
d
e	eeddd�Zddddd�Zedkr�eje��dS)�N�Timer�timeit�repeat�
default_timerz<timeit-src>i@B�z�
def inner(_it, _timer{init}):
    {setup}
    _t0 = _timer()
    for _i in _it:
        {stmt}
    _t1 = _timer()
    return _t1 - _t0
cCs|jddd|�S)N�
� )�replace)�src�indent�r�+/opt/alt/python35/lib64/python3.5/timeit.py�reindentPsrc@sXeZdZddeddd�Zddd�Zedd�Zeed	d
�Z	dS)r�passNcCsj||_i}|dkr$t�n|}d}t|t�rkt|td�|d}t|d�}n;t|�r�||d<|d7}d}d}ntd��t|t�r�t||td�t|d	�}n5t|�r||d
<|d7}d}ntd
��t	j
d|d|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__fs6	


	

		zTimer.__init__cCsiddl}ddl}|jdk	rUt|j�d|jjd�tf|jt<|jd|�dS)Nrr�file)�	linecache�	tracebackr
�len�splitr�cache�	print_exc)r#r'r(r)rrr
r-�szTimer.print_excc
CsYtjd|�}tj�}tj�z|j||j�}Wd|rTtj�X|S)N)�	itertoolsr�gc�	isenabled�disablerr�enable)r#�number�itZgcoldZtimingrrr
r�s

zTimer.timeitcCs=g}x0t|�D]"}|j|�}|j|�qW|S)N)�ranger�append)r#rr3�r�i�trrr
r�s
zTimer.repeat)
�__name__�
__module__�__qualname__rr&r-�default_numberr�default_repeatrrrrr
rTs
	"rcCst||||�j|�S)N)rr)rrrr3r$rrr
r�scCst||||�j||�S)N)rr)rrrrr3r$rrr
r�s�_wrap_timercsM|dkrtjdd�}ddl}y:|j|ddddddd	d
ddg	�\}}Wn@|jk
r�}zt|�td
�dSWYdd}~XnXt}dj|�p�d}d}g}t}	d}
d}ddddddi}d�x,|D]$\}
}|
d9kr*t|�}|
d:krC|j	|�|
d;kr{||krd|}ntddtj
�dS|
d<kr�t|�}	|	dkr�d}	|
d=kr�tj}|
d>kr�tj}|
d?kr�tj
}|
d@kr
|
r�d7�|
d7}
|
dAkrttd+d,�dSqWdj|�p@d}ddl}tjjd|j�|dk	r}||�}t|||�}|dkrxwtdd-�D]f}d-|}y|j|�}Wn|j�dSYnX|
rtd.|�|f�|d/kr�Pq�Wy|j|	|�}Wn|j�dSYnXt|�}|
rtd0d,j�fd1d2�|D���td3|d+d,�|d|}|dk	r�td4|	�||||f�nw|d5kr�td6|	�|f�nQ|d5}|d5kr(td7|	�|f�n!|d5}td8|	�|f�dS)BN�rz
n:u:s:r:tcpvhznumber=zsetup=zrepeat=�time�clock�process�verbosezunit=�helpz#use -h/--help for command line help�rr�usec�msecg@�@�secg��.Ar�-n�--number�-s�--setup�-u�--unitz4Unrecognized unit. Please select usec, msec, or sec.r'�-r�--repeat�-t�--time�-c�--clock�-p�	--process�-v�	--verbose�-h�--help�endr�
z%d loops -> %.*g secsg�������?z
raw times:cs g|]}d�|f�qS)z%.*gr)�.0�x)�	precisionrr
�
<listcomp><s	zmain.<locals>.<listcomp>z	%d loops,zbest of %d: %.*g %s per loopi�zbest of %d: %.*g usec per loopzbest of %d: %.*g msec per loopzbest of %d: %.*g sec per loop)rJrK)rLrM)rNrO)rPrQ)rRrS)rTrU)rVrW)rXrY)rZr[)�sys�argv�getopt�error�printr�joinr>�intr6�stderrrArB�process_time�__doc__�os�path�insert�curdirrr5rr-r�min)�argsr?rdZopts�errrrr3rrrDZ	time_unitZunits�o�arlr9r8r_r7ZbestrGrHrIr)r`r
�main�s�		


		
			



	
	)
	
	ru�__main__)r/rbrAr.�__all__rr=r>�perf_counterrr$rr!rrrrrur:�exitrrrr
�<module>5s&	
~		t

?>