g9 dZddlZgdZGddejZGddeZGdd eZGd d eZy) 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 addinfourlc4eZdZdZfdZdZdZdZxZS)rzOBase class for addinfo and addclosehook. Is a good idea for garbage collection.c@tt| |dd||_y)NzF)delete)superr__init__fp)selfr __class__s 6/opt/alt/python312/lib64/python3.12/urllib/response.pyr zaddbase.__init__s! g&r+>u&Mchd|jjdt|d|jdS)N)r__name__idfiler s r__repr__zaddbase.__repr__s(-1^^-D-D-/XtyyB BrcH|jjr td|S)NzI/O operation on closed file)r closed ValueErrorrs r __enter__zaddbase.__enter__s 77>>;< < rc$|jyN)close)r typevalue tracebacks r__exit__zaddbase.__exit__!s  r) r __module__ __qualname____doc__r rrr# __classcell__rs@rrrsY B rrc,eZdZdZfdZfdZxZS)rz*Class to add a close hook to an open file.cHtt| |||_||_yr)r rr closehookhookargs)r r r+r,rs rr zaddclosehook.__init__(s  lD*2."  rc |j}|j}|rd|_d|_||tt|y#tt|wxYwr)r+r,r rr)r r+r,rs rrzaddclosehook.close-sN .I}}H!% $ 8$ , + -E, + -s -AA)rr$r%r&r rr'r(s@rrr%s4! . .rrc(eZdZdZfdZdZxZS)rz.class to add an info() method to an open file.c:tt| |||_yr)r rr headers)r r r0rs rr zaddinfo.__init__<s gt%b) rc|jSr)r0rs rinfoz addinfo.info@s ||r)rr$r%r&r r2r'r(s@rrr9s8rrc@eZdZdZdfd ZedZdZdZxZ S)rz9class to add info() and geturl() methods to an open file.cJtt| ||||_||_yr)r rr urlcode)r r r0r5r6rs rr zaddinfourl.__init__Gs" j$(W5 rc|jSrr6rs rstatuszaddinfourl.statusLs yyrc|jSrr8rs rgetcodezaddinfourl.getcodePs yyrc|jSr)r5rs rgeturlzaddinfourl.geturlSs xxrr) rr$r%r&r propertyr9r;r=r'r(s@rrrDs)C rr)r&tempfile__all___TemporaryFileWrapperrrrrrrrCsJ >h,,..7.(gr