config root man

Current Path : /compat/linux/proc/self/root/usr/local/lib/python2.5/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //compat/linux/proc/self/root/usr/local/lib/python2.5/urllib.pyo

hRc#@svdZddkZddkZddkZddkZddkZddklZdddddd	d
ddd
ddddddddddddddddddd gZ	d!Z
d"Zeid#jodd$k
lZlZngeid%jodd$klZlZn=eid&jodd$klZlZnd'Zd(Zeaeed)Zeeed*Zd+Zd,efd-YZhZdfd.YZdefd/YZead0Zead1Zea d2Z!ea"d3Z#d4fd5YZ$d6fd7YZ%d8e%fd9YZ&d:e%fd;YZ'd<e%fd=YZ(ye)Wne*j
od>Z+nXd?Z+d@Z,dAZ-ea.dBZ/ea0dCZ1ea2dDZ3ea4dEZ5ea6dFZ7ea8ddGZ9ea:dHZ;ea<dIZ=dJZ>ea?dKZ@dLZAeBdMeCdNDZDeDiEdOeCdNDdPZFdQZGdRZHhZIdSdTZJdUdVZKdWdXZLdYZMeiNdZjod[ZOd\ZPd]ZQn?eid%jod^ZRd_ZQd`ZPneMZQdaZPdbZSdcZTgddZUdeZVeWdfjoeVndS(gsOpen an arbitrary URL.

See the following document for more info on URLs:
"Names and Addresses, URIs, URLs, URNs, URCs", at
http://www.w3.org/pub/WWW/Addressing/Overview.html

See also the HTTP spec (from which the error codes are derived):
"HTTP - Hypertext Transfer Protocol", at
http://www.w3.org/pub/WWW/Protocols/

Related standards and specs:
- RFC1808: the "relative URL" spec. (authoritative status)
- RFC1738 - the "URL standard". (authoritative status)
- RFC1630 - the "URI spec". (informational status)

The object returned by URLopener().open(file) will differ per
protocol.  All you know is that is has methods read(), readline(),
readlines(), fileno(), close() and info().  The read*(), fileno()
and close() methods work like those of open files.
The info() method returns a mimetools.Message object which can be
used to query various info about the object, if available.
(mimetools.Message objects are queried with the getheader() method.)
iN(turljointurlopent	URLopenertFancyURLopenerturlretrievet
urlcleanuptquotet
quote_plustunquotetunquote_plust	urlencodeturl2pathnametpathname2urltsplittagt	localhosttthishostt	ftperrorstbasejointunwrapt	splittypet	splithostt	splitusertsplitpasswdt	splitportt
splitnportt
splitqueryt	splitattrt
splitvaluetsplitgophertypet
getproxiess1.17i
tmac(RRtnttriscoscCs
t|S(sOS-specific conversion from a relative URL of the 'file' scheme
        to a file system path; not recommended for general use.(R(tpathname((s"/usr/local/lib/python2.5/urllib.pyR4scCs
t|S(sOS-specific conversion from a file system path to a relative URL
        of the 'file' scheme; not recommended for general use.(R(R!((s"/usr/local/lib/python2.5/urllib.pyR9scCsr|dj	otd|}n!tpt}|ant}|djo|i|Sn|i||SdS(s.urlopen(url [, data]) -> open file-like objecttproxiesN(tNoneRt
_urlopenertopen(turltdataR"topener((s"/usr/local/lib/python2.5/urllib.pyRGs
	

cCs*tp
tanti||||S(N(R$Rtretrieve(R&tfilenamet
reporthookR'((s"/usr/local/lib/python2.5/urllib.pyRUs
cCstotindS(N(R$tcleanup(((s"/usr/local/lib/python2.5/urllib.pyRZstContentTooShortErrorcBseZdZRS(cCsti||||_dS(N(tIOErrort__init__tcontent(tselftmessageR0((s"/usr/local/lib/python2.5/urllib.pyR/`s(t__name__t
__module__R/(((s"/usr/local/lib/python2.5/urllib.pyR-_scBseZdZdZdeZddZdZdZ	dZ
dZddZddZ
dd	Zdddd
ZddZddZd
ZeedoddZndZdZdZdZddZRS(s,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).sPython-urllib/%scKs|djo
t}n||_|id|_|id|_d|ifg|_g|_t	i
|_d|_t
|_
dS(Ntkey_filet	cert_files
User-Agent(R#RR"tgetR5R6tversiont
addheaderst_URLopener__tempfilestostunlinkt_URLopener__unlinkt	tempcachetftpcache(R1R"tx509((s"/usr/local/lib/python2.5/urllib.pyR/rs

			cCs|idS(N(tclose(R1((s"/usr/local/lib/python2.5/urllib.pyt__del__scCs|idS(N(R,(R1((s"/usr/local/lib/python2.5/urllib.pyRAscCso|ioFx8|iD]-}y|i|Wqtj
oqXqW|i2n|io|iindS(N(R:R=tOSErrorR>tclear(R1tfile((s"/usr/local/lib/python2.5/urllib.pyR,s

	
cGs|ii|dS(sdAdd a header to be used by the HTTP interface only
        e.g. u.addheader('Accept', 'sound/basic')N(R9tappend(R1targs((s"/usr/local/lib/python2.5/urllib.pyt	addheaderscCstt|}|ioF||ijo6|i|\}}t|d}t|||Snt|\}}|p
d}n||ijoA|i|}t|\}}	t|	\}
}|
|f}nd}d|}||_	|i
dd}t||p2|o|i|||SqC|i
||Sny>|djot|||Snt||||SWn4tij
o%}
td|
ftidnXdS(	s6Use URLopener().open(file) instead of open(file, 'r').trbREtopen_t-t_ssocket erroriN(RttoBytesR>R%t
addinfourlRR"RR#ttypetreplacethasattrtopen_unknown_proxytopen_unknowntgetattrtsocketterrorR.tsystexc_info(R1tfullurlR'R*theaderstfpturltypeR&tproxyt	proxyhostthosttselectortnametmsg((s"/usr/local/lib/python2.5/urllib.pyR%s6


	
cCs(t|\}}tdd|fdS(s/Overridable interface to open unknown URL type.s	url errorsunknown url typeN(RR.(R1RYR'ROR&((s"/usr/local/lib/python2.5/urllib.pyRSscCs,t|\}}tdd||fdS(s/Overridable interface to open unknown URL type.s	url errorsinvalid proxy for %sN(RR.(R1R]RYR'ROR&((s"/usr/local/lib/python2.5/urllib.pyRRscCstt|}|io||ijo|i|Snt|\}}|djom|p
|djoXy<|i|}|i}~tt|d|fSWqt	j
o	}	qXn|i
||}|i}
|ot
|d}nddk}t|\}
}t|pd\}
}t|pd\}}
t
|pd\}}
tii|d}|i|\}}|ii|ti|d}||
f}|idj	o||i|<nd
}d}d	}d	}|o5d
|
jot|
d}n||||nxf|i|}|djoPn|t|7}|i||d7}|o||||q9q9|i|i~~|d	jo*||jotd||f|n|S(stretrieve(url) returns (filename, headers) for a local object
        or (tempfilename, headers) for a remote object.REitwbiNtiiiscontent-lengthsContent-Lengths1retrieval incomplete: got only %i out of %i bytesi (RRMR>RR#topen_local_filetinfoRRR.R%ttempfileRRR;tpathtsplitexttmkstempR:RFtfdopentinttreadtlentwriteRAR-(R1R&R*R+R'ROturl1R[thdrsRbRZttfpRgtgarbageRhtsuffixtfdtresulttbstsizeRmtblocknumtblock((s"/usr/local/lib/python2.5/urllib.pyR)sj"	





cCsXddk}d}d}t|toEt|\}}|o"t|\}}t|}n|}n|\}}t|\}}t|\}	}
|
}d}|	idjo
d}net|
\}}
|ot|\}}n|od|	||
f}nt	|o
|}n|p
t
dn|o%ddk}|i|i
}nd}|o%ddk}|i|i
}
nd}
|i|}|dj	o>|id||idd	|id
dt|n|id||o|id
d|n|
o|idd|
n|o|id|nx|iD]}|i|qoW|i|dj	o|i|n|i\}}}|djo
t
dn|i}|djot||d|SnG|djo|i|||||Sn|i||||||SdS(sUse HTTP protocol.iNthttps	%s://%s%ss
http errors
no host giventPOSTsContent-Types!application/x-www-form-urlencodedsContent-Lengths%dtGETsProxy-AuthorizationsBasic %st
AuthorizationtHostshttp protocol errorisgot a bad status lineishttp:(s
http errors
no host given(shttp protocol errorisgot a bad status lineN(thttplibR#t
isinstancetstrRRRRtlowertproxy_bypassR.tbase64t	b64encodetstriptHTTPt
putrequestt	putheaderRnR9t
endheaderstsendtgetreplytgetfileRNt
http_error(R1R&R'Rtuser_passwdtproxy_passwdR_R`trealhostR\trestRt
proxy_authtauththRGterrcodeterrmsgRZR[((s"/usr/local/lib/python2.5/urllib.pyt	open_httpsz












c
Csd|}t||oft||}|djo||||||}	n|||||||}	|	o|	Sqn|i|||||S(sHandle http errors.
        Derived class can override this, or provide specific handlers
        named http_error_DDD where DDD is the 3-digit error code.s
http_error_%dN(RQRTR#thttp_error_default(
R1R&R[RRRZR'RatmethodRv((s"/usr/local/lib/python2.5/urllib.pyRVs

cCs/|i}|itd|||fdS(s>Default error handler: close the connection and raise IOError.s
http errorN(RmRAR.(R1R&R[RRRZtvoid((s"/usr/local/lib/python2.5/urllib.pyRes
tsslcCsVddk}d}d}t|toEt|\}}|o"t|\}}t|}n|}n|\}}t|\}}t|\}	}
|
}d}|	idjo
d}nNt|
\}}
|ot|\}}n|od|	||
f}n|p
t	dn|o%ddk
}|i|i}nd}|o%ddk
}|i|i}
nd}
|i
|dd|id	|i}|dj	o>|id
||idd|id
dt|n|id||o|idd|n|
o|idd|
n|o|id|nx|iD]}|i|qmW|i|dj	o|i|n|i\}}}|djo
t	dn|i}|djot||d|SnG|djo|i|||||Sn|i||||||SdS(sUse HTTPS protocol.iNthttpss	%s://%s%sshttps errors
no host giveniR5R6R|sContent-Types!application/x-www-form-urlencodedsContent-Lengths%dR}sProxy-AuthorizationsBasic %sR~Rshttp protocol errorsgot a bad status lineishttps:(shttps errors
no host given(shttp protocol errorisgot a bad status lineN(RR#RRRRRRRR.RRRtHTTPSR5R6RRRnR9RRRRRNR(R1R&R'RRRR_R`RR\RRRRRRGRRRZR[((s"/usr/local/lib/python2.5/urllib.pyt
open_httpsls~


	
	






cCst|tp
tdnddk}t|\}}|p
tdnt|}t|\}}t|\}}t|}|o%t|}|i|||}n|i	||}t
|td|S(	sUse Gopher protocol.sgopher errors;proxy support for gopher protocol currently not implementediNs
no host givensgopher:(sgopher errors;proxy support for gopher protocol currently not implemented(sgopher errors
no host given(RRR.t	gopherlibRRRRt
send_queryt
send_selectorRNt	noheaders(R1R&RR_R`ROtqueryR[((s"/usr/local/lib/python2.5/urllib.pytopen_gophers

cCs~t|tp
td
n|d djo?|dd!djo+|dd!idjo|i|Sn|i|Sd	S(s/Use local file or FTP depending on form of URL.s
file errors9proxy support for file protocol currently not implementedis//it/is
localhost/N(s
file errors9proxy support for file protocol currently not implemented(RRR.Rtopen_ftpRe(R1R&((s"/usr/local/lib/python2.5/urllib.pyt	open_files

?cCsddk}ddk}ddk}yddkl}Wn#tj
oddkl}nXt|\}}t|}yti	|}	Wn0t
j
o$}
t|
i|
i
|
inX|	i}|ii|	idt}|i|d}
|i|d|
pd||f}|pB|}|d d	jod
|}ntt|d||Snt|\}}|odti|ttfjoB|}|d d	jod
|}ntt|d||SntddS(sUse local file.iN(tStringIOtusegmtis6Content-Type: %s
Content-Length: %d
Last-modified: %s
s
text/plainiRsfile://RIslocal file errorsnot on local host(slocal file errorsnot on local host(t	mimetypest	mimetoolstemail.Utilst	cStringIORtImportErrorRRR;tstatRCR.terrnotstrerrorR*tst_sizetUtilst
formatdatetst_mtimetTruet
guess_typetMessageRNR%RRUt
gethostbynameRR(R1R&RRtemailRR_REt	localnametstatsteRxtmodifiedtmtypeRZturlfiletport((s"/usr/local/lib/python2.5/urllib.pyRes@$ 		"cCst|tp
tdnddk}ddk}yddkl}Wn#tj
oddkl}nXt|\}}|p
tdnt	|\}}t
|\}}|ot|\}}	nd}	t
|}t
|pd}t
|	pd}	ti|}|pddk}
|
i}n
t|}t|\}}t
|}|id}|d |d}}
|o|d	o|d
}n|o|d	od|d	<n|||di|f}t|itjoPxM|iiD]8}||jo%|i|}|i|=|iqqWnyK||ijo#t||	||||i|<n|
p
d}nd}xP|D]H}t|\}}|id
jo|djo|i}qqW|i|i|
|\}}|i d|d	}d}|o|d|7}n|dj	o|d	jo|d|7}n|i!||}t"||d|SWn4t#j
o%}td|ft$i%dnXdS(sUse FTP protocol.s	ftp errors8proxy support for ftp protocol currently not implementediN(Rs
no host givenRdRiitDtIROtatAtitdsftp:sContent-Type: %s
sContent-Length: %d
i(s	ftp errors8proxy support for ftp protocol currently not implemented(s	ftp errors
no host given(RRRRRR(&RRR.RRRRRRRRRR#RRURtftplibtFTP_PORTRlRtsplittjoinRnR?tMAXFTPCACHEtkeysRAt
ftpwrapperRRtuppertretrfileRRRNRRWRX(R1R&RRRR_RhRtusertpasswdRtattrstdirsREtkeytktvROtattrtvalueR[tretrlenRRZRb((s"/usr/local/lib/python2.5/urllib.pyRs|





#

cCst|tp
tdnddk}yddkl}Wn#tj
oddkl}nXy|idd\}}Wntj
otdnX|p
d	}n|i	d
}|djo-d||jo||d}|| }nd
}g}|i
dtidti
ti|i
d||djoddk}	|	i|}n
t|}|i
dt||i
d
|i
|di|}||}
|i|
d}t|
||S(sUse "data" URL.s
data errors9proxy support for data protocol currently not implementediN(Rt,isbad data URLstext/plain;charset=US-ASCIIt;it=RdsDate: %ss%a, %d %b %Y %T GMTsContent-type: %sRsContent-Length: %ds
(s
data errors9proxy support for data protocol currently not implemented(s
data errorsbad data URL(RRR.RRRRRt
ValueErrortrfindRFttimetstrftimetgmtimeRtdecodestringRRnRRRN(R1R&R'RRROtsemitencodingRbRtfRZ((s"/usr/local/lib/python2.5/urllib.pyt	open_data.sB




N(R3R4t__doc__R#R:t__version__R8R/RBRAR,RHR%RSRRR)RRRRQRURRRReRR(((s"/usr/local/lib/python2.5/urllib.pyRes,
				!?H	F				#	>cBseZdZdZdZddZdZddZddZ	ddZ
ddZdd	Zdd
Z
ddZddZdd
ZddZdZRS(s?Derived class with handlers for errors we can handle (perhaps).cOs2ti|||h|_d|_d|_dS(Nii
(RR/t
auth_cachettriestmaxtries(R1RGtkwargs((s"/usr/local/lib/python2.5/urllib.pyR/`s		cCst||d|S(s3Default error handling -- don't raise an exception.shttp:(RN(R1R&R[RRRZ((s"/usr/local/lib/python2.5/urllib.pyRfsc	Cs|id7_|io\|i|ijoIt|do
|i}n
|i}d|_|||dd|Sn|i||||||}d|_|S(s%Error 302 -- relocated (temporarily).ithttp_error_500iis)Internal Server Error: Redirect Recursion(RRRQRRtredirect_internal(	R1R&R[RRRZR'tmethRv((s"/usr/local/lib/python2.5/urllib.pythttp_error_302js
				c	Cswd|jo|d}n d|jo|d}ndS|i}|it|id||}|i|S(Ntlocationturit:(RmRARROR%(	R1R&R[RRRZR'tnewurlR((s"/usr/local/lib/python2.5/urllib.pyRzs


cCs|i||||||S(s*Error 301 -- also relocated (permanently).(R(R1R&R[RRRZR'((s"/usr/local/lib/python2.5/urllib.pythttp_error_301scCs|i||||||S(s;Error 303 -- also relocated (essentially identical to 302).(R(R1R&R[RRRZR'((s"/usr/local/lib/python2.5/urllib.pythttp_error_303scCsJ|djo |i||||||Sn|i|||||SdS(s1Error 307 -- relocated, but turn POST into error.N(R#RR(R1R&R[RRRZR'((s"/usr/local/lib/python2.5/urllib.pythttp_error_307s
 c
Csd|jo ti||||||n|d}ddk}|id|}	|	p ti||||||n|	i\}
}|
idjo ti||||||nd|id}|djot||||Snt|||||SdS(s_Error 401 -- authentication required.
        This function supports Basic authentication only.swww-authenticateiNs![ 	]*([^ 	]+)[ 	]+realm="([^"]*)"tbasictretry_t_basic_auth(	RRtretmatchtgroupsRROR#RT(
R1R&R[RRRZR'tstuffRRtschemetrealmRa((s"/usr/local/lib/python2.5/urllib.pythttp_error_401s"


c
Csd|jo ti||||||n|d}ddk}|id|}	|	p ti||||||n|	i\}
}|
idjo ti||||||nd|id}|djot||||Snt|||||SdS(seError 407 -- proxy authentication required.
        This function supports Basic authentication only.sproxy-authenticateiNs![ 	]*([^ 	]+)[ 	]+realm="([^"]*)"Rtretry_proxy_R(	RRRRRRROR#RT(
R1R&R[RRRZR'RRRRRRa((s"/usr/local/lib/python2.5/urllib.pythttp_error_407s"


cCst|\}}d||}|id}t|\}}	t|	\}	}
|	idd}|	|}	|i|	||\}}
|p|
pdSnt|dddt|
ddd|	}	d|	|
|id<|djo|i|Sn|i||SdS(Nshttp://R{t@itsafeRdR(RR"Rtfindtget_user_passwdR#RR%(R1R&RR'R_R`RR]R\R^t
proxyselectorRRR((s"/usr/local/lib/python2.5/urllib.pytretry_proxy_http_basic_auths

.
cCst|\}}d||}|id}t|\}}	t|	\}	}
|	idd}|	|}	|i|	||\}}
|p|
pdSnt|dddt|
ddd|	}	d|	|
|id<|djo|i|Sn|i||SdS(Nshttps://RRiRRdR(RR"RR	R
R#RR%(R1R&RR'R_R`RR]R\R^RRRR((s"/usr/local/lib/python2.5/urllib.pytretry_proxy_https_basic_auths

.
c
Cst|\}}|idd}||}|i|||\}}|p|pdSnt|dddt|ddd|}d||}	|djo|i|	Sn|i|	|SdS(NRiRRdRshttp://(RR	R
R#RR%(
R1R&RR'R_R`RRRR((s"/usr/local/lib/python2.5/urllib.pytretry_http_basic_auths
.
c
Cst|\}}|idd}||}|i|||\}}|p|pdSnt|dddt|ddd|}d||}	|djo|i|	Sn|i|	|SdS(NRiRRdRshttps://(RR	R
R#RR%(
R1R&RR'R_R`RRRR((s"/usr/local/lib/python2.5/urllib.pytretry_https_basic_auths
.
icCs|d|i}||ijo$|o|i|=qH|i|Sn|i||\}}|p|o||f|i|<n||fS(NR(RRtprompt_user_passwd(R1R_Rtclear_cacheRRR((s"/usr/local/lib/python2.5/urllib.pyR
sc	Cskddk}y@td||f}|id|||f}||fSWntj
oHdSnXdS(s#Override this in a GUI environment!iNsEnter username for %s at %s: s#Enter password for %s in %s at %s: (NN(tgetpasst	raw_inputtKeyboardInterruptR#(R1R_RRRR((s"/usr/local/lib/python2.5/urllib.pyR	s	
	N(R3R4RR/RR#RRRRRRRRR
RRR
R(((s"/usr/local/lib/python2.5/urllib.pyR]s 			


cCs$tdjotidantS(s8Return the IP address of the magic hostname 'localhost'.RN(t
_localhostR#RUR(((s"/usr/local/lib/python2.5/urllib.pyRs
cCs*tdjotitiantS(s*Return the IP address of the current host.N(t	_thishostR#RURtgethostname(((s"/usr/local/lib/python2.5/urllib.pyR"s
cCs*tdjoddk}|iantS(s1Return the set of errors raised by the FTP class.iN(t
_ftperrorsR#Rt
all_errors(R((s"/usr/local/lib/python2.5/urllib.pyR*s

cCs}tdjolddk}yddkl}Wn#tj
oddkl}nX|i|datiintS(s)Return an empty mimetools.Message object.iN(Ri(	t
_noheadersR#RRRRRR[RA(RR((s"/usr/local/lib/python2.5/urllib.pyR3s
RcBs;eZdZdZdZdZdZdZRS(s;Class used by open_ftp() for cache of open FTP connections.cCs;||_||_||_||_||_|idS(N(RRR_RRtinit(R1RRR_RR((s"/usr/local/lib/python2.5/urllib.pyR/Fs					cCs~ddk}d|_|i|_|ii|i|i|ii|i|i	x!|i
D]}|ii|q`WdS(Nii(RtbusytFTPtftptconnectR_RtloginRRRtcwd(R1Rtdir((s"/usr/local/lib/python2.5/urllib.pyRNs	
c
Csddk}|i|djod}d}nd|}d}y|ii|Wn0|ij
o!|i|ii|nXd}|o~|ovy d|}|ii|}Wq|ij
o@}t	|d	 d
jo t
d|ftidqqXn|pA|iid|od
|}nd}|ii|}nd|_
t|did|i|dfS(NiRRsTYPE AisTYPE isRETR it550s	ftp errorisLIST tLISTRI(RR(RtendtransferRtvoidcmdRRR#tntransfercmdt
error_permRR.RWRXRtaddclosehooktmakefile(R1RERORtcmdtisdirtconntreason((s"/usr/local/lib/python2.5/urllib.pyRWs:





)	cCsI|ipdSnd|_y|iiWntj
onXdS(Ni(RRtvoidrespR(R1((s"/usr/local/lib/python2.5/urllib.pyR%us
	cCs8|iy|iiWntj
onXdS(N(R%RRAR(R1((s"/usr/local/lib/python2.5/urllib.pyRA~s

(R3R4RR/RRR%RA(((s"/usr/local/lib/python2.5/urllib.pyRCs						taddbasecBs)eZdZdZdZdZRS(s(Base class for addinfo and addclosehook.cCs||_|ii|_|ii|_t|ido|ii|_nt|ido|ii|_n
d|_t|ido9|ii|_t|ido|ii|_qndS(Nt	readlinestfilenocSsdS(N(R#(((s"/usr/local/lib/python2.5/urllib.pyt<lambda>st__iter__tnext(R[RmtreadlineRQR1R2R4R5(R1R[((s"/usr/local/lib/python2.5/urllib.pyR/s	cCs d|iit||ifS(Ns<%s at %r whose fp = %r>(t	__class__R3tidR[(R1((s"/usr/local/lib/python2.5/urllib.pyt__repr__scCsLd|_d|_d|_d|_|io|iind|_dS(N(R#RmR6R1R2R[RA(R1((s"/usr/local/lib/python2.5/urllib.pyRAs				
(R3R4RR/R9RA(((s"/usr/local/lib/python2.5/urllib.pyR0s		R)cBs eZdZdZdZRS(s*Class to add a close hook to an open file.cGs&ti||||_||_dS(N(R0R/t	closehookthookargs(R1R[R:R;((s"/usr/local/lib/python2.5/urllib.pyR/s	cCsAti||io&|i|id|_d|_ndS(N(R0RAR:R;R#(R1((s"/usr/local/lib/python2.5/urllib.pyRAs


	(R3R4RR/RA(((s"/usr/local/lib/python2.5/urllib.pyR)s	taddinfocBs eZdZdZdZRS(s.class to add an info() method to an open file.cCsti||||_dS(N(R0R/RZ(R1R[RZ((s"/usr/local/lib/python2.5/urllib.pyR/scCs|iS(N(RZ(R1((s"/usr/local/lib/python2.5/urllib.pyRfs(R3R4RR/Rf(((s"/usr/local/lib/python2.5/urllib.pyR<s	RNcBs)eZdZdZdZdZRS(s9class to add info() and geturl() methods to an open file.cCs&ti||||_||_dS(N(R0R/RZR&(R1R[RZR&((s"/usr/local/lib/python2.5/urllib.pyR/s	cCs|iS(N(RZ(R1((s"/usr/local/lib/python2.5/urllib.pyRfscCs|iS(N(R&(R1((s"/usr/local/lib/python2.5/urllib.pytgeturls(R3R4RR/RfR=(((s"/usr/local/lib/python2.5/urllib.pyRNs		cCsdS(Ni((tx((s"/usr/local/lib/python2.5/urllib.pyt_is_unicodescCs
t|tS(N(Rtunicode(R>((s"/usr/local/lib/python2.5/urllib.pyR?scCsXt|oGy|id}WqTtj
o!tdt|dqTXn|S(stoBytes(u"URL") --> 'URL'.tASCIIsURL s contains non-ASCII characters(R?tencodetUnicodeErrortrepr(R&((s"/usr/local/lib/python2.5/urllib.pyRMs
cCsn|i}|d djo(|ddjo|dd!i}n|d djo|di}n|S(s8unwrap('<URL:type://host/path>') --> 'type://host/path'.it<it>isURL:(R(R&((s"/usr/local/lib/python2.5/urllib.pyRs"cCs}tdjoddk}|idanti|}|o1|id}|i|t|dfSnd|fS(s:splittype('type:opaquestring') --> 'type', 'opaquestring'.iNs
^([^/:]+):i(t	_typeprogR#RtcompileRtgroupRRn(R&RRR((s"/usr/local/lib/python2.5/urllib.pyRs
"cCs`tdjoddk}|idanti|}|o|iddSnd|fS(s;splithost('//host[:port]/path') --> 'host[:port]', '/path'.iNs^//([^/?]*)(.*)$ii(t	_hostprogR#RRHRRI(R&RR((s"/usr/local/lib/python2.5/urllib.pyRs
cCsitdjoddk}|idanti|}|ott|iddSnd|fS(sJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.iNs^(.*)@(.*)$ii(t	_userprogR#RRHRtmapRRI(R_RR((s"/usr/local/lib/python2.5/urllib.pyRs
cCs`tdjoddk}|idanti|}|o|iddSn|dfS(s/splitpasswd('user:passwd') -> 'user', 'passwd'.iNs^([^:]*):(.*)$ii(t_passwdprogR#RRHRRI(RRR((s"/usr/local/lib/python2.5/urllib.pyRs
cCs`tdjoddk}|idanti|}|o|iddSn|dfS(s*splitport('host:port') --> 'host', 'port'.iNs^(.*):([0-9]+)$ii(t	_portprogR#RRHRRI(R_RR((s"/usr/local/lib/python2.5/urllib.pyR+s
cCstdjoddk}|idanti|}|of|idd\}}y$|p
tdnt|}Wntj
o
d}nX||fSn||fS(sSplit host and port, returning numeric port.
    Return given default port if no ':' found; defaults to -1.
    Return numerical port if a valid number are found after ':'.
    Return None if ':' but not a valid number.iNs^(.*):(.*)$iis	no digits(t
_nportprogR#RRHRRIRRl(R_tdefportRRRtnport((s"/usr/local/lib/python2.5/urllib.pyR7s

cCs`tdjoddk}|idanti|}|o|iddSn|dfS(s/splitquery('/path?query') --> '/path', 'query'.iNs^(.*)\?([^?]*)$ii(t
_queryprogR#RRHRRI(R&RR((s"/usr/local/lib/python2.5/urllib.pyRMs
cCs`tdjoddk}|idanti|}|o|iddSn|dfS(s)splittag('/path#tag') --> '/path', 'tag'.iNs^(.*)#([^#]*)$ii(t_tagprogR#RRHRRI(R&RR((s"/usr/local/lib/python2.5/urllib.pyR
Ys
cCs!|id}|d|dfS(sksplitattr('/path;attr1=value1;attr2=value2;...') ->
        '/path', ['attr1=value1', 'attr2=value2', ...].Rii(R(R&twords((s"/usr/local/lib/python2.5/urllib.pyRdscCs`tdjoddk}|idanti|}|o|iddSn|dfS(s-splitvalue('attr=value') --> 'attr', 'value'.iNs^([^=]*)=(.*)$ii(t
_valueprogR#RRHRRI(RRR((s"/usr/local/lib/python2.5/urllib.pyRks
cCs?|d djo$|dd!o|d|dfSnd|fS(s2splitgophertype('/Xselector') --> 'X', 'selector'.iRiN(R#(R`((s"/usr/local/lib/python2.5/urllib.pyRvsccs)x"|]}d|t|fVqWdS(s%02xN(tchr(t.0R((s"/usr/local/lib/python2.5/urllib.pys	<genexpr>|s	iccs)x"|]}d|t|fVqWdS(s%02XN(RV(RWR((s"/usr/local/lib/python2.5/urllib.pys	<genexpr>}s	c	Cs|id}xtdt|D]}||}yt|d |d||<Wq%tj
od|||<q%tj
o,tt|d d|d||<q%Xq%Wdi|S(s"unquote('abc%20def') -> 'abc def'.t%iiiRd(	RtxrangeRnt	_hextochrtKeyErrortUnicodeDecodeErrortunichrRlR(tstresRtitem((s"/usr/local/lib/python2.5/urllib.pyRs
.cCs|idd}t|S(s%unquote('%7e/abc+def') -> '~/abc def't+t (RPR(R^((s"/usr/local/lib/python2.5/urllib.pyR	ssAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-RcCs|tf}yt|}Wnrtj
of|t7}h}xBtdD]4}t|}||jo|pd|||<qHW|t|<nXt|i|}di|S(squote('abc def') -> 'abc%20def'

    Each part of a URL, e.g. the path info, the query, etc., has a
    different set of reserved characters that must be quoted.

    RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists
    the following reserved characters.

    reserved    = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
                  "$" | ","

    Each of these characters is reserved in some component of a URL,
    but not necessarily in all of them.

    By default, the quote function is intended for quoting the path
    section of a URL.  Thus, it will not encode '/'.  This character
    is reserved, but in typical usage the quote function is being
    called on a path where the existing slash characters are used as
    reserved characters.
    is%%%02XRd(talways_safet	_safemapsR[trangeRVRLt__getitem__R(R^Rtcachekeytsafe_mapRtcR_((s"/usr/local/lib/python2.5/urllib.pyRs

&RdcCsAd|jo't||d}|iddSnt||S(s9Quote the query fragment of a URL; replacing ' ' with '+'RbRa(RRP(R^R((s"/usr/local/lib/python2.5/urllib.pyRs
ic

Cst|do|i}nhy0t|ot|dto
tnWn4tj
o(ti\}}}td|nXg}|pTxl|D]E\}}tt	|}tt	|}|i
|d|qWnx|D]\}}tt	|}t|t	o%t|}|i
|d|qt|o1t|idd}|i
|d|qyt|}Wn:tj
o.tt	|}|i
|d|qXx/|D]'}	|i
|dtt	|	qWqWdi
|S(svEncode a sequence of two-element tuples or dictionary into a URL query string.

    If any values in the query arg are sequences and doseq is true, each
    sequence element is converted to a separate parameter.

    If the query arg is a sequence of two-element tuples, the order of the
    parameters in the output will match the order of parameters in the
    input.
    titemsis1not a valid non-string sequence or mapping objectRRARPt&(RQRjRnRttuplet	TypeErrorRWRXRRRFR?RBR(
RtdoseqttytvattbtlRRR>telt((s"/usr/local/lib/python2.5/urllib.pyR
sB"
)cCs`h}xStiiD]B\}}|i}|o#|ddjo|||d <qqW|S(sReturn 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.

    it_proxy(R;tenvironRjR(R"RaR((s"/usr/local/lib/python2.5/urllib.pytgetproxies_environments	tdarwinc
Csyddk}Wntj
ohSnXy|i}Wn|ij
ohSnXh}d|joD|do9y|d}Wn|ij
oqXd||d<n|S(sReturn a dictionary of scheme -> proxy server URL mappings.

        By convention the mac uses Internet Config to store
        proxies.  An HTTP proxy, for instance, is stored under
        the HttpProxy key.

        iNtUseHTTPProxyt
HTTPProxyHosts	http://%sR{(ticRtICRV(RztconfigR"R((s"/usr/local/lib/python2.5/urllib.pytgetproxies_internetconfigs 		cCsdS(Ni((R>((s"/usr/local/lib/python2.5/urllib.pyR.scCstptS(N(RvR}(((s"/usr/local/lib/python2.5/urllib.pyR1sc	Csnh}yddk}Wntj
o|SnXy|i|id}|i|dd}|ot|i|dd}d|josx|idD][}|idd	\}}ddk}|id
|pd||f}n|||<qWq@|d d
jo||d<q@d||d<d||d<n|i	Wnt
ttfj
onX|S(sxReturn a dictionary of scheme -> proxy server URL mappings.

        Win32 uses the registry to store proxies.

        iNs;Software\Microsoft\Windows\CurrentVersion\Internet SettingstProxyEnableitProxyServerRRis^([^/:]+)://s%s://%sishttp:R{s	http://%ssftp://%sR(
t_winregRtOpenKeytHKEY_CURRENT_USERtQueryValueExRRRRtClosetWindowsErrorRRm(	R"RtinternetSettingstproxyEnabletproxyServertptprotocoltaddressR((s"/usr/local/lib/python2.5/urllib.pytgetproxies_registry5s:			

cCstptS(sReturn a dictionary of scheme -> proxy server URL mappings.

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

        (RvR(((s"/usr/local/lib/python2.5/urllib.pyRbsc
Cs`yddk}ddk}Wntj
odSnXyK|i|id}|i|dd}t|i|dd}Wntj
odSnX|p|odSnt|\}}|g}y1t	i
|}||jo|i|nWnt	ij
onXy1t	i
|}	|	|jo|i|	nWnt	ij
onX|id}d}
xi|
t|joU||
djo6dd	t	it	i
t	ig||
|
d
+n|
d
7}
qzWxv|D]n}|idd}|id
d}|idd}x/|D]'}|i|||iod
Sq-q-WqWdS(Niis;Software\Microsoft\Windows\CurrentVersion\Internet SettingsR~t
ProxyOverrideRs<local>Rs	127.0.0.1it.s\.t*s.*t?(RRRRRRRRRRURRFRVtgetfqdnRRnRRPRR(
R_RRRRt
proxyOverridetrawHostRtaddrtfqdnRttesttval((s"/usr/local/lib/python2.5/urllib.pyRksf			
		

	!cCsdS(Ni((R_((s"/usr/local/lib/python2.5/urllib.pyRscCsd}x$tdD]}|t|}qW|d}ti}t|}t|}ti}||jo	dGHnt|GHt|GHt|GHt||dGdGHdS(NRdiisWrong!itsec(ReRVRRRRDtround(R^Rtt0tqstuqstt1((s"/usr/local/lib/python2.5/urllib.pyttest1s


	cCsd|||fGHdS(Ns0Block number: %d, Block size: %d, Total size: %d((Ryt	blocksizet	totalsize((s"/usr/local/lib/python2.5/urllib.pyR+sc	Cs9|p:dddddg}ttdo|idqAnzx|D]}dG|GdGHt|dt\}}|GH|o6d
GHx%|iD]}|dG||GHqWd
GHnt|d}|i}~d
|jo(t	i
dd}|i|d
}n|GHd\}}qKWddGHWdtXdS(Ns/etc/passwdsfile:/etc/passwdsfile://localhost/etc/passwdsftp://ftp.gnu.org/pub/READMEs http://www.python.org/index.htmlRs!https://synergy.as.cmu.edu/~geek/RKi
s======RRIs
Rdi(s
----------s
----------(NN(
RQRRFRR#R+RR%Rmtstringt	maketranst	translateR(RGR&tfnRRR[R'ttable((s"/usr/local/lib/python2.5/urllib.pyRs<	

	

c	Cs!ddk}ddk}y#|i|idd\}}Wn&|ij
o}|GHdGHdSnXd}xR|D]J\}}|djo|d}n|djodGHd	Gd
GHdSqqqqW|o&|djotnt|n2|p	dGHnx|D]}t|iGqWdS(NiitthsUse -h for helpis-ts-hs&Usage: python urllib.py [-t] [url ...]s-t runs self-test;s'otherwise, contents of urls are printed(tgetoptRWtargvRVRRRRm(	RRWtoptsRGRbtttoRR&((s"/usr/local/lib/python2.5/urllib.pytmains4#	


	t__main__(XRRRUR;RRWturlparseRRt__all__RRRatmacurl2pathRRt
nturl2patht
rourl2pathR#R$RRRR.R-R?RRRRRRRRRRRR0R)R<RNR@t	NameErrorR?RMRRGRRJRRKRRMRRNRRORRRRRSR
RRURRtdictReRZtupdateRR	RcRdRRR
RvtplatformR}RRRRR+RRR3(((s"/usr/local/lib/python2.5/urllib.pys<module>s		
					B
				
										
	"@			
	-		
=			!	


Man Man