관리-도구
편집 파일: _compression.cpython-39.pyc
a �����DOg�����������������������@���s:���d�Z�ddlZejZG�dd��dej�ZG�dd��dej�ZdS�)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�rtd��d�S�)NzI/O operation on closed file)�closed� ValueError��self��r����$/usr/lib64/python3.9/_compression.py�_check_not_closed���s����zBaseStream._check_not_closedc�����������������C���s���|�����st�d��d�S�)NzFile not open for reading)�readable�io�UnsupportedOperationr���r���r���r����_check_can_read���s����zBaseStream._check_can_readc�����������������C���s���|�����st�d��d�S�)NzFile not open for writing)�writabler���r���r���r���r���r����_check_can_write���s����zBaseStream._check_can_writec�����������������C���s(���|�����st�d��|����s$t�d��d�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�����������������������sj���e�Zd�ZdZdd��Zddd�Z��fdd�Zd d ��Zdd��Zddd�Z dd��Z ejfdd�Z dd��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|�_||�_||�_|�jf�i�|�j��|�_||�_d�S�)NFr������)�_fp�_eof�_pos�_size�_decomp_factory�_decomp_args� _decompressor�_trailing_error)r����fp�decomp_factory�trailing_error�decomp_argsr���r���r����__init__'���s����zDecompressReader.__init__c��������������������s���d�|�_�t�����S��N)r����super�closer����� __class__r���r���r'���;���s����zDecompressReader.closec�����������������C���s ���|�j����S�r%���)r���r���r���r���r���r���r���?���s����zDecompressReader.seekablec�������������� ���C���sx���t�|��X}|�d��.}|��t|��}||d�t|��<�W�d�����n1�sH0����Y��W�d�����n1�sf0����Y��t|�S�)N�B)� memoryview�cast�read�len)r����b�view� byte_view�datar���r���r����readintoB���s����LzDecompressReader.readintor���c�����������������C���s����|dk�r|�����S�|r|�jrdS�d�}|�jjr�|�jjp<|�j�t�}|sDq�|�jf�i�|�j ��|�_z|�j� ||�}W�q��|�jy����Y�q�Y�q�0�n4|�jjr�|�j�t�}|s�t d��nd}|�j� ||�}|r"q�q"|s�d|�_|�j|�_dS�|��jt|�7��_|S�)Nr��������zACompressed file ended before the end-of-stream marker was reachedT)�readallr���r����eof�unused_datar���r-����BUFFER_SIZEr���r���� decompressr����needs_input�EOFErrorr���r���r.���)r����sizer2����rawblockr���r���r���r-���H���s@���� �� zDecompressReader.readc�����������������C���s0���|�j��d��d|�_d|�_|�jf�i�|�j��|�_d�S�)Nr���F)r����seekr���r���r���r���r���r���r���r���r����_rewindr���s����zDecompressReader._rewindc�����������������C���s����|t�jkrnR|t�jkr"|�j|�}n<|t�jkrP|�jdk�rD|��t�j�rDq6|�j|�}ntd� |���||�jk�rr|�� ���n ||�j8�}|dkr�|��tt�j|��}|s�q�|t|�8�}q||�jS�)Nr���zInvalid value for whence: {}) r����SEEK_SET�SEEK_CURr����SEEK_ENDr���r-����DEFAULT_BUFFER_SIZEr����formatr?����minr.���)r����offset�whencer2���r���r���r���r>���x���s&���� zDecompressReader.seekc�����������������C���s���|�j�S�)z!Return the current file position.)r���r���r���r���r����tell����s����zDecompressReader.tell)r���)r���)r���r���r���r���r ���r$���r'���r���r3���r-���r?���r���r@���r>���rH���� __classcell__r���r���r(���r���r���!���s��� *r���)r���r���rC���r8����BufferedIOBaser���� RawIOBaser���r���r���r���r����<module>���s���