o ?Og9 @sZdZddlZgdZGdddejZGdddeZGdd d eZGd d d eZdS) 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 addclosehookaddinfo addinfourlcs8eZdZdZfddZddZddZdd ZZS) rzOBase class for addinfo and addclosehook. Is a good idea for garbage collection.cs tt|j|ddd||_dS)NzF)delete)superr__init__fp)selfr  __class__6/opt/alt/python310/lib64/python3.10/urllib/response.pyrs zaddbase.__init__cCsd|jjt||jfS)Nz<%s at %r whose fp = %r>)r __name__idfiler r r r__repr__s zaddbase.__repr__cCs|jjrtd|S)NzI/O operation on closed file)r closed ValueErrorrr r r __enter__szaddbase.__enter__cCs |dSN)close)r typevalue tracebackr r r__exit__!s zaddbase.__exit__) r __module__ __qualname____doc__rrrr __classcell__r r r rrs  rcs,eZdZdZfddZfddZZS)rz*Class to add a close hook to an open file.cs tt||||_||_dSr)rrr closehookhookargs)r r r!r"r r rr(s zaddclosehook.__init__c s^z&|j}|j}|rd|_d|_||Wtt|dSWtt|dStt|wr)r!r"rrr)r r!r"r r rr-s "zaddclosehook.close)rrrrrrr r r r rr%s rcs(eZdZdZfddZddZZS)rz.class to add an info() method to an open file.cstt||||_dSr)rrrheaders)r r r#r r rr<s zaddinfo.__init__cC|jSr)r#rr r rinfo@z addinfo.info)rrrrrr%r r r r rr9s rcs>eZdZdZd fdd ZeddZddZd d ZZ S) rz9class to add info() and geturl() methods to an open file.Ncs"tt|||||_||_dSr)rrrurlcode)r r r#r'r(r r rrGs zaddinfourl.__init__cCr$rr(rr r rstatusLszaddinfourl.statuscCr$rr)rr r rgetcodePr&zaddinfourl.getcodecCr$r)r'rr r rgeturlSr&zaddinfourl.geturlr) rrrrrpropertyr*r+r,r r r r rrDs r)rZtempfile__all__Z_TemporaryFileWrapperrrrrr r r rs