ok
Direktori : /lib64/python3.6/__pycache__/ |
Current File : //lib64/python3.6/__pycache__/bz2.cpython-36.opt-1.pyc |
3 \�0 � @ s� d Z ddddddgZdZdd lmZ dd lZdd lZdd lZdd l Z yddl mZ W n ek rt ddl mZ Y nX ddlmZmZ dZd ZdZG dd� de j�Zddd�Zddd�Zdd� Zd S )z�Interface to the libbzip2 compression library. This module provides a file interface, classes for incremental (de)compression, and functions for one-shot (de)compression. �BZ2File� BZ2Compressor�BZ2Decompressor�open�compress� decompressz%Nadeem Vawda <nadeem.vawda@gmail.com>� )r N)�RLock)r r � � c @ s� e Zd ZdZd)dd�Zdd� Zed d � �Zdd� Zd d� Z dd� Z dd� Zd*dd�Zd,dd�Z d.dd�Zdd� Zd0dd�Zd2dd �Zd!d"� Zd#d$� Zejfd%d&�Zd'd(� ZdS )3r a@ A file object providing transparent bzip2 (de)compression. A BZ2File can act as a wrapper for an existing file object, or refer directly to a named file on disk. Note that BZ2File provides a *binary* file interface - data read is returned as bytes, and data to be written should be given as bytes. �rN� c C sT t � | _d| _d| _t| _|dk r.tjdt� d| ko@dkn sNt d��|dkr`d }t }nb|dkr|d}t}t|�| _ nF|dkr�d }t}t|�| _ n*|dkr�d}t}t|�| _ nt d|f ��t|tttjf�� r�t||�| _d| _|| _n.t|d��st|d��r|| _|| _ntd��| jt k�rJtj| jttd�}tj|�| _nd| _dS )a> Open a bzip2-compressed file. If filename is a str, bytes, or PathLike object, it gives the name of the file to be opened. Otherwise, it should be a file object, which will be used to read or write the compressed data. mode can be 'r' for reading (default), 'w' for (over)writing, 'x' for creating exclusively, or 'a' for appending. These can equivalently be given as 'rb', 'wb', 'xb', and 'ab'. buffering is ignored. Its use is deprecated. If mode is 'w', 'x' or 'a', compresslevel can be a number between 1 and 9 specifying the level of compression: 1 produces the least compression, and 9 (default) produces the most compression. If mode is 'r', the input file may be the concatenation of multiple compressed streams. NFz)Use of 'buffering' argument is deprecatedr r z%compresslevel must be between 1 and 9� r �rb�w�wb�x�xb�a�abzInvalid mode: %rT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorr )r r r )r r )r r )r r )r �_lock�_fp�_closefp�_MODE_CLOSED�_mode�warnings�warn�DeprecationWarning� ValueError� _MODE_READ�_MODE_WRITEr �_compressor� isinstance�str�bytes�os�PathLike� _builtin_open�hasattr� TypeError�_compressionZDecompressReaderr �OSError�io�BufferedReader�_buffer�_pos)�self�filename�mode� buffering� compresslevelZ mode_code�raw� r7 �/usr/lib64/python3.6/bz2.py�__init__+ sL zBZ2File.__init__c C s� | j �� | jtkrdS z<| jtkr.| jj� n"| jtkrP| jj| j j � � d| _ W dz| jrf| jj� W dd| _d| _t| _d| _X X W dQ R X dS )z�Flush and close the file. May be called more than once without error. Once the file is closed, any other operation on it will raise a ValueError. NF)r r r r r/ �closer! r r r"