3
§ fû ã @ s^ d Z ddlZddddgZG dd„ dejƒZG dd„ deƒZG d d„ deƒZG d
d„ deƒZdS )a Response 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Ú
addinfourlc s8 e Zd ZdZ‡ fdd„Zdd„ Zdd„ Zdd „ Z‡ ZS )
r zOBase class for addinfo and addclosehook. Is a good idea for garbage collection.c s t t| ƒj|ddd� || _d S )NzF)Údelete)Úsuperr Ú__init__Úfp)Úselfr )Ú __class__© ú4/opt/alt/python36/lib64/python3.6/urllib/response.pyr s zaddbase.__init__c C s d| j jt| ƒ| jf S )Nz<%s at %r whose fp = %r>)r Ú__name__ÚidÚfile)r
r r r
Ú__repr__ s zaddbase.__repr__c C s | j jrtdƒ‚| S )NzI/O operation on closed file)r ÚclosedÚ
ValueError)r
r r r
Ú __enter__ s zaddbase.__enter__c C s | j ƒ d S )N)Úclose)r
ÚtypeÚvalueÚ tracebackr r r
Ú__exit__! s zaddbase.__exit__) r Ú
__module__Ú__qualname__Ú__doc__r r r r Ú
__classcell__r r )r r
r s
c s, e Zd ZdZ‡ fdd„Z‡ fdd„Z‡ ZS )r z*Class to add a close hook to an open file.c s t t| ƒj|ƒ || _|| _d S )N)r r r Ú closehookÚhookargs)r
r r r )r r r
r ( s zaddclosehook.__init__c s> z(| j }| j}|r&d