%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyc

�
�A�[c@`s�dZddlmZmZmZmZddlmZmZm	Z	m
Z
mZmZm
Z
mZddlmZmZmZddlZddlZddlZddlZddlmZddlmZdd	lmZmZmZdd
l m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1ddl2m3Z3m4Z4ddl5Z5ddl6Z6ddl7Z7ddl8Z8ddl9Z9ddl:Z:ddl;Z;ddl<Z<ddl=Z=ddl>Z>ddl?Z?y ddl@Z@ddl@mAZAWneBk
r-eCZDnXeEZDd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+gZFe:jGd, ZHeIaJeIe9jKd-�ZLd.�ZMgZNeIeIeId/�ZOd0�ZPere8jQd1e8jR�ZSne8jQd1�ZSd2�ZTd3eUfd4��YZVd5eUfd6��YZWd7�ZXd8eUfd9��YZYd:eYfd;��YZZd<eYfd=��YZ[d>eYfd?��YZ\d@�Z]dAeYfdB��YZ^dCeUfdD��YZ_dEe_fdF��YZ`dGeUfdH��YZadIeaeYfdJ��YZbdKeaeYfdL��YZce6jdZedMeUfdN��YZfdOeYeffdP��YZgdQeYeffdR��YZhdSeYfdT��YZidUeifdV��YZjekedW�r�dXeifdY��YZleFjmdZ�nd[eYfd\��YZnd]eYfd^��YZod_�Zpd`�ZqdaeYfdb��YZrdc�ZsddeYfde��YZtdfetfdg��YZudhZve6jwdikr�ddjlxmyZymzZzndk�Zydl�ZziZ{dmeUfdn��YZ|doe|fdp��YZ}eIa~dq�ZeIa�dr�Z�eIa�ds�Z�eIa�dt�Z�dueUfdv��YZ�dw�Z�dx�Z�dy�Z�e:j�dzkr�dd{l�m�Z�m�Z�d|�Z�d}�Z�d~�Z�d�Z�nBe6jwdikr�d��Z�d��Z�d��Z�d��Z�ne�Z�e�Z�dS(�u�

Ported using Python-Future from the Python 3.3 standard library.

An extensible library for opening URLs using a variety of protocols

The simplest way to use this module is to call the urlopen function,
which accepts a string containing a URL or a Request object (described
below).  It opens the URL and returns the results as file-like
object; the returned object has some extra methods described below.

The OpenerDirector manages a collection of Handler objects that do
all the actual work.  Each Handler implements a particular protocol or
option.  The OpenerDirector is a composite object that invokes the
Handlers needed to open the requested URL.  For example, the
HTTPHandler performs HTTP GET and POST requests and deals with
non-error returns.  The HTTPRedirectHandler automatically deals with
HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler
deals with digest authentication.

urlopen(url, data=None) -- Basic usage is the same as original
urllib.  pass the url and optionally data to post to an HTTP URL, and
get a file-like object back.  One difference is that you can also pass
a Request instance instead of URL.  Raises a URLError (subclass of
IOError); for HTTP errors, raises an HTTPError, which can also be
treated as a valid response.

build_opener -- Function that creates a new OpenerDirector instance.
Will install the default handlers.  Accepts one or more Handlers as
arguments, either instances or Handler classes that it will
instantiate.  If one of the argument is a subclass of the default
handler, the argument will be installed instead of the default.

install_opener -- Installs a new opener as the default opener.

objects of interest:

OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages
the Handler classes, while dealing with requests and responses.

Request -- An object that encapsulates the state of a request.  The
state can be as simple as the URL.  It can also include extra HTTP
headers, e.g. a User-Agent.

BaseHandler --

internals:
BaseHandler and parent
_call_chain conventions

Example usage:

import urllib.request

# set up authentication info
authinfo = urllib.request.HTTPBasicAuthHandler()
authinfo.add_password(realm='PDQ Application',
                      uri='https://mahler:8092/site-updates.py',
                      user='klem',
                      passwd='geheim$parole')

proxy_support = urllib.request.ProxyHandler({"http" : "http://ahad-haam:3128"})

# build a new opener that adds authentication and caching FTP handlers
opener = urllib.request.build_opener(proxy_support, authinfo,
                                     urllib.request.CacheFTPHandler)

# install it
urllib.request.install_opener(opener)

f = urllib.request.urlopen('http://www.python.org/')
i(tabsolute_importtdivisiontprint_functiontunicode_literals(tbytestdicttfiltertinputtinttmaptopentstr(tPY2tPY3traise_with_tracebackN(temail(tclienti(tURLErrort	HTTPErrortContentTooShortError(turlparseturlsplitturljointunwraptquotetunquotet	splittypet	splithostt	splitportt	splitusertsplitpasswdt	splitattrt
splitqueryt
splitvaluetsplittagtto_bytest
urlunparse(t
addinfourltaddclosehook(t
SSLContextuRequestuOpenerDirectoruBaseHandleruHTTPDefaultErrorHandleruHTTPRedirectHandleruHTTPCookieProcessoruProxyHandleruHTTPPasswordMgruHTTPPasswordMgrWithDefaultRealmuAbstractBasicAuthHandleruHTTPBasicAuthHandleruProxyBasicAuthHandleruAbstractDigestAuthHandleruHTTPDigestAuthHandleruProxyDigestAuthHandleruHTTPHandleruFileHandleru
FTPHandleruCacheFTPHandleruUnknownHandleruHTTPErrorProcessoruurlopenuinstall_openerubuild_openerupathname2urluurl2pathnameu
getproxiesuurlretrieveu
urlcleanupu	URLopeneruFancyURLopeneric
K`sKd|kr |d}|d=nt}d|krF|d}|d=nd}d|krl|d}|d=nd}|s�|s�|rts�td��ntjtj�}|jtjO_tj	|_
|s�|r�|j||�n
|j�t
d|dt�}t|�}	n"tdkr2t�a}	nt}	|	j|||�S(Nu	cadefaultucapathucafileuSSL support not availabletcontexttcheck_hostname(tFalsetNonet	_have_sslt
ValueErrortsslR'tPROTOCOL_SSLv23toptionstOP_NO_SSLv2t
CERT_REQUIREDtverify_modetload_verify_locationstset_default_verify_pathstHTTPSHandlertTruetbuild_openert_openerR
(
turltdatattimeoutt_3to2kwargst	cadefaulttcapathtcafileR(t
https_handlertopener((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyturlopen�s6






cC`s
|adS(N(R9(RB((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytinstall_opener�scC`s�t|�\}}tjt||���K}|j�}|dkrb|rbtjj|�|fS|rzt|d�}n(t	j
dt�}|j}t
j|�|��||f}	d
}
d}d}d}
d|kr�t|d	�}n|r||
|
|�nxctrj|j|
�}|s'Pn|t|�7}|j|�|
d
7}
|r||
|
|�qqWWdQXWdQX|dkr�||kr�td||f|	��n|	S(uW
    Retrieve a URL into a temporary location on disk.

    Requires a URL argument. If a filename is passed, it is used as
    the temporary file location. The reporthook argument should be
    a callable that accepts a block number, a read size, and the
    total file size of the URL target. The data argument should be
    valid URL encoded data.

    If a filename is passed and the URL points to a local resource,
    the result is a copy from local file to new file.

    Returns a tuple containing the path to the newly created
    data file as well as the resulting HTTPMessage object.
    ufileuwbtdeleteiii����iucontent-lengthuContent-LengthiNu1retrieval incomplete: got only %i out of %i bytesi (Rt
contextlibtclosingRCtinfotostpathtnormpathR
ttempfiletNamedTemporaryFileR*tnamet_url_tempfilestappendRR7treadtlentwriteR(R:tfilenamet
reporthookR;turl_typeRJtfptheadersttfptresulttbstsizeRQtblocknumtblock((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyturlretrieve�sD	
	

#cC`sMx3tD]+}ytj|�Wqtk
r1qXqWt2trIdandS(N(RORItunlinktEnvironmentErrorR9R+(t	temp_file((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt
urlcleanup�s

u:\d+$cC`sY|j}t|�d}|dkr:|jdd�}ntjd|d�}|j�S(u�Return request-host, as defined by RFC 2965.

    Variation from RFC: returned value is lowercased, for convenient
    comparison.

    iuuHost(tfull_urlRt
get_headert_cut_port_retsubtlower(trequestR:thost((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytrequest_hosts	tRequestcB`s�eZdidedd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zdd�Zd�ZRS(c	C`s�t|�|_t|j�\|_|_||_i|_d|_x*|j�D]\}}|j	||�qRWi|_
|dkr�t|�}n||_||_
||_|j�dS(N(RRdR"tfragmentR;RXR+t_tunnel_hosttitemst
add_headertunredirected_hdrsRktorigin_req_hosttunverifiabletmethodt_parse(	tselfR:R;RXRrRsRttkeytvalue((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt__init__s							cC`swt|j�\|_}|jdkr=td|j��nt|�\|_|_|jrst|j�|_ndS(Nuunknown url type: %r(	RRdttypeR+R-RRjtselectorR(Rvtrest((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRu(s	cC`s1|jdk	r|jS|jdk	r)dSdSdS(u3Return a string indicating the HTTP request method.uPOSTuGETN(RtR+R;(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt
get_method0s
cC`s(|jrd|j|jfS|jSdS(Nu%s#%s(RmRd(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytget_full_url9s	cC`s)d}tj|tdd�||_dS(Nu&Request.add_data method is deprecated.t
stackleveli(twarningstwarntDeprecationWarningR;(RvR;tmsg((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytadd_dataAscC`s)d}tj|tdd�|jdk	S(Nu&Request.has_data method is deprecated.Ri(R�R�R�R;R+(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pythas_dataFscC`s#d}tj|tdd�|jS(Nu&Request.get_data method is deprecated.Ri(R�R�R�R;(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytget_dataKscC`s#d}tj|tdd�|jS(Nu&Request.get_type method is deprecated.Ri(R�R�R�Rz(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytget_typePscC`s#d}tj|tdd�|jS(Nu&Request.get_host method is deprecated.Ri(R�R�R�Rj(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytget_hostUscC`s#d}tj|tdd�|jS(Nu*Request.get_selector method is deprecated.Ri(R�R�R�R{(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytget_selectorZscC`s#d}tj|tdd�|jS(Nu-Request.is_unverifiable method is deprecated.Ri(R�R�R�Rs(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytis_unverifiable_scC`s#d}tj|tdd�|jS(Nu1Request.get_origin_req_host method is deprecated.Ri(R�R�R�Rr(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytget_origin_req_hostdscC`sJ|jdkr(|jr(|j|_n||_|j|_||_dS(Nuhttps(RzRnRjRdR{(RvRjRz((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt	set_proxyks
	cC`s|j|jkS(N(R{Rd(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt	has_proxysscC`s||j|j�<dS(N(RXt
capitalize(RvRwtval((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRpvscC`s||j|j�<dS(N(RqR�(RvRwR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytadd_unredirected_headerzscC`s||jkp||jkS(N(RXRq(Rvtheader_name((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt
has_header~scC`s"|jj||jj||��S(N(RXtgetRq(RvR�tdefault((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRe�s	cC`s/|jj�}|j|j�t|j��S(N(RqtcopytupdateRXtlistRo(Rvthdrs((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytheader_items�sN(t__name__t
__module__R+R*RyRuR}R~R�R�R�R�R�R�R�R�R�R�RpR�R�ReR�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRls*																	tOpenerDirectorcB`sSeZd�Zd�Zd�Zd�Zdejd�Z	dd�Z
d�ZRS(cC`sMdt}d|fg|_g|_i|_i|_i|_i|_dS(NuPython-urllib/%su
User-agent(t__version__t
addheadersthandlersthandle_openthandle_errortprocess_responsetprocess_request(Rvtclient_version((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRy�s
				cC`s�t|d�s(tdt|���nt}xet|�D]W}|dkrSq;n|jd�}|| }||d}|jd�r�|jd�|d}||d}yt|�}Wntk
r�nX|j	j
|i�}	|	|j	|<n]|d	kr|}|j}	n?|d
kr3|}|j}	n!|dkr;|}|j
}	nq;|	j|g�}
|
rtj|
|�n
|
j|�t}q;W|r�tj|j|�|j|�ndS(
Nu
add_parentu%expected BaseHandler instance, got %ruredirect_requestudo_openu
proxy_openu_iuerroruopenuresponseurequest(uredirect_requestudo_openu
proxy_open(thasattrt	TypeErrorRzR*tdirtfindt
startswithRR-R�R�R�R�R�t
setdefaulttbisecttinsortRPR7R�t
add_parent(Rvthandlertaddedtmethtitprotocolt	conditiontjtkindtlookupR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytadd_handler�sJ



cC`sdS(N((Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytclose�sc	G`sR|j|d�}x9|D]1}t||�}||�}|dk	r|SqWdS(N((R�tgetattrR+(	RvtchainR�t	meth_nametargsR�R�tfuncRZ((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt_call_chain�s
c
C`st|t�r|j�}nt|t�r?t||�}n|}|dk	r]||_n||_|j}|d}x8|j	j
|g�D]!}t||�}||�}q�W|j||�}	|d}x;|j
j
|g�D]$}t||�}|||	�}	q�W|	S(u�
        Accept a URL or a Request object

        Python-Future: if the URL is passed as a byte-string, decode it first.
        u_requestu	_responseN(t
isinstanceRtdecodeRRlR+R;R<RzR�R�R�t_openR�(
RvtfullurlR;R<treqR�R�t	processorR�tresponse((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR
�s&		

cC`sp|j|jdd|�}|r%|S|j}|j|j||d|�}|rW|S|j|jdd|�S(Nudefaultudefault_openu_openuunknownuunknown_open(R�R�Rz(RvR�R;RZR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR��s	
cG`s�|d
kr<|jd}|d}d|}d}|}n|j}|d}d}|||f|}|j|�}|r�|S|r�|dd	f|}|j|�SdS(Nuhttpuhttpsiu
http_error_%siu_erroriudefaultuhttp_error_default(uhttpuhttps(R�R�(RvtprotoR�RR�thttp_errt	orig_argsRZ((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyterrors 


		
N(R�R�RyR�R�R�R+tsockett_GLOBAL_DEFAULT_TIMEOUTR
R�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR��s		/		"cG`s@d�}t�}ttttttttg}t	t
d�rO|jt�nt
�}xl|D]d}x[|D]S}||�r�t||�r�|j|�q�qlt||�rl|j|�qlqlWq_Wx|D]}|j|�q�Wx|D]}|j|��q�Wx3|D]+}||�r+|�}n|j|�q
W|S(u*Create an opener object from a list of handlers.

    The opener will use several default handlers, including support
    for HTTP, FTP and when applicable HTTPS.

    If any of the handlers passed as arguments are subclasses of the
    default handlers, the default handlers will not be used.
    cS`st|t�pt|d�S(Nu	__bases__(R�RzR�(tobj((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytisclass)suHTTPSConnection(R�tProxyHandlertUnknownHandlertHTTPHandlertHTTPDefaultErrorHandlertHTTPRedirectHandlert
FTPHandlertFileHandlertHTTPErrorProcessorR�thttp_clientRPR6tsett
issubclasstaddR�tremoveR�(R�R�RBtdefault_classestskiptklasstcheckth((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR8 s0					




tBaseHandlercB`s)eZdZd�Zd�Zd�ZRS(i�cC`s
||_dS(N(tparent(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�IscC`sdS(N((Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�LscC`s#t|d�stS|j|jkS(Nu
handler_order(R�R7t
handler_order(Rvtother((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt__lt__Ps(R�R�R�R�R�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�Fs		R�cB`s#eZdZdZd�ZeZRS(uProcess HTTP error responses.i�cC`sd|j|j|j�}}}d|ko7dkns`|jjd|||||�}n|S(Ni�i,uhttp(tcodeR�RHR�R�(RvRiR�R�R�R�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt
http_response]s
 	(R�R�t__doc__R�R�thttps_response(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�Ys	R�cB`seZd�ZRS(cC`st|j||||��dS(N(RRd(RvR�RWR�R�R�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pythttp_error_defaultks(R�R�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�jsR�cB`s:eZdZdZd�Zd�ZeZZZdZ	RS(ii
c	`s�|j�}|dkr$|dkp9|dko9|dksZt|j||||��n|jdd	�}d�t�fd�|jj�D��}t|d
|d|jdt	�S(u�Return a Request or None in response to a redirect.

        This is called by the http_error_30x methods when a
        redirection response is received.  If a redirection should
        take place, return a new Request to allow http_error_30x to
        perform the redirect.  Otherwise, raise HTTPError if no-one
        else should try to handle this url.  Return None if you can't
        but another Handler might.
        i-i.i/i3uGETuHEADuPOSTu u%20ucontent-lengthucontent-typec3`s3|])\}}|j��kr||fVqdS(N(Rh(t.0tktv(tCONTENT_HEADERS(sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pys	<genexpr>�s	RXRrRs(i-i.i/i3(uGETuHEAD(i-i.i/(ucontent-lengthucontent-type(
R}RRdtreplaceRRXRoRlRrR7(	RvR�RWR�R�RXtnewurltmt
newheaders((R�sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytredirect_requestvs
%		c
C`s�d|kr|d}nd|kr2|d}ndSt|�}|jdkrvt||d||f||��n|js�t|�}d|d	<nt|�}t|j|�}|j||||||�}|dkr�dSt
|d
�r[|j}	|_|	j|d�|j
ks3t|	�|jkrot|j||j|||��qoni}	|_|_|	j|d�d|	|<|j�|j�|jj|d
|j�S(Nulocationuuriuhttpuhttpsuftpuu+%s - Redirection to url '%s' is not allowedu/iu
redirect_dictiiR<(uhttpuhttpsuftpu(RtschemeRRJR�R$RRdR�R+R�t
redirect_dictR�tmax_repeatsRRtmax_redirectionstinf_msgRQR�R�R
R<(
RvR�RWR�R�RXR�turlpartstnewtvisited((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pythttp_error_302�s<


	


uoThe HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
(
R�R�R�R�R�R�thttp_error_301thttp_error_303thttp_error_307R�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�ns	"	7c	C`s�t|�\}}|jd�s0d}|}nV|jd�sRtd|��n|jdd�}|dkryd}n|d|!}t|�\}}|dk	r�t|�\}}n
d}}||||fS(u3Return (scheme, user, password, host/port) given a URL or an authority.

    If a URL is supplied, it must have an authority (host:port) component.
    According to RFC 3986, having an authority component means the URL must
    have two slashes after the scheme:

    >>> _parse_proxy('file:/ftp.example.com/')
    Traceback (most recent call last):
    ValueError: proxy URL with no authority: 'file:/ftp.example.com/'

    The first three items of the returned tuple may be None.

    Examples of authority parsing:

    >>> _parse_proxy('proxy.example.com')
    (None, None, None, 'proxy.example.com')
    >>> _parse_proxy('proxy.example.com:3128')
    (None, None, None, 'proxy.example.com:3128')

    The authority component may optionally include userinfo (assumed to be
    username:password):

    >>> _parse_proxy('joe:password@proxy.example.com')
    (None, 'joe', 'password', 'proxy.example.com')
    >>> _parse_proxy('joe:password@proxy.example.com:3128')
    (None, 'joe', 'password', 'proxy.example.com:3128')

    Same examples, but with URLs instead:

    >>> _parse_proxy('http://proxy.example.com/')
    ('http', None, None, 'proxy.example.com')
    >>> _parse_proxy('http://proxy.example.com:3128/')
    ('http', None, None, 'proxy.example.com:3128')
    >>> _parse_proxy('http://joe:password@proxy.example.com/')
    ('http', 'joe', 'password', 'proxy.example.com')
    >>> _parse_proxy('http://joe:password@proxy.example.com:3128')
    ('http', 'joe', 'password', 'proxy.example.com:3128')

    Everything after the authority is ignored:

    >>> _parse_proxy('ftp://joe:password@proxy.example.com/rubbish:3128')
    ('ftp', 'joe', 'password', 'proxy.example.com')

    Test for no trailing '/' case:

    >>> _parse_proxy('http://joe:password@proxy.example.com')
    ('http', 'joe', 'password', 'proxy.example.com')

    u/u//uproxy URL with no authority: %rii����N(RR�R+R-R�RR(	tproxyR�tr_schemet	authoritytendtuserinfothostporttusertpassword((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt_parse_proxy�s2		

R�cB`s#eZdZdd�Zd�ZRS(idcC`s�|dkrt�}nt|d�s3td��||_x=|j�D]/\}}t|d||||jd��qIWdS(Nukeysuproxies must be a mappingu%s_opencS`s||||�S(N((trR�RzR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt<lambda>)s(R+t
getproxiesR�tAssertionErrortproxiesRotsetattrt
proxy_open(RvRRzR:((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRy"s	
cC`s|j}t|�\}}}}|dkr6|}n|jrRt|j�rRdS|r�|r�dt|�t|�f}	tj|	j��j	d�}
|j
dd|
�nt|�}|j||�||ks�|dkr�dS|jj
|d|j�SdS(Nu%s:%suasciiuProxy-authorizationuBasic uhttpsR<(RzRR+Rjtproxy_bypassRtbase64t	b64encodetencodeR�RpR�R�R
R<(RvR�R�Rzt	orig_typet
proxy_typeRRRt	user_passtcreds((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR,s 		N(R�R�R�R+RyR(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�s
tHTTPPasswordMgrcB`s8eZd�Zd�Zd�Zed�Zd�ZRS(cC`s
i|_dS(N(tpasswd(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRyJscC`s�t|t�r|g}n||jkr:i|j|<nxVttfD]H}tg|D]}|j||�^qW�}||f|j||<qGWdS(N(R�RRR7R*ttuplet
reduce_uri(RvtrealmturiRRtdefault_porttutreduced_uri((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytadd_passwordMs(c	C`s�|jj|i�}xjttfD]\}|j||�}xA|j�D]3\}}x$|D]}|j||�rZ|SqZWqGWq"WdS(N(NN(RR�R7R*RRot	is_suburiR+(	RvRtauthuritdomainsRtreduced_authurituristauthinfoR((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytfind_user_passwordXs
c
C`s�t|�}|dr=|d}|d}|dp7d}nd
}|}d}t|�\}}|r�|d
kr�|d
k	r�idd6dd6j|�}	|	d
k	r�d	||	f}q�n||fS(u@Accept authority or URI and extract only the authority and path.iiiu/iPuhttpi�uhttpsu%s:%dN(RR+RR�(
RvRRtpartsR�RRJRjtporttdport((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRbs 




	cC`si||krtS|d|dkr(tStj|d|df�}t|�t|d�kretStS(ucCheck if test is below base in a URI tree

        Both args must be URIs in reduced form.
        ii(R7R*t	posixpathtcommonprefixRR(Rvtbasettesttcommon((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR!ys(R�R�RyR R'R7RR!(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRHs
			
tHTTPPasswordMgrWithDefaultRealmcB`seZd�ZRS(cC`sDtj|||�\}}|dk	r1||fStj|d|�S(N(RR'R+(RvRR"RR((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR'�s

(R�R�R'(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR0�stAbstractBasicAuthHandlercB`sDeZejdej�Zdd�Zd�Zd�Z	d�Z
RS(u1(?:.*,)*[ 	]*([^ 	]+)[ 	]+realm=(["']?)([^"']*)\2cC`s=|dkrt�}n||_|jj|_d|_dS(Ni(R+RRR tretried(Rvtpassword_mgr((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRy�s
	cC`s
d|_dS(Ni(R2(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytreset_retry_count�sc
C`s1|j|d�}|jdkrBt|j�dd|d��n|jd7_|r-|j�d}|j�dkr�td|��q-tj	j
|�}|r-|j�\}}}|dkr�tj
d
td�n|j�dkr*|j|||�}	|	r#|	jdkr#d|_n|	Sq-ndS(
Nii�ubasic auth failediiubasicuDAbstractBasicAuthHandler does not support the following scheme: '%s'u"u'uBasic Auth Realm was unquotedi(u"u'(R�R+R2RR~tsplitRhR-R1trxtsearchtgroupsR�R�tUserWarningtretry_http_basic_authR�(
RvtauthreqRjR�RXR�tmoRRR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pythttp_error_auth_reqed�s*
	
cC`s�|jj||�\}}|dk	r�d||f}dtj|j��jd�}|jj|j	d�|kr{dS|j
|j	|�|jj|d|j
�SdSdS(Nu%s:%suBasic uasciiR<(RR'R+RRRR�RXR�tauth_headerR�R�R
R<(RvRjR�RRtpwtrawtauth((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR:�s"N(R�R�tretcompiletIR6R+RyR4R=R:(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR1�s			 tHTTPBasicAuthHandlercB`seZdZd�ZRS(u
AuthorizationcC`s/|j}|jd|||�}|j�|S(Nuwww-authenticate(RdR=R4(RvR�RWR�R�RXR:R�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pythttp_error_401�s
		
(R�R�R>RF(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRE�stProxyBasicAuthHandlercB`seZdZd�ZRS(uProxy-authorizationcC`s/|j}|jd|||�}|j�|S(Nuproxy-authenticate(RjR=R4(RvR�RWR�R�RXRR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pythttp_error_407�s
		
(R�R�R>RH(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRG�stAbstractDigestAuthHandlercB`sSeZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	cC`sO|dkrt�}n||_|jj|_d|_d|_d|_dS(Ni(R+RRR R2tnonce_countt
last_nonce(RvR((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRys			cC`s
d|_dS(Ni(R2(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR4scC`s�|j|d�}|jdkr?t|jdd|d��n|jd7_|r�|j�d}|j�dkr�|j||�S|j�dkr�td|��q�ndS(	Nii�udigest auth failediiudigestubasicuEAbstractDigestAuthHandler does not support the following scheme: '%s'(	R�R+R2RRdR5Rhtretry_http_digest_authR-(RvR>RjR�RXR;R�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR=scC`s�|jdd�\}}ttdt|���}|j||�}|r�d|}|jj|jd�|krwdS|j	|j|�|j
j|d|j�}|SdS(Nu iu	Digest %sR<(
R5tparse_keqv_listRR+tparse_http_listtget_authorizationRXR�R>R�R�R
R<(RvR�RAttokent	challengetchaltauth_valtresp((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRL"s
cC`sRd|j|tj�f}|jd�td�}tj|�j�}|d S(Nu	%s:%s:%s:uasciiii(RJttimetctimeRt_randombytesthashlibtsha1t	hexdigest(Rvtnoncetstbtdig((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt
get_cnonce.scC`s[yK|d}|d}|jd�}|jdd�}|jdd�}Wntk
r_dSX|j|�\}}	|dkr�dS|jj||j�\}
}|
dkr�dS|jdk	r�|j|j|�}nd}d|
||f}
d|j	�|j
f}|d	kr�||jkr9|jd
7_nd
|_||_d|j}|j
|�}d||||||�f}|	||
�|�}nD|dkr�|	||
�d|||�f�}ntd
|��d|
|||j
|f}|r|d|7}n|r,|d|7}n|d|7}|rW|d||f7}n|S(Nurealmunonceuqopu	algorithmuMD5uopaqueu%s:%s:%su%s:%suauthiu%08xu%s:%s:%s:%s:%suqop '%s' is not supported.u>username="%s", realm="%s", nonce="%s", uri="%s", response="%s"u
, opaque="%s"u
, digest="%s"u, algorithm="%s"u, qop=auth, nc=%s, cnonce="%s"(R�R+tKeyErrortget_algorithm_implsRR'RdR;tget_entity_digestR}R{RKRJR_R(RvR�RRRR[tqopt	algorithmtopaquetHtKDRR?tentdigtA1tA2tncvaluetcnoncetnoncebittrespdigR-((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRO9sV



		
(
c`sI|dkrd��n|dkr0d��n�fd�}�|fS(NuMD5cS`stj|jd��j�S(Nuascii(RXtmd5RRZ(tx((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR	xtuSHAcS`stj|jd��j�S(Nuascii(RXRYRRZ(Rp((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR	zRqc`s�d||f�S(Nu%s:%s((R\td(Rf(sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR	|Rq((RvRdRg((RfsP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRauscC`sdS(N(R+(RvR;RR((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRbsN(R�R�R+RyR4R=RLR_RORaRb(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRI�s						<	
tHTTPDigestAuthHandlercB`s#eZdZdZdZd�ZRS(u�An authentication protocol defined by RFC 2069

    Digest authentication improves on basic authentication because it
    does not transmit passwords in the clear.
    u
Authorizationi�cC`s9t|j�d}|jd|||�}|j�|S(Niuwww-authenticate(RRdR=R4(RvR�RWR�R�RXRjtretry((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRF�s
	
(R�R�R�R>R�RF(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRs�stProxyDigestAuthHandlercB`seZdZdZd�ZRS(uProxy-Authorizationi�cC`s/|j}|jd|||�}|j�|S(Nuproxy-authenticate(RjR=R4(RvR�RWR�R�RXRjRt((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRH�s
		
(R�R�R>R�RH(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRu�stAbstractHTTPHandlercB`s/eZdd�Zd�Zd�Zd�ZRS(icC`s
||_dS(N(t_debuglevel(Rvt
debuglevel((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRy�scC`s
||_dS(N(Rw(Rvtlevel((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytset_http_debuglevel�sc
C`s�|j}|std��n|jdk	rA|j}t|t�rZd}t|��n|jd�s||jdd�n|jd�sAd}yQt	r�t|t
j
�r�t|�|j}nt
|�}t|�|j}WnBtk
r&t|tj�r;tdt|�|f��q;q>X|jdd|�qAn|}|j�r}t|j�\}}	t|	�\}}
n|jd�s�|jd|�nxH|jjD]:\}}|j�}|j|�s�|j||�q�q�W|S(	Nu
no host givenuLPOST data should be bytes or an iterable of bytes. It cannot be of type str.uContent-typeu!application/x-www-form-urlencodeduContent-lengthuBContent-Length should be specified for iterable data of type %r %ru%duHost(RjRR;R+R�RR�R�R�RtarrayRRtitemsizet
memoryviewtcollectionstIterableR-RzR�RR{RR�R�R�(
RvRiRjR;R�R\tmvtsel_hostR�tseltsel_pathRNRx((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytdo_request_�sJ		

	c
`s�|j}|std��n||d|j|�}t|j���jt�fd�|jj�D���d�d<td��j�D���|jr�i}d}|�kr��|||<�|=n|j	|jd|�ny&|j
|j�|j|j
��Wn,tjk
r=}|j�t|��n/X|j�}	|jrl|jj�d	|_n|j�|	_|	j|	_|	S(
u�Return an HTTPResponse object for the request, using http_class.

        http_class must implement the HTTPConnection API from http.client.
        u
no host givenR<c3`s-|]#\}}|�kr||fVqdS(N((R�R�R�(RX(sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pys	<genexpr>�s	ucloseu
Connectioncs`s'|]\}}|j�|fVqdS(N(ttitle(R�RNR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pys	<genexpr>�suProxy-AuthorizationRXN(RjRR<RRqR�RXRoRnt
set_tunnelRiR}R{R;R�R�R�tgetresponsetsockR+R~R:treasonR�(
Rvt
http_classR�thttp_conn_argsRjR�ttunnel_headerstproxy_auth_hdrterrR((RXsP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytdo_open�s6	,
	
&
	
(R�R�RyRzR�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRv�s		3R�cB`seZd�ZejZRS(cC`s|jtj|�S(N(R�R�tHTTPConnection(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt	http_opens(R�R�R�RvR�thttp_request(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�s	uHTTPSConnectionR6cB`s,eZdddd�Zd�ZejZRS(icC`s&tj||�||_||_dS(N(RvRyt_contextt_check_hostname(RvRxR(R)((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRy's	cC`s%|jtj|d|jd|j�S(NR(R)(R�R�tHTTPSConnectionR�R�(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt
https_open,sN(R�R�R+RyR�RvR�t
https_request(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR6%s	uHTTPSHandlertHTTPCookieProcessorcB`s2eZdd�Zd�Zd�ZeZeZRS(cC`s=ddljjj}|dkr0|j�}n||_dS(Ni(tfuture.backports.http.cookiejart	backportsthttpt	cookiejarR+t	CookieJar(RvR�thttp_cookiejar((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRy5scC`s|jj|�|S(N(R�tadd_cookie_header(RvRi((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�;scC`s|jj||�|S(N(R�textract_cookies(RvRiR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�?sN(R�R�R+RyR�R�R�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�4s
		R�cB`seZd�ZRS(cC`s|j}td|��dS(Nuunknown url type: %s(RzR(RvR�Rz((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytunknown_openGs	(R�R�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�FscC`smi}x`|D]X}|jdd�\}}|ddkr[|ddkr[|dd!}n|||<q
W|S(u>Parse list of key=value strings where keys are not duplicated.u=iiu"i����(R5(tltparsedteltR�R�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRMKs
 cC`s�g}d}t}}x�|D]�}|r?||7}t}qn|r�|dkr]t}qn|dkrrt}n||7}qn|dkr�|j|�d}qn|dkr�t}n||7}qW|r�|j|�ng|D]}|j�^q�S(upParse lists as described by RFC 2068 Section 2.

    In particular, parse comma-separated lists where the elements of
    the list may include quoted-strings.  A quoted-string could
    contain a comma.  A non-quoted string could have quotes in the
    middle.  Neither commas nor quotes count if they are escaped.
    Only double-quotes count, not single-quotes.
    uu\u"u,(R*R7RPtstrip(R\trestparttescapeRtcur((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRNUs4	


	

	R�cB`s)eZd�ZdZd�Zd�ZRS(cC`s||j}|d dkrk|dd!dkrk|jrk|jdkrk|j|j�k	rxtd��qxn
|j|�SdS(Niu//iu/u	localhostu-file:// scheme is supported only on localhost(R{Rjt	get_namesRtopen_local_file(RvR�R:((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt	file_open�s	,cC`s|tjdkruy7ttjd�dtjtj��d�t_Wqutjk
rqtjd�ft_quXntjS(Nu	localhosti(	R�tnamesR+RR�tgethostbyname_extgethostnametgaierrort
gethostbyname(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR��s$cC`sUddljjj}ddl}|j}|j}t|�}y�tj	|�}|j
}|j|jdt
�}	|j|�d}
tjd|
p�d||	f�}|r�t|�\}}n|s�|r"t|�|j�kr"|r�d||}
n
d|}
tt|d�||
�SWntk
rD}t|��nXtd��dS(Nitusegmtu6Content-type: %s
Content-length: %d
Last-modified: %s
u
text/plainufile://urbufile not on local host(tfuture.backports.email.utilsR�Rtutilst	mimetypesRjR{turl2pathnameRItstattst_sizet
formatdatetst_mtimeR7t
guess_typetmessage_from_stringRt_safe_gethostbynameR�R%R
tOSErrorR(RvR�temail_utilsR�RjRTt	localfiletstatsR\tmodifiedtmtypeRXR)torigurltexp((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR��s0			
N(R�R�R�R+R�R�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR��s	
	cC`s-ytj|�SWntjk
r(dSXdS(N(R�R�R�R+(Rj((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR��sR�cB`seZd�Zd�ZRS(cC`s�ddl}ddl}|j}|s6td��nt|�\}}|dkr`|j}nt|�}t|�\}}|r�t	|�\}}nd}t
|�}|p�d}|p�d}ytj|�}Wn"tj
k
r�}t|��nXt|j�\}	}
|	jd�}ttt
|��}|d |d}}|rg|drg|d}ny|j||||||j�}
|r�dp�d}xM|
D]E}t|�\}}|j�d	kr�|dkr�|j�}q�q�W|
j||�\}}d}|j|j�d}|r8|d|7}n|dk	ra|dkra|d|7}ntj|�}t|||j�SWn0|jk
r�}td|�}t|�nXdS(Niuftp error: no host givenuu/i����iuIuDutypeuauAuiuduContent-type: %s
uContent-length: %d
u
ftp error: %r(uauAuiuIuduD( tftplibR�RjRRR+tFTP_PORTRRRRR�R�R�RR{R5R�R	tconnect_ftpR<R!RhtuppertretrfileR�RdRR�R%t
all_errorsR(RvR�R�R�RjR)RRR�RJtattrstdirstfiletfwRztattrRxRWtretrlenRXR�R�texc((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytftp_open�s\	
!
c	C`st||||||dt�S(Nt
persistent(t
ftpwrapperR*(RvRRRjR)R�R<((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR��s(R�R�R�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR��s	5tCacheFTPHandlercB`s>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cC`s1i|_i|_d|_d|_d|_dS(Nii<i(tcacheR<tsoonesttdelayt	max_conns(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRy�s
				cC`s
||_dS(N(R�(Rvtt((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt
setTimeout�scC`s
||_dS(N(R�(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytsetMaxConnsscC`s�|||dj|�|f}||jkrJtj�|j|j|<n<t||||||�|j|<tj�|j|j|<|j�|j|S(Nu/(tjoinR�RUR�R<R�tcheck_cache(RvRRRjR)R�R<Rw((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�s
cC`s tj�}|j|krxxZt|jj��D]@\}}||kr1|j|j�|j|=|j|=q1q1Wntt|jj���|_t	|j�|j
krxJt|jj��D]3\}}||jkr�|j|=|j|=Pq�q�Wtt|jj���|_ndS(N(RUR�R�R<RoR�R�tmintvaluesRRR�(RvR�R�R�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�s"
"

cC`sBx!|jj�D]}|j�qW|jj�|jj�dS(N(R�R�R�tclearR<(Rvtconn((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytclear_cache#s
(R�R�RyR�R�R�R�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR��s					i
unt(R�tpathname2urlcC`s
t|�S(uOS-specific conversion from a relative URL of the 'file' scheme
        to a file system path; not recommended for general use.(R(tpathname((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�2scC`s
t|�S(uOS-specific conversion from a file system path to a relative URL
        of the 'file' scheme; not recommended for general use.(R(R�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�7st	URLopenercB`s�eZdZdZdeZdd�Zd�Zd�Z	d�Z
d�Zdd�Zdd�Z
dd	�Zdddd
�Zd�Zdd�Zdd
�Zd�Zer�d�Zdd�Znd�Zd�Zd�Zdd�ZRS(u,Class to open URLs.
    This is a class rather than just a subroutine because we may need
    more than one set of global protocol-specific options.
    Note -- this is a base class for those who don't want the
    automatic handling of errors type 302 (relocated) and 401
    (authorization needed).uPython-urllib/%scK`s�di|jjd6}tj|tdd�|dkrEt�}nt|d�s`td��||_	|j
d�|_|j
d�|_d	|j
fg|_g|_tj|_d|_t|_dS(
NuW%(class)s style of invoking requests is deprecated. Use newer urlopen functions/methodsuclassRiukeysuproxies must be a mappingukey_fileu	cert_fileu
User-Agent(t	__class__R�R�R�R�R+R
R�RRR�tkey_filet	cert_filetversionR�t_URLopener__tempfilesRIR`t_URLopener__unlinkt	tempcachetftpcache(RvRtx509R�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRyQs			cC`s|j�dS(N(R�(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt__del__kscC`s|j�dS(N(tcleanup(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�nscC`si|jrLx6|jD]+}y|j|�Wqtk
r=qXqW|j2n|jre|jj�ndS(N(R�R�R�R�R�(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�qs	

	cG`s|jj|�dS(udAdd a header to be used by the HTTP interface only
        e.g. u.addheader('Accept', 'sound/basic')N(R�RP(RvR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt	addheaderscC`s�tt|��}t|dd�}|jrn||jkrn|j|\}}t|d�}t|||�St|�\}}|s�d}n||jkr�|j|}t|�\}}	t|	�\}
}|
|f}nd	}d|}||_
|jdd�}t||�sD|r1|j
|||�S|j||�Sny9|d	krft||�|�St||�||�SWn<tk
r��n)tjk
r�}
ttd|
��nXd	S(
u6Use URLopener().open(file) instead of open(file, 'r').tsafeu%/:=&?~#+!$,;'@()*[]|urbufileuopen_u-u_usocket errorN(RR#RR�R
R%RRRR+RzR�R�topen_unknown_proxytopen_unknownR�RR�R�RtIOError(RvR�R;RTRXRWturltypeR:R�t	proxyhostRjR{RNR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR
�s<	

	
cC`s(t|�\}}tdd|��dS(u/Overridable interface to open unknown URL type.u	url erroruunknown url typeN(RR�(RvR�R;RzR:((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR��scC`s,t|�\}}tdd||��dS(u/Overridable interface to open unknown URL type.u	url erroruinvalid proxy for %sN(RR�(RvR�R�R;RzR:((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR��scC`s�tt|��}|jr5||jkr5|j|St|�\}}|dkr�|sf|dkr�yC|j|�}|j�}|j�tt	|�d�|fSWq�t
k
r�}	q�Xn|j||�}z�|j�}
|r�t|d�}n�ddl}t|�\}
}t	|p%d�\}
}t
|p=d�\}}
t|pUd�\}}
tjj|�d}|j|�\}}|jj|�tj|d�}z�||
f}|jdk	r�||j|<nd
}d	}d}d}d
|
krt|
d�}n|r,||||�nx]|j|�}|sHPn|t|�7}|j|�|d7}|r/||||�q/q/WWd|j�XWd|j�X|dkr�||kr�td||f|��n|S(utretrieve(url) returns (filename, headers) for a local object
        or (tempfilename, headers) for a remote object.ufileiuwbiNuiii����ucontent-lengthuContent-Lengthu1retrieval incomplete: got only %i out of %i bytesi (RR#R�RR+R�RHR�R�RR�R
RLR RRIRJtsplitexttmkstempR�RPtfdopenRRQRRRSR(RvR:RTRUR;Rzturl1RWR�R�RXRYRLtgarbageRJtsuffixtfdRZR[R\RQR]R^((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytretrieve�sl


cC`s�d}d}t|t�r]t|�\}}|rTt|�\}}t|�}n|}n�|\}}t|�\}}t|�\}	}
|
}d}|	j�dkr�d}n^t|
�\}}
|r�t|�\}}n|r�d|	||
f}nt|�r|}n|s*t	dd��n|r]t|�}t
j|j��j
d�}nd}|r�t|�}t
j|j��j
d�}nd}||�}
i}|r�d||d<n|r�d||d<n|r�||d	<nd
|d<x!|jD]\}}|||<qW|dk	rLd|d
<|
jd|||�n|
jd|d|�y|
j�}Wn tjk
r�td��nXd|jko�dknr�t||jd||j�S|j||j|j|j|j|�SdS(u�Make an HTTP connection using connection_class.

        This is an internal method that should be called from
        open_http() or open_https().

        Arguments:
        - connection_factory should take a host name and return an
          HTTPConnection instance.
        - url is the url to retrieval or a host, relative-path pair.
        - data is payload for a POST request or None.
        uhttpu	%s://%s%su
http erroru
no host givenuasciiuBasic %suProxy-Authorizationu
AuthorizationuHostucloseu
Connectionu!application/x-www-form-urlencodeduContent-TypeuPOSTuGETRXu$http protocol error: bad status linei�i,uhttp:N(R+R�RRRRRRhRR�RRRR�R�RiR�R�t
BadStatusLineRtstatusR%R�t
http_errorRWR�(Rvtconnection_factoryR:R;tuser_passwdtproxy_passwdRjR{trealhostR�R|t
proxy_authRAt	http_connRXtheaderRxR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt_open_generic_http�sr
			!!



	cC`s|jtj||�S(uUse HTTP protocol.(RR�R�(RvR:R;((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt	open_httpRsc
C`s�d|}t||�rwt||�}|dkrO||||||�}	n|||||||�}	|	rw|	Sn|j|||||�S(u�Handle http errors.

        Derived class can override this, or provide specific handlers
        named http_error_DDD where DDD is the 3-digit error code.u
http_error_%dN(R�R�R+R�(
RvR:RWterrcodeterrmsgRXR;RNRtRZ((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRVs
cC`s&|j�t||||d��dS(u>Default error handler: close the connection and raise IOError.N(R�RR+(RvR:RWRRRX((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�fs
cC`stj|d|jd|j�S(NR�R�(R�R�R�R�(RvRj((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt_https_connectionls	cC`s|j|j||�S(uUse HTTPS protocol.(RR(RvR:R;((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt
open_httpsqscC`szt|t�std��n|d dkri|dd!dkri|dd!j�dkritd��n
|j|�Sd	S(
u/Use local file or FTP depending on form of URL.uEfile error: proxy support for file protocol currently not implementediu//iu/iu
localhost/u-file:// scheme is supported only on localhostN(R�RRRhR-R�(RvR:((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt	open_fileus
<cC`s�ddljjj}ddl}t|�\}}t|�}ytj|�}Wn(t	k
r|}t
|j|j��nX|j
}	|j|jdt�}
|j|�d}tjd|p�d|	|
f�}|s|}
|d dkr�d|}
ntt|d	�||
�St|�\}}|r�tj|�t�ft�kr�|}
|d dkrsd|}
n#|d
 dkr�td|��ntt|d	�||
�St
d
��dS(uUse local file.iNR�u6Content-Type: %s
Content-Length: %d
Last-modified: %s
u
text/plainiu/ufile://urbiu./uAlocal file url may start with / or file:. Unknown url of type: %su#local file error: not on local host(R�R�RR�R�RR�RIR�R�RtstrerrorRTR�R�R�R7R�R�R%R
RR�R�t	localhosttthishostR-(RvR:R�R�RjR�t	localnameR�teR\R�R�RXturlfileR)((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�~s:	
"
cC`sdt|t�std��nddl}t|�\}}|sQtd��nt|�\}}t|�\}}|r�t|�\}}nd}t	|�}t	|p�d�}t	|p�d�}t
j|�}|s�ddl}|j
}nt|�}t|�\}}	t	|�}|jd�}
|
d |
d}
}|
r_|
dr_|
d}
n|
r}|
dr}d|
d<n|||dj|
�f}t|j�tkr�xJ|jj�D]6}
|
|kr�|j|
}|j|
=|j�q�q�Wny9||jkr.t|||||
�|j|<n|s=d	}nd
}xM|	D]E}t|�\}}|j�dkrJ|dkrJ|j�}qJqJW|j|j||�\}}|jd|�d}d}|r�|d|7}n|dk	r|dkr|d|7}ntj|�}t||d|�SWn*t �k
r_}t!td|��nXdS(uUse FTP protocol.uCftp error: proxy support for ftp protocol currently not implementediNuftp error: no host givenuu/i����iuDuIutypeuauAuiuduftp:uContent-Type: %s
uContent-Length: %d
uftp error %r(uauAuiuIuduD("R�RRR�RRRRR+RR�R�R�R�RRR5R�RRR�tMAXFTPCACHEtkeysR�R�R!RhR�R�R�RR�R%t	ftperrorsR(RvR:R�RjRJR)RRR�R�R�R�RwR�R�RzR�RxRWR�R�RXR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytopen_ftp�sp



"	
c	C`s�t|t�std��ny|jdd�\}}Wn tk
r\tdd��nX|sld}n|jd�}|dkr�d	||kr�||d}|| }nd
}g}|jdtj	dtj
tj����|jd
|�|dkr+tj|j
d��jd�}nt|�}|jdt|��|jd
�|j|�dj|�}tj|�}tj|�}t|||�S(uUse "data" URL.uEdata error: proxy support for data protocol currently not implementedu,iu
data errorubad data URLutext/plain;charset=US-ASCIIu;iu=uuDate: %su%a, %d %b %Y %H:%M:%S GMTuContent-type: %subase64uasciiulatin-1uContent-Length: %du
(R�RRR5R-R�trfindRPRUtstrftimetgmtimeRtdecodebytesRR�RRRR�RR�tiotStringIOR%(	RvR:R;RztsemitencodingR�RXtf((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt	open_data�s6
	
$

N(R�R�R�R+R�R�R�RyR�R�R�R�R
R�R�RRR
RR�R,RRRR�RR&(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�Ds.
				$B	\					 	:tFancyURLopenercB`s�eZdZd�Zd�Zdd�Zd�Zdd�Zdd�Z	dd�Z
ded�Zded	�Z
dd
�Zdd�Zdd�Zdd
�Zdd�Zd�ZRS(u?Derived class with handlers for errors we can handle (perhaps).cO`s2tj|||�i|_d|_d|_dS(Nii
(R�Ryt
auth_cachettriestmaxtries(RvR�tkwargs((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRys		cC`st||d||�S(u3Default error handling -- don't raise an exception.uhttp:(R%(RvR:RWRRRX((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�sc	C`s�|jd7_|jrm|j|jkrmt|d�rE|j}n	|j}d|_|||dd|�S|j||||||�}d|_|S(u%Error 302 -- relocated (temporarily).iuhttp_error_500ii�u)Internal Server Error: Redirect Recursion(R)R*R�thttp_error_500R�tredirect_internal(	RvR:RWRRRXR;R�RZ((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�s		
		c	C`s�d|kr|d}nd|kr2|d}ndS|j�t|jd||�}t|�}|jd	kr�t|||d|||��n|j|�S(
Nulocationuuriu:uhttpuhttpsuftpuu( Redirection to url '%s' is not allowed.(uhttpuhttpsuftpu(R�RRzRR�RR
(	RvR:RWRRRXR;R�R�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR-s


	cC`s|j||||||�S(u*Error 301 -- also relocated (permanently).(R�(RvR:RWRRRXR;((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�;scC`s|j||||||�S(u;Error 303 -- also relocated (essentially identical to 302).(R�(RvR:RWRRRXR;((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�?scC`sE|dkr(|j||||||�S|j|||||�SdS(u1Error 307 -- relocated, but turn POST into error.N(R+R�R�(RvR:RWRRRXR;((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�Csc
C`s$d|kr+tj||||||�n|d}tjd|�}	|	sltj||||||�n|	j�\}
}|
j�dkr�tj||||||�n|s�tj||||||�nd|jd}|dkrt||�||�St||�|||�SdS(u_Error 401 -- authentication required.
        This function supports Basic authentication only.uwww-authenticateu![ 	]*([^ 	]+)[ 	]+realm="([^"]*)"ubasicuretry_u_basic_authN(	R�R�RBtmatchR8RhRzR+R�(
RvR:RWRRRXR;RttstuffR.R�RRN((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRFJs&

c
C`s$d|kr+tj||||||�n|d}tjd|�}	|	sltj||||||�n|	j�\}
}|
j�dkr�tj||||||�n|s�tj||||||�nd|jd}|dkrt||�||�St||�|||�SdS(ueError 407 -- proxy authentication required.
        This function supports Basic authentication only.uproxy-authenticateu![ 	]*([^ 	]+)[ 	]+realm="([^"]*)"ubasicuretry_proxy_u_basic_authN(	R�R�RBR.R8RhRzR+R�(
RvR:RWRRRXR;RtR/R.R�RRN((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRHcs&

cC`st|�\}}d||}|jd}t|�\}}	t|	�\}	}
|	jd�d}|	|}	|j|	||�\}}
|p�|
s�dSdt|dd�t|
dd�|	f}	d|	|
|jd<|dkr�|j|�S|j||�SdS(Nuhttp://uhttpu@iu%s:%s@%sR�u(RRRR�tget_user_passwdR+RR
(RvR:RR;RjR{R�R�R�R�t
proxyselectorR�RR((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytretry_proxy_http_basic_auth|s 


cC`st|�\}}d||}|jd}t|�\}}	t|	�\}	}
|	jd�d}|	|}	|j|	||�\}}
|p�|
s�dSdt|dd�t|
dd�|	f}	d|	|
|jd<|dkr�|j|�S|j||�SdS(Nuhttps://uhttpsu@iu%s:%s@%sR�u(RRRR�R0R+RR
(RvR:RR;RjR{R�R�R�R�R1R�RR((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytretry_proxy_https_basic_auth�s 


c
C`s�t|�\}}|jd�d}||}|j|||�\}}|pS|sZdSdt|dd�t|dd�|f}d||}	|dkr�|j|	�S|j|	|�SdS(Nu@iu%s:%s@%sR�uuhttp://(RR�R0R+RR
(
RvR:RR;RjR{R�RRR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR:�s

c
C`s�t|�\}}|jd�d}||}|j|||�\}}|pS|sZdSdt|dd�t|dd�|f}d||}	|dkr�|j|	�S|j|	|�SdS(Nu@iu%s:%s@%sR�uuhttps://(RR�R0R+RR
(
RvR:RR;RjR{R�RRR�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytretry_https_basic_auth�s

icC`s�|d|j�}||jkrD|r6|j|=qD|j|Sn|j||�\}}|sh|r~||f|j|<n||fS(Nu@(RhR(tprompt_user_passwd(RvRjRR�RwRR((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR0�s
cC`slddl}y@td||f�}|jd|||f�}||fSWntk
rgt�dSXdS(u#Override this in a GUI environment!iNuEnter username for %s at %s: u#Enter password for %s in %s at %s: (NN(tgetpassRtKeyboardInterrupttprintR+(RvRjRR6RR((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR5�s	
N(R�R�R�RyR�R+R�R-R�R�R�R*RFRHR2R3R:R4R0R5(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR's$			cC`s"tdkrtjd�antS(u8Return the IP address of the magic hostname 'localhost'.u	localhostN(t
_localhostR+R�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�scC`sftdkrby#ttjtj��d�aWqbtjk
r^ttjd�d�aqbXntS(u,Return the IP addresses of the current host.iu	localhostN(t	_thishostR+RR�R�R�R�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�s# cC`s(tdkr$ddl}|jantS(u1Return the set of errors raised by the FTP class.iN(t
_ftperrorsR+R�R�(R�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�scC`s"tdkrtjd�antS(u%Return an empty email Message object.uN(t
_noheadersR+RR�(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt	noheaders�sR�cB`sSeZdZded�Zd�Zd�Zd�Zd�Z	d�Z
d�ZRS(	u;Class used by open_ftp() for cache of open FTP connections.cC`sV||_||_||_||_||_||_d|_||_|j�dS(Ni(	RRRjR)R�R<trefcountt	keepalivetinit(RvRRRjR)R�R<R�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRy	s								cC`s�ddl}d|_|j�|_|jj|j|j|j�|jj|j	|j
�dj|j�}|jj
|�dS(Niu/(R�tbusytFTPtftptconnectRjR)R<tloginRRR�R�tcwd(RvR�t_target((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR@	s	cC`sddl}|j�|dkr1d}d}nd|}d}y|jj|�Wn.|jk
r�|j�|jj|�nXd}|r|ry&d|}|jj|�\}}Wq|jk
r}t	|�d d	krt
td
|��qqXn|s�|jjd�|r�|jj�}	zPy|jj
|�Wn5|jk
r�}td
|�}
||
_|
�nXWd|jj
|	�Xd|}nd}|jj|�\}}nd|_t|jd
�|j�}|jd7_|j�||fS(NiuduDuTYPE AiuTYPE uRETR iu550u
ftp error: %ruLIST uLISTurb(uduD(R�tendtransferRCtvoidcmdR�R@R+tntransfercmdt
error_permRRRtpwdRFt	__cause__RAR&tmakefilet
file_closeR>R�(RvR�RzR�tcmdtisdirR�R�R�RLR�tftpobj((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�	sP
	



	
	
cC`s
d|_dS(Ni(RA(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRHE	scC`s)t|_|jdkr%|j�ndS(Ni(R*R?R>t
real_close(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�H	s	cC`sC|j�|jd8_|jdkr?|jr?|j�ndS(Nii(RHR>R?RS(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyROM	s
cC`s6|j�y|jj�Wnt�k
r1nXdS(N(RHRCR�R(Rv((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRSS	s

N(R�R�R�R+R7RyR@R�RHR�RORS(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR��s			0			cC`s]i}xPtjj�D]?\}}|j�}|r|ddkr|||d <qqW|S(uReturn a dictionary of scheme -> proxy server URL mappings.

    Scan the environment for variables named <scheme>_proxy;
    this seems to be the standard convention.  If you need a
    different way, you can pass a proxies dictionary to the
    [Fancy]URLopener constructor.

    i����u_proxy(RItenvironRoRh(RRNRx((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytgetproxies_environment[	s	cC`s�tjjdd�p'tjjdd�}|dkr:dSt|�\}}g|jd�D]}|j�^q\}x6|D].}|r{|j|�s�|j|�r{dSq{WdS(u�Test if proxies should not be used for a particular host.

    Checks the environment for a variable named no_proxy, which should
    be a list of DNS suffixes separated by commas, or '*' for all hosts.
    uno_proxyuuNO_PROXYu*iu,i(RIRTR�RR5R�tendswith(Rjtno_proxythostonlyR)R�t
no_proxy_listRN((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytproxy_bypass_environmentk	s*(
$cC`s|ddlm}t|�\}}d�}d|krH|drHtSnd}x'|jdd
�D]}|ssqantjd|�}|dk	ra|dkr�ytj|�}||�}Wq�tj	k
r�qaq�Xn||j
d��}	|j
d	�}
|
dkr,d
|j
d�jd�d}
nt|
d�}
d|
}
||
?|	|
?krttSqa|||�ratSqaWt
S(uj
    Return True iff this host shouldn't be accessed using a proxy

    This function uses the MacOSX framework SystemConfiguration
    to fetch the proxy information.

    proxy_settings come from _scproxy._get_proxy_settings or get mocked ie:
    { 'exclude_simple': bool,
      'exceptions': ['foo.bar', '*.bar.com', '127.0.0.1', '10.1', '10.0/16']
    }
    i(tfnmatchcS`s|jd�}ttt|��}t|�dkrS|ddddgd }n|dd>|dd>B|dd>B|d	BS(
Nu.iiiiiiii(R5R�R	RRR(tipAddrR(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytip2num�	s
u.uexclude_simpleu
exceptionsu(\d+(?:\.\d+)*)(/\d+)?iiii N((R[RR7R+R�RBR.R�R�R�tgrouptcountRR*(Rjtproxy_settingsR[RXR)R]thostIPRxR�R-tmask((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt_proxy_bypass_macosx_sysconf�	s:	

#
udarwin(t_get_proxy_settingst_get_proxiescC`st�}t||�S(N(RdRc(RjR`((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytproxy_bypass_macosx_sysconf�	s	cC`st�S(u�Return a dictionary of scheme -> proxy server URL mappings.

        This function uses the MacOSX framework SystemConfiguration
        to fetch the proxy information.
        (Re(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytgetproxies_macosx_sysconf�	scC`s!t�rt|�St|�SdS(N(RURZRf(Rj((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR�	s	
cC`st�pt�S(N(RURg(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR
�	scC`sai}yddl}Wntk
r*|SXy|j|jd�}|j|d�d}|r5t|j|d�d�}d|kr�x�|jd�D]M}|jdd�\}}tjd	|�s�d
||f}n|||<q�Wq5|d dkr||d
<q5d||d
<d||d<d||d<n|j	�Wnt
ttfk
r\nX|S(uxReturn a dictionary of scheme -> proxy server URL mappings.

        Win32 uses the registry to store proxies.

        iNu;Software\Microsoft\Windows\CurrentVersion\Internet SettingsuProxyEnableuProxyServeru=u;iu^([^/:]+)://u%s://%siuhttp:uhttpu	http://%su
https://%suhttpsuftp://%suftp(
twinregtImportErrortOpenKeytHKEY_CURRENT_USERtQueryValueExRR5RBR.tClosetWindowsErrorR-R�(RRhtinternetSettingstproxyEnabletproxyServertpR�taddress((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytgetproxies_registry�	s8
		

cC`st�pt�S(u�Return a dictionary of scheme -> proxy server URL mappings.

        Returns settings gathered from the environment, if specified,
        or the registry.

        (RURt(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyR

scC`s�yddl}Wntk
r$dSXyK|j|jd�}|j|d�d}t|j|d�d�}Wntk
r�dSX|s�|r�dSt|�\}}|g}y/tj	|�}||kr�|j
|�nWntjk
r�nXy/tj|�}||kr&|j
|�nWntjk
r=nX|j
d�}x�|D]�}	|	dkryd|krydSn|	jdd	�}	|	jd
d�}	|	jdd�}	x*|D]"}
tj|	|
tj�r�dSq�WqTWdS(
Niu;Software\Microsoft\Windows\CurrentVersion\Internet SettingsuProxyEnableu
ProxyOverrideu;u<local>u.iu\.u*u.*u?(RhRiRjRkRlRRnRR�R�RPR�tgetfqdnR5R�RBR.RD(RjRhRoRpt
proxyOverridetrawHostR)taddrtfqdnR.R�((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pytproxy_bypass_registry
sR
		

	

cC`s!t�rt|�St|�SdS(u�Return a dictionary of scheme -> proxy server URL mappings.

        Returns settings gathered from the environment, if specified,
        or the registry.

        N(RURZRz(Rj((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyRB
s	
(�R�t
__future__RRRRtfuture.builtinsRRRRRR	R
Rtfuture.utilsRR
RRR�RXR{tfuture.backportsRtfuture.backports.httpRR�R�RRRtparseRRRRRRRRRRRRR R!R"R#R$R�R%R&R!RIR+RBR�tsysRUR~RLRFR�R.R'RiR*R,R7t__all__R�R�R+R9R�RCRDROR_RcRCtASCIIRfRktobjectRlR�R8R�R�R�R�RR�RR0R1RERGturandomRWRIRsRuRvR�R�R6RPR�R�RMRNR�R�R�R�RRNt
nturl2pathR�R�R�R�R'R9RR:RR;RR<R=R�RURZRctplatformt_scproxyRdReRfRgRR
RtRz(((sP/opt/alt/python27/lib/python2.7/site-packages/future/backports/urllib/request.pyt<module>Gs�":p

					
	?		y�	&h	H*@
E	�z
	
	+4	:8		���		
		
^			<		
		-			2

Zerion Mini Shell 1.0