UuLc@sKddkZddkiiiZddklZde fdYZ dS(iN(t DummyLocktStreamingFileObjcBseZddZdZdZdZddZddZddZ d Z d Z d Z d Z d ZdZedZdZdZdZdZdZddZdZdZdZdZRS(cCs|d|_||_||_t|_t|_d|_h|_t|_ ||_ t |_ t ii|_t|_dS(sCreate a streaming file object that wraps around a transport engine. This is only necessary if the underlying transport doesn't have its own streaming interface and the repo operation needs a streaming response.tN(t_StreamingFileObj__buft_StreamingFileObj__urlt_StreamingFileObj__enginetFalset(_StreamingFileObj__data_callback_invokedt"_StreamingFileObj__headers_arrivedtNonet_StreamingFileObj__httpmsgt_StreamingFileObj__headerst_StreamingFileObj__donet$_StreamingFileObj__check_cancelationRt_StreamingFileObj__locktuuidmtuuid4tintt_StreamingFileObj__uuidtTruet free_buffer(tselfturltenginetccancel((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyt__init__#s          c Cst}zlyR|ipD|iip|iit}n|ii|i|i nWnt j onXWd|o|ii nXdS(N( RR Rt _is_ownedtacquireRRtorphaned_requestRRtAttributeErrortrelease(RR((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyt__del__9s    cCs|ii pt|ipH|iiz&|ii|i|it |_Wd|ii Xnd|_ d|_d|_dS(NR( RRtAssertionErrorR RRtremove_requestRRRRRR (R((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pytcloseLs      cCsdS(s[flush the buffer. Since this supports read, but not write, this is a noop.N((R((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pytflush\sicCs|ii pt|djo,x|ioq(W|i}d|_|S|i}t|}||jo|||_|| Sx3|io%t|i}||joPqqW|i}t|}||jo|||_|| Sd|_|SdS(sRead size bytes from the remote connection. If size isn't specified, read all of the data from the remote side.iRN(RRR t_StreamingFileObj__fill_bufferRtlen(Rtsizetcurdatatdatalen((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pytreadas2                  c Cs[|ii pt|djo|i}|id}|djo |d7}|||_|| Sx6|io(|iid}|djoPqmqmW|i}|id}|djo |d7}|||_|| Sd|_|S|i}|idd|}t|}|djo |d7}|||_|| S||jo|||_|| Sx]|ioO|iidd|}t|i}|djoPn||joPqsqsW|i}|idd|}t|}|djo |d7}|||_|| S||jo|||_|| Sd|_|SdS(swRead a line from the remote host. If size is specified, read to newline or size, whichever is smaller.is iRN(RRR RtfindR$R%(RR&R'tnewlineR(((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pytreadlinesf                                      icCs|ii ptd}g}xZtoR|i}|pPn|i||t|7}|o||joPq'q'W|S(sRead lines from the remote host, returning an array of the lines that were read. sizehint specifies an approximate size, in bytes, of the total amount of data, as lines, that should be returned to the caller.i(RRR RR,tappendR%(RtsizehintR)tlinestl((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyt readliness   cCs tdS(N(tNotImplementedError(Rtdata((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pytwritescCs tdS(N(R2(Rtllist((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyt writelinesscCs|iS(N(t!_StreamingFileObj__write_callback(R((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pytget_write_funcscCs|iS(N(t"_StreamingFileObj__header_callback(R((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pytget_header_funcscCs|iS(N(t$_StreamingFileObj__progress_callback(R((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pytget_progress_funcscCs ||_dS(N(R(Rtlock((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pytset_lockscCs|iS(N(R(R((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pytuuidscCs|iS(sReturn the status message that may be included with a numerical HTTP response code. Not all HTTP implementations are guaranteed to return this value. In some cases it may be None.(R (R((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pytget_http_messagescCs1|ip|in|ii|i|S(sjReturn the HTTP header named hdr. If the hdr isn't present, return default value instead.(Rt_StreamingFileObj__fill_headersR tgettlower(Rthdrtdefault((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyt getheaders cCs|iddS(sUsed by the underlying transport before handing this object off to other layers. It ensures that the object's creator can catch errors that occur at connection time. All callers must still catch transport exceptions, however.iN(R$(R((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyt_primescCs|S(N((R((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyt__iter__ scCs!|i}|p tn|S(N(R,t StopIteration(Rtline((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pytnexts  cCs|i}|ptS|iix[|io|iitS|ipjt|_|i|i g}|o3|ii|i o|i n|dn|iitSy|i Wnt ij oO}|i|i g}||_|ii|i o|i nn0|ii|i o|i nnX|djot|i|joq%q%Pq%|iitS(sCall engine.run() to fill the file object's buffer. Read until we might block. If size is specified, stop once we get at least size bytes, or might block, whichever comes first.i(RRRRR RtpendingRt check_statusRRR"trunttxtExcessiveTransientFailuretfailuresR%R(RR&Rtstex((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyt __fill_buffersJ              # cCs1x!|ip|ipPqqWt|_dS(sRun the transport until headers arrive. When the data callback gets invoked, all headers have arrived. The alternate scenario is when no data arrives, but the server isn't providing more input isi over the network. In that case, the client either received just headers, or had the transfer close unexpectedly.N(RR$RR(R((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyt__fill_headersPs    cCs |io|iodSdS(sOCalled by pycurl/libcurl framework to update progress tracking.ii(R (Rtdltottdlcurtultottulcur((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyt__progress_callback`scCs+|ip t|_n|i||_dS(scA callback given to transport engine that writes data into a buffer in this object.N(RRR(RR3((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyt__write_callbackis  cCs|ido=|idd}y|d|_Wqtj oqXnW|iddjo@|idd\}}|o|i|i|itpropertyR?R@RFRGRHRKR$RAR;R7R9(((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyR!s0     # ;           9  ( R?Rtpkg.client.transport.exceptiontclientt transportt exceptionROtpkg.miscRtobjectR(((sB/usr/lib/python2.6/vendor-packages/pkg/client/transport/fileobj.pyts