o ,º]l ã@spdZddlmZmZmZddlmZGdd„deƒZGdd„deƒZGdd „d eƒZ Gd d „d eƒZ [[[[d S) aResponse classes used by urllib. The base class, addbase, defines a minimal file-like interface, including read() and readline(). The typical response object is an addinfourl instance, which defines an info() method that returns headers and a geturl() method that returns the url. é)Úabsolute_importÚdivisionÚunicode_literals)Úobjectc@s@eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dS)Úaddbasez(Base class for addinfo and addclosehook.cCsX||_|jj|_|jj|_t|jdƒr|jj|_t|jdƒr%|jj|_dSdd„|_dS)NÚ readlinesÚfilenocSsdS©N©r r r úB/usr/lib/python3/dist-packages/future/backports/urllib/response.pyÚsz"addbase.__init__..)ÚfpÚreadÚreadlineÚhasattrrr)Úselfr r r r Ú__init__s     zaddbase.__init__cCs t|jƒSr )Úiterr ©rr r r Ú__iter__s zaddbase.__iter__cCsd|jjt|ƒ|jfS)Nz<%s at %r whose fp = %r>)Ú __class__Ú__name__Úidr rr r r Ú__repr__%s ÿzaddbase.__repr__cCs>|jr|j ¡d|_d|_d|_d|_d|_d|_d|_dSr )r ÚcloserrrrrÚ__next__rr r r r)s  z addbase.closecCs|jdur tdƒ‚|S)NzI/O operation on closed file)r Ú ValueErrorrr r r Ú __enter__4s zaddbase.__enter__cCs | ¡dSr )r)rÚtypeÚvalueÚ tracebackr r r Ú__exit__9s zaddbase.__exit__N) rÚ __module__Ú __qualname__Ú__doc__rrrrrr!r r r r r s  rc@ó eZdZdZdd„Zdd„ZdS)Ú addclosehookz*Class to add a close hook to an open file.cGst ||¡||_||_dSr )rrÚ closehookÚhookargs)rr r'r(r r r r?s  zaddclosehook.__init__cCs,|jr|j|jŽd|_d|_t |¡dSr )r'r(rrrr r r rDs  zaddclosehook.closeN)rr"r#r$rrr r r r r&<s r&c@r%)Úaddinfoz.class to add an info() method to an open file.cCst ||¡||_dSr )rrÚheaders)rr r*r r r rNs  zaddinfo.__init__cCó|jSr ©r*rr r r ÚinfoRóz addinfo.infoN)rr"r#r$rr-r r r r r)Ks r)c@s2eZdZdZd dd„Zdd„Zdd„Zd d „ZdS) Ú addinfourlz9class to add info() and geturl() methods to an open file.NcCs"t ||¡||_||_||_dSr )rrr*ÚurlÚcode)rr r*r0r1r r r rXs  zaddinfourl.__init__cCr+r r,rr r r r-^r.zaddinfourl.infocCr+r )r1rr r r Úgetcodear.zaddinfourl.getcodecCr+r )r0rr r r Úgeturldr.zaddinfourl.geturlr )rr"r#r$rr-r2r3r r r r r/Us   r/N) r$Ú __future__rrrÚfuture.builtinsrrr&r)r/r r r r Ús 1