korsygfhrtzangaiide
Elepffwdsff
/
lib64
/
python2.7
/
site-packages
/
mercurial
/
Upload FileeE
HOME
� Hq�Qc @ sU d d l Z d d l Z d d l Z d d l Z d d l Z d e f d � � YZ d e j f d � � YZ d e f d � � YZ d e j f d � � YZ d d l m Z m Z m Z m Z m Z m Z m Z d d l Z d d l Z d d l Z d d l Z d e j f d � � YZ d e j f d � � YZ d a d � Z d � Z d � Z d S( i����Nt RangeErrorc B s e Z d Z RS( s6 Error raised when an unsatisfiable range is requested.( t __name__t __module__t __doc__( ( ( s9 /usr/lib64/python2.7/site-packages/mercurial/byterange.pyR s t HTTPRangeHandlerc B s e Z d Z d � Z d � Z RS( s� Handler 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" response 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) c C s1 t j | | | j � � } | | _ | | _ | S( N( t urllibt addinfourlt get_full_urlt codet msg( t selft reqt fpR R t hdrst r( ( s9 /usr/lib64/python2.7/site-packages/mercurial/byterange.pyt http_error_2066 s c C s t d � � d S( Ns Requested Range Not Satisfiable( R ( R R R R R R ( ( s9 /usr/lib64/python2.7/site-packages/mercurial/byterange.pyt http_error_416= s ( R R R R R ( ( ( s9 /usr/lib64/python2.7/site-packages/mercurial/byterange.pyR s t RangeableFileObjectc B sh e Z d Z d � Z d � Z d � Z d d � Z d d � Z d d � Z d � Z d � Z d � Z RS( s File object wrapper to enable raw range handling. This was implemented primarily 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) c C s>