î Ïê[Œã@sƒdZddlZddddgZGdd„dejƒZGdd„deƒZGd d„deƒZGd d„deƒZdS) 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. éNÚaddbaseÚ addclosehookÚaddinfoÚ addinfourlcsLeZdZdZ‡fdd†Zdd„Zdd„Zdd „Z‡S) rzOBase class for addinfo and addclosehook. Is a good idea for garbage collection.cs,tt|ƒj|dddƒ||_dS)NzZdeleteF)ÚsuperrÚ__init__Úfp)Úselfr)Ú __class__©ú%/usr/lib/python3.4/urllib/response.pyrszaddbase.__init__cCs d|jjt|ƒ|jfS)Nz<%s at %r whose fp = %r>)r Ú__name__ÚidÚfile)r r r r Ú__repr__s zaddbase.__repr__cCs|jjrtdƒ‚n|S)NzI/O operation on closed file)rÚclosedÚ ValueError)r r r r Ú __enter__s zaddbase.__enter__cCs|jƒdS)N)Úclose)r ÚtypeÚvalueÚ tracebackr r r Ú__exit__!szaddbase.__exit__)r Ú __module__Ú __qualname__Ú__doc__rrrrr r )r r rs   cs:eZdZdZ‡fdd†Z‡fdd†Z‡S)rz*Class to add a close hook to an open file.cs,tt|ƒj|ƒ||_||_dS)N)rrrÚ closehookÚhookargs)r rrr)r r r r(s zaddclosehook.__init__csE|jr.|j|jŒd|_d|_ntt|ƒjƒdS)N)rrrrr)r )r r r r-s    zaddclosehook.close)r rrrrrr r )r r r%s cs4eZdZdZ‡fdd†Zdd„Z‡S)rz.class to add an info() method to an open file.cs#tt|ƒj|ƒ||_dS)N)rrrÚheaders)r rr)r r r r8szaddinfo.__init__cCs|jS)N)r)r r r r Úinfo<sz addinfo.info)r rrrrrr r )r r r5s csCeZdZdZd‡fdd†Zdd„Zdd„Z‡S) rz9class to add info() and geturl() methods to an open file.Ncs/tt|ƒj||ƒ||_||_dS)N)rrrÚurlÚcode)r rrr r!)r r r rCs zaddinfourl.__init__cCs|jS)N)r!)r r r r ÚgetcodeHszaddinfourl.getcodecCs|jS)N)r )r r r r ÚgeturlKszaddinfourl.geturl)r rrrrr"r#r r )r r r@s  )rZtempfileÚ__all__Z_TemporaryFileWrapperrrrrr r r r Ús