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X[PdZ\dZ]y\ddl^Z^ye^j_fZ`Wneak rebZ`nXe(e)ejce^jde3fe`ZeWn,ek r`eZ^e(e)ejce3fZenXdeffd YZgd!egfd"YZhd#egfd$YZid%egfd&YZjd'egfd(YZkd)eifd*YZld+eifd,YZmd-egfd.YZnd/egfd0YZod1egfd2YZpd3egfd4YZqd5egfd6YZrd7egfd8YZsd9egfd:YZtd;egfd<YZud=egfd>YZveed?Zwd@e2fdAYZxe5rdBe5exfdCYZynedDZzdEe*fdFYZ{dGe*fdHYZ|edIdJZ}dKefdLYZ~dMZdNZdOZeedPedQZedRZdSZdTZdUZdVZdWe jfdXYZdYefdZYZd[e jfd\YZd]efd^YZd_efd`YZdaZdbZdcddZdeZdfZeeedgZdhZdiZedjkr endS(kiNs2.0.2tFakeShutdownEventcBseZdZedZRS(sClass to fake a threading.Event.isSet so that users of this module are not required to register their own threading.Event() cCstS(s#Dummy method to always return false(tFalse(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pytisSet/s(t__name__t __module__t__doc__t staticmethodR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR*s(tminidom(t ExpatError( turlopentRequestt HTTPErrortURLErrortAbstractHTTPHandlert ProxyHandlertHTTPDefaultErrorHandlertHTTPRedirectHandlertHTTPErrorProcessortOpenerDirector(tHTTPConnectiont BadStatusLine(tHTTPSConnection(tQueue(turlparse(tparse_qs(tmd5(tArgumentParser(tSUPPRESS(t OptionParser(t SUPPRESS_HELPtinttstringtfloat(tStringIO(R!tBytesIO(t TextIOWrappertFileIOt_Py3Utf8OutputcBs eZdZdZdZRS(sVUTF-8 encoded wrapper around stdout for py3, to override ASCII stdout cKs;t|jd}tt|j|dddddS(Ntwtencodingtutf8terrorststrict(R$tfilenotsuperR%t__init__(tselftftkwargstbuf((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR-s cCs$tt|j||jdS(N(R,R%twritetflush(R.ts((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR2s(RRRR-R2(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR%s tprintcCs|S(sNo-op encode to utf-8 for py3((tv((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pytto_utf8scOsL|jdtjkr%t|dWrapper function for py3 to print, with a utf-8 encoded stdouttfileN(tgettsyststderrt_py3_utf8_stderrt_py3_utf8_stdoutt _py3_print(targsR0((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pytprint_s cCs-y|jddSWntk r(|SXdS(s)Encode value to utf-8 if possible for py2R(R*N(tencodetAttributeError(R6((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR7s c s|jdtjdkr%dSfd}t}|jdd}|dk rt|trpt}qt|tst dqn|jdd}|dk rt|trt}qt|tst dqn|rt dn|s0x*|D]}t|tr t}Pq q Wn|rQtd }td }n d }d }|dkrr|}n|dkr|}nx7t |D])\} }| r||n||qW||dS( sThe new-style print function for Python 2.4 and 2.5. Taken from https://pypi.python.org/pypi/six/ Modified to set encoding to UTF-8 always, and to flush after write R8Ncst|tst|}nd}ttrt|tr|dk rtdd}|dkrud}n|j||}nj|j dS(NR(R)R*( t isinstancet basestringtstrR8tunicodetNonetgetattrRAR2R3(tdataR'R)(tfp(s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR2s    tsepssep must be None or a stringtendsend must be None or a strings$invalid keyword arguments to print()s t ( tpopR:tstdoutRGRRCRFtTrueREt TypeErrort enumerate( R?R0R2t want_unicodeRKRLtargtnewlinetspaceti((RJs0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR@sL             tSpeedtestExceptioncBseZdZRS(sBase exception for this module(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRXstSpeedtestCLIErrorcBseZdZRS(s9Generic exception for raising errors during CLI operation(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRYstSpeedtestHTTPErrorcBseZdZRS(s#Base HTTP exception for this module(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRZstSpeedtestConfigErrorcBseZdZRS(sConfiguration XML is invalid(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR["stSpeedtestServersErrorcBseZdZRS(sServers XML is invalid(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR\&stConfigRetrievalErrorcBseZdZRS(sCould not retrieve config.php(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR]*stServersRetrievalErrorcBseZdZRS(s(Could not retrieve speedtest-servers.php(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR^.stInvalidServerIDTypecBseZdZRS(s/Server ID used for filtering was not an integer(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR_2stNoMatchedServerscBseZdZRS(s!No servers matched when filtering(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR`6stSpeedtestMiniConnectFailurecBseZdZRS(s7Could not connect to the provided speedtest mini server(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRa:stInvalidSpeedtestMiniServercBseZdZRS(sjServer provided as a speedtest mini server does not actually appear to be a speedtest mini server (RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRb>stShareResultsConnectFailurecBseZdZRS(s6Could not connect to speedtest.net API to POST results(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRcDstShareResultsSubmitFailurecBseZdZRS(sRUnable to successfully POST results to speedtest.net API after connection (RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRdHstSpeedtestUploadTimeoutcBseZdZRS(s~testlength configuration reached during upload Used to ensure the upload halts when no additional data should be sent (RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyReNstSpeedtestBestServerFailurecBseZdZRS(sUnable to determine best server(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRfTstSpeedtestMissingBestServercBseZdZRS(s?get_best_server not called or not able to determine best server(RRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRgXsc Cs|\}}d}xtj||dtjD]}|\}}} } } d} ybtj||| } |tk r| jt|n|r| j|n| j| | SWq.tj k rt }| dk r| j qq.Xq.W|dk r|ntj ddS(sConnect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. An host of '' or port 0 tells the OS to use the default. Largely vendored from Python 2.7, modified to work with Python 2.4 is!getaddrinfo returns an empty listN( RGtsockett getaddrinfot SOCK_STREAMt_GLOBAL_DEFAULT_TIMEOUTt settimeoutR tbindtconnectterrort get_exceptiontclose( taddressttimeouttsource_addressthosttportterrtrestaftsocktypetprotot canonnametsatsock((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pytcreate_connection\s( "      tSpeedtestHTTPConnectioncBs eZdZdZdZRS(sUCustom HTTPConnection to support source_address across Python 2.4 - Python 3 cOsM|jdd}|jdd}tj|||||_||_dS(NRtRsi (RNRGRR-RtRs(R.R?R0RtRs((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR-s  cCssy.tj|j|jf|j|j|_Wn>ttfk rnt|j|jf|j|j|_nXdS(s3Connect to the host and port specified in __init__.N( RhRRuRvRsRtR~RBRQ(R.((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRns(RRRR-Rn(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRs tSpeedtestHTTPSConnectioncBs eZdZdZdZRS(s^Custom HTTPSConnection to support source_address across Python 2.4 - Python 3 cOsM|jdd}|jdd}tj|||||_||_dS(NRtRsi (RNRGRR-RsRt(R.R?R0RtRs((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR-s  cCstj|i}trttdr8|j|dClass for performing standard speedtest.net testing operationsi cCsi|_||_||_t|||_||_|rH||_n t|_|j|dk r}|jj |ni|_ g|_ i|_ td|jdd|jd||_dS(NRRR(tconfigt_source_addresst_timeoutRRRRRt get_configRGRtserverstclosestt_bestRtresults(R.RGRtRsRR((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR-s$             cCs|jstdn|jS(Ns?get_best_server not called or not able to determine best server(RMRg(R.((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pytbests  c CsFi}trd|dR?iRt/RtlatencyR"(RtostpathtsplitexttdirnameRRRRaRRqtretfindallR(RRytstripR'Rt splitlinestmatchRbtrstripRK( R.RturlpartsR?textRRRRttextt extensionR/RI((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pytset_mini_server sL            icCs|js|jnxbt|jjD]K}xA|j|D]/}|jj|t|j|kr@Pq@q@Wq,Pq,Wtd|jdt|jS(s`Limit servers to the closest speedtest.net servers based on geographic distance sClosest Servers: %rR( RKRtsortedtkeysRLRRRRP(R.tlimitRR4((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pytget_closest_serversBs  cCs|s*|js|j}n|j}n|jrE|jdf}nd}t}i}x|D]}g}tjj|d}tt j j d}d||f} xt ddD]} d| | f} t dd| fd t t| } y| dd kr$t| d d |} nt| d d |} i|d 6}d| d| df}t j}| jd|d|| j}t j|}Wn>tk rt}t d|d t |jdqnX|jd}t|jdkr%|djkr%|j|n |jd| jqWtt|ddd}|||! ,      csg}xKjddD]8}x/tdjddD]}|j|q9WqWjd}g}xt|D]q\}}t|djdddj} |r| jn|jtjd| d j |fqtWfd } gfd } t jd d} t j d | d| ||f} t j d | d| |f}t j| j|jx | jr| jddqWx |jr|jddqWt j}tj_jj|dj_jjS(s'Test upload speed against speedtest.netRXRiRYRZRRRRc sxt|| D]v\}}t||d|djdddjdj}|j|j|t||dtqWdS(NiiRRRRR(RRRRGRRRRRP(RRRRWRR(RR.R(s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRs   csuxnt|krp|jt}x |jrF|jddq'Wj|j|j|dtqWdS(NRsg?RL(RR9RPRRRRRW(RRR(RR(s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRs RTRR?Rsg?g @(RGRRRRRRR RRORRRRRRRRRRRNRR(R.RR RXRRRRRWRIRRRRRR((RRR.Rs0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRsH!       N(RRRRGRR-R RORJRRRRRRRPR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRFs  t~ 6  L >csfd}|S(sWCatch Ctrl-C key sequence and set a SHUTDOWN_EVENT for our threaded operations cs+jtddttjddS(Ns Cancelling...Roi(tsetRRPR:texit(tsignumtframe(R(s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR1s ((RR((Rs0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pytctrl_c-scCstttjddS(sPrint the versioniN(RRR:R(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pytversion8s R,cCs'ttjd|tjddS(sPrint the CSV HeadersR4iN(RRR=R:R(R4((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyR=?sc Csd}td|}y|j|_Wntk r8nX|jddddtddd td d |jd dd dtddd td d|jdddddd d<dd=d d|jdddd d|jddddtd d|jddddtd d|jddddtd d |jd!dddtd d"|jd#dddtd d$|jd%ddd d&|jd'dtdd(d d)|jd*dtdd(d d+|jd,d d-|jd.d d/|jd0dd1dtd d2|jd3ddd d4|jd5dd6dddtd td d7|jd8ddd d9|jd:ddd t dt |j }t |t r|d;}n|}|S(>sAFunction to handle building and parsing of command line argumentssCommand line interface for testing internet bandwidth using speedtest.net. -------------------------------------------------------------------------- https://github.com/sivel/speedtest-clit descriptions --no-downloadtdestRtdefaulttactiont store_consttconstthelpsDo not perform download tests --no-uploadRsDo not perform upload tests--bytestunitstbyteitbitisxDisplay values in bytes instead of bits. Does not affect the image generated by --share, nor output from --json or --csvs--sharet store_trues]Generate and provide a URL to the speedtest.net share results image, not displayed with --csvs--simples4Suppress verbose output, only show basic informations--csvsvSuppress verbose output, only show basic information in CSV format. Speeds listed in bit/s and not affected by --bytess--csv-delimiterR,ttypes<Single character delimiter to use in CSV output. Default ","s --csv-headersPrint CSV headerss--jsonswSuppress verbose output, only show basic information in JSON format. Speeds listed in bit/s and not affected by --bytess--lists:Display a list of speedtest.net servers sorted by distances--serverRsCSpecify a server ID to test against. Can be supplied multiple timess --excludes?Exclude a server from selection. Can be supplied multiple timess--minis URL of the Speedtest Mini servers--sourcesSource IP address to bind tos --timeouti s#HTTP timeout in seconds. Default 10s--securesPUse HTTPS instead of HTTP when communicating with speedtest.net operated serverss--no-pre-allocateR sDo not pre allocate upload data. Pre allocation is enabled by default to improve upload performance. To support systems with insufficient memory, use this option to avoid a MemoryErrors --versions Show the version number and exits--debugi(sbytei(sbiti( t ArgParsert add_optiont add_argumentRBRPRtPARSER_TYPE_STRtPARSER_TYPE_INTtPARSER_TYPE_FLOATt ARG_SUPPRESSt parse_argsRCttuple(RtparsertoptionsR?((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyRFsf       cCsidtfd6dtfd6}xY|jD]K\}}t||tr-|ddkr-td|d|fq-q-WdS( sCheck if an argument was provided that depends on a module that may not be part of the Python standard library. If such an argument is supplied, and the module does not exist, exit with an error stating which module is missing. sjson/simplejson python moduleRCs SSL supportRis(%s is not installed. --%s is unavailableiN(RCRRRHRRGt SystemExit(R?t optional_argsRTtinfo((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pytvalidate_optional_argss "cKsv|rt rdS|r@tjjr3d|}qFd|}n|}|r\tj|dss,%s is an invalid server type, must be an intcss|]}d|VqdS(s%sN((RR4((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pys ss1Retrieving information for the selected server...s&Selecting best server based on ping...s>Hosted by %(sponsor)s (%(name)s) [%(d)0.2f km]: %(latency)s mssTesting download speedRLR6s RsDownload: %0.2f M%s/sg@@sSkipping download testsTesting upload speedR sUpload: %0.2f M%s/ssSkipping upload tests Results: %rs5Ping: %s ms Download: %0.2f M%s/s Upload: %0.2f M%s/sR4sShare results: %sN(R6s (R6s (:RtEventtsignaltSIGINTRRRRRRYRt csv_delimiterR=RRHRRPRtsimpleR7RCRRRRFtsourceRsRR]RRpRRR^RRKRRterrnotEPIPER:RRGtminiRR{R`RR_RRRNRRR RR+R( RR?RRtmachine_formatRt speedtestRRKRtlineRRN((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pytshells                  "       # $                 cCs}y tWnktk r.tddtnKttfk rxt}t|dddkrytd|qynXdS( Ns Cancelling...RoR'iiis ERROR: %s(ii(RtKeyboardInterruptRRPRXRRpRH(R((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pytmainZs   t__main__(RRR7R:RRRRhRRRRtxml.parsers.expatRvRRt GZIP_BASEt ImportErrorRGtobjectRRRRRkRCt simplejsontxml.etree.cElementTreetetreet cElementTreeR_txml.etree.ElementTreet ElementTreetxml.domRRdRturllib2R R R R R RRRRRturllib.requestthttplibRRt http.clientRRtqueueRt urllib.parseRtcgithashlibRtargparseRRRRRRRERR RtoptparseRRt cStringIOR!R"Rt __builtin__tbuiltinsR#R$R%RHR>ROR=R;R<R]R7R@RtCertificateErrort CERT_ERRORRBRRotSSLErrorRRyRXRYRZR[R\R]R^R_R`RaRbRcRdReRfRgRRRRRRRRRpRRRRRRRRRRRRRRFRRR=RRRRRR(((s0/tmp/pip-build-zfymgt/speedtest-cli/speedtest.pyts^                       J J                        ?      ( $   $    $6.>   R