B %k#|@sddlZddlZddlZddlZddddgZdZdZdZejZ e Z d Z d d Z Gd ddZd d e edfddZd d e eedfddZdddddZedkreedS)NTimertimeitrepeat default_timerz i@Bz def inner(_it, _timer{init}): {setup} _t0 = _timer() for _i in _it: {stmt} _t1 = _timer() return _t1 - _t0 cCs|ddd|S)N  )replace)srcindentr )/opt/alt/python37/lib/python3.7/timeit.pyreindentOsrc@sLeZdZddedfddZd ddZefddZeefd d Z dd d Z dS)rpassNc Cs||_i}|dkrtn|}d}t|trJt|td|d}t|d}n*t|rl||d<|d7}d}d}ntdt|trt||tdt|d }n&t|r||d <|d 7}d }ntd t j |||d} | |_ t| td} t | |||d|_ dS)Nexecr_setupz, _setup=_setupz_setup()z&setup is neither a string nor callableZ_stmtz , _stmt=_stmtz_stmt()z%stmt is neither a string nor callable)stmtsetupinitinner)timer_globals isinstancestrcompiledummy_src_namercallable ValueErrortemplateformatr rr) selfrrrglobalsZlocal_nsZ global_nsrZ stmtprefixr coder r r __init__es6       zTimer.__init__cCsJddl}ddl}|jdk r:t|jd|jdtf|jt<|j|ddS)Nrr)file) linecache tracebackr lensplitrcache print_exc)r#r'r(r)r r r r-s   zTimer.print_exccCsBtd|}t}tz|||j}Wd|rgư>gMbP?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|ddS)Nz%{num} loop{s} -> {secs:.{prec}g} secsr7sr)ZnumrIZsecsZprec)printr")r0r<msgplural) precisionr r r:?szmain..callbackcsb}|dk r|}n:ddD}|jddx|D]\}}||kr:Pq:Wd|||fS)NcSsg|]\}}||fqSr r ).0unitscaler r r Ysz-main..format_time..T)reversez%.*g %s)itemssort)dtrOrPZscales)rM time_unitunitsr r format_timeSs  zmain..format_timez raw times: %sz, csg|] }|qSr r )rNrU)r0r r rQdszmain..z"%d loop%s, best of %d: %s per looprIrrztThe test results are likely unreliable. The worst time (%s) was more than four times slower than the best time (%s).)sysargvgetopterrorrJrjoinrBintr3stderrrDZ process_time__doc__ospathinsertcurdirrr=r-rmapminmaxwarnings warn_explicit UserWarning)argsrCr[ZoptserrrrrrrEoarar6r:_Z raw_timingsrXZtimingsZbestZworstrhr )r0rMrVrWr mains              rp__main__)N)r/rYrDr.__all__rrArBZ perf_counterrr$rr!rrrrrpr>exitr r r r 4s*