f _9 c@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. iN)addbase addclosehookaddinfo addinfourlcs8eZdZdZfddZddZddZdd ZZS) rzOBase class for addinfo and addclosehook. Is a good idea for garbage collection.cs tt|j|ddd||_dS)NzF)Zdelete)superr__init__fp)selfr __class__(/usr/lib64/python3.10/urllib/response.pyrszaddbase.__init__cCsd|jjt||jfS)Nz<%s at %r whose fp = %r>)r __name__ZidZfilerr r r __repr__s zaddbase.__repr__cCs|jjrtd|S)NzI/O operation on closed file)rZclosedZ ValueErrorr r r r __enter__szaddbase.__enter__cCs |dSN)close)rZtypeZvalueZ tracebackr r r __exit__!zaddbase.__exit__) r __module__ __qualname____doc__rrrr __classcell__r r rr rs  rcs,eZdZdZfddZfddZZS)rz*Class to add a close hook to an open file.cs tt||||_||_dSr)rrr closehookhookargs)rrrrrr r r(szaddclosehook.__init__c sLz6|j}|j}|r&d|_d|_||Wtt|ntt|0dSr)rrrrr)rrrrr r r-s zaddclosehook.close)r rrrrrrr r rr r%s rcs(eZdZdZfddZddZZS)rz.class to add an info() method to an open file.cstt||||_dSr)rrrheaders)rrrrr r r<szaddinfo.__init__cC|jSr)rr r r r info@rz addinfo.info)r rrrrrrr r rr r9s rcs>eZdZdZd fdd ZeddZddZd d ZZ S) rz9class to add info() and geturl() methods to an open file.Ncs"tt|||||_||_dSr)rrrurlcode)rrrrrrr r rGszaddinfourl.__init__cCrrrr r r r statusLszaddinfourl.statuscCrrrr r r r getcodePrzaddinfourl.getcodecCrr)rr r r r geturlSrzaddinfourl.geturlr) r rrrrZpropertyr r!r"rr r rr rDs  r)rZtempfileZ__all__Z_TemporaryFileWrapperrrrrr r r r Zs