o
9j1 @ sB d Z ddlZddlZejZG dd dejZG dd dejZdS )z7Internal classes used by the gzip, lzma and bz2 modules Nc @ s0 e Zd ZdZdd Zdd Zdd Zdd Zd
S )
BaseStreamzMode-checking helper functions.c C s | j rtdd S )NzI/O operation on closed file)closed
ValueErrorself r #/usr/lib/python3.10/_compression.py_check_not_closed s zBaseStream._check_not_closedc C | s tdd S )NzFile not open for reading)readableioUnsupportedOperationr r r r _check_can_read
zBaseStream._check_can_readc C r
)NzFile not open for writing)writabler r
r r r r _check_can_write r zBaseStream._check_can_writec C s( | s td| stdd S )Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r r r
seekabler r r r _check_can_seek s
zBaseStream._check_can_seekN)__name__
__module____qualname____doc__r r r r r r r r r s r c sr e Zd ZdZdd ZdddZ fddZd d
Zdd ZdddZ dd Z
dd Zej
fddZdd Z ZS )DecompressReaderz5Adapts the decompressor API to a RawIOBase reader APIc C s dS )NTr r r r r r $ s zDecompressReader.readabler c K sB || _ d| _d| _d| _|| _|| _| jdi | j| _|| _d S )NFr r )_fp_eof_pos_size_decomp_factory_decomp_args
_decompressor_trailing_error)r fpdecomp_factorytrailing_errordecomp_argsr r r __init__' s
zDecompressReader.__init__c s d | _ t S N)r supercloser __class__r r r) ; s
zDecompressReader.closec C s
| j S r' )r r r r r r r ? s
zDecompressReader.seekablec C s t |9}|d}| t|}||d t|<