o
    h                     @   sV   d Z ddlZddlZg dZg dZdddZdd	 Ze ZdadddZ	dd Z
dS )zMSimple tools for timing functions' execution, when IPython is not available.     N)g      ?g     @@g    .Ag    eA)smsu   μsnspassc           	      C   s   t j| |d}d\}}tddD ]}| |dkr q*|dur%||kr% q*|d9 }qt|||| }|dkrItttt|d  d}nd}|||t	|  t
| fS )	z1Adaptively measure execution time of a function. )setup)      r   
   g?Ng        r   )timeitTimerrangeminrepeatintmathfloorlog10_scales_units)	funcr   limitZtimerr   numberitimeorder r   _/home/www/facesmatcher.com/frenv_anti/lib/python3.10/site-packages/sympy/utilities/timeutils.pytimed   s   
"r   c                  C   s0   dd l } | dd}dd |dD }t|S )Nr   ZSYMPY_TIMINGS c                 S   s   g | ]}|  qS r   )strip).0xr   r   r   
<listcomp>(   s    z __do_timings.<locals>.<listcomp>,)osgetenvsplitset)r$   resr   r   r   __do_timings%   s   r)   r   c                 C   sD   t d| d| d | d | d f  | d D ]	}t||d  qd S )N-z	%.2f %s%s   r   r   r   )print_print_timestack)stacklevelr   r   r   r   r-   /   s   $r-   c                    s    fdd}|S )Nc                    s   t vr S  fdd}|S )Nc                     sr   ddl m } t} jg d| ga| } | i |}| }|| td< |d ur1|d t |a|S tt d a|S )Nr   )r   r+   r   )r   
_timestack	func_nameappendr-   )argskwargsr   Zoldtimestackt1rt2r   r   r   wrapper:   s   z,timethis.<locals>.decorator.<locals>.wrapper)_do_timings)r   r9   namer8   r   	decorator6   s   ztimethis.<locals>.decoratorr   )r<   r=   r   r;   r   timethis5   s   r>   )r   N)r   )__doc__r
   r   r   r   r   r)   r:   r0   r-   r>   r   r   r   r   <module>   s    

