add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
B

�/g^�c@svdZddlZddlZddlZddlZddlZddlZe��Zdd�Z	dd�Z
dd�Zd	d
�Zdd�Z
ed
krre
�dS)z_Sort performance test.

See main() for command line syntax.
See tabulate() for output format.

iNcs6tj�td|�}yt|d�}Wn�tk
r�tj��fdd�t|�D�}yVz&t|d�}t�	||�|�
�d}Wd|r�yt�|�Wntk
r�YnXXWn0tk
r�}ztd|d|�Wdd}~XYnXYnZXt�
|�}|�
�xDtd	�D]8}t�|�}|d|�}|d|�=|��|�|�~q�W|S)
z+Return a list of n random floats in [0, 1).zrr%06dZrbcsg|]
}���qS�r)�.0�i��rr�%/usr/lib64/python3.7/test/sortperf.py�
<listcomp>�zrandfloats.<locals>.<listcomp>ZwbNzcan't writez:�
)�osZpathZjoin�tdZopenZOSError�random�range�marshalZdumpZcloseZunlink�printZload�	randrange�reverse�extend)�nZfnZfpZresultZmsgrZtemprrr�
randfloatss:
&



rcCstj��dS�N)�sysZstdout�flushrrrrr8srcCs6t��}|��t��}td||dd�t�dS)Nz%6.2f� �Zend)�timeZperf_counter�sortrr)�LZt0Zt1rrr�doit;s
rc
Cs�tdd�dD��}ddt|�}t|d|��x�|D�]�}d|>}t|�}td||fd	d
�t�t|�|��t|�t|�x>td�D]2}t�	|�}t�	|�}||||||<||<q�Wt|�|dkr�d
d�td�D�|dd�<t|�x(t|d�D]}t��|t�	|�<�q
Wt|�|dk�r`|dd�=||d}t
tdd�|��}t|�~t
ttdg|��}t|�~|d}	t
t|	ddd��}|�
t|	��t
tt|��}t|�t�q:WdS)a:Tabulate sort speed for lists of various sizes.

    The sizes are 2**i for i in r (the argument, a list).

    The output displays i, 2**i, and the time to sort arrays of 2**i
    floating point numbers with the following properties:

    *sort: random data
    \sort: descending data
    /sort: ascending data
    3sort: ascending, then 3 random exchanges
    +sort: ascending, then 10 random at the end
    %sort: ascending, then randomly replace 1% of the elements w/ random values
    ~sort: many duplicates
    =sort: all equal
    !sort: worst case scenario

    cSsg|]}|d�qS)rr)rZchrrrrUrztabulate.<locals>.<listcomp>z	*\/3+%~=!z%2s %7sz %6s)rz2**i�z%2d %7drr�rcSsg|]}t���qSr)r)r�dummyrrrrkri����NidicSs|Srr)�xrrrZ<lambda>ysztabulate.<locals>.<lambda>g��i����)ZtupleZlenrrrrrrrrZlistZmapZabsrZfloat)
rZcasesZfmtrrrrZi1Zi2Zhalfrrr�tabulateBsL



r"cCs�d}d}tjdd�r�ttjd�}}tjdd�r�ttjd�}tjdd�r�d}x&tjdd�D]}d|t|�}qfWt�|�t||d�}t|�dS)z�Main program when invoked as a script.

    One argument: tabulate a single row.
    Two arguments: tabulate a range (inclusive).
    Extra arguments are used to seed the random generator.

    iirNr!ri�
)rZargvZintZhashrZseedrr")Zk1Zk2r Zarrrr�main�s	
r#Z__main__)Z__doc__rrrr
Ztempfiler	Z
gettempdirr
rrrr"r#Z__name__rrrrZ<module>s'L