HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/zstandard/__pycache__/__init__.cpython-310.pyc
o

���g��@s�dZddlmZmZddlZddlZddlZddlZddlm	Z	ej
�dd�Zedkr]e�
�dvr8dd	lTd
Znhe�
�dvrEdd	lTdZn[zdd	lTd
ZWnRey\dd	lTdZYnDwed
kryzdd	lTd
ZWn6eyxdd	lTdZYn(wedkr�dd	lTdZned
kr�dd	lTd
Znedkr�dd	lTdZnede��dZdZdZdZ							ddd�Zdde	dedefdd�Zd de	dedefdd�ZdS)!z=Python interface to the Zstandard (zstd) compression library.�)�absolute_import�unicode_literalsN)�
ByteString�PYTHON_ZSTANDARD_IMPORT_POLICY�default)�CPython�)�*�cext)�PyPy�cffi�
cffi_fallback�rustzKunknown module import policy: %s; use default, cffi_fallback, cext, or cffiz0.23.0��rbcCs |�dd�}|dvr|pt�}d}	d}
n|dvr+|pt�}d}	|}
|
�d�s*|
d}
ntd	�|���ttd
�r>tt	tj
f}ntt	f}t||�rPt�
||
�}d}nt|d�sZt|d
�ra|}t|�}ntd��|	dkrq|j||d�}
n|	dkr}|j||d�}
ntd��d|vr�tj|
|||d�S|
S)a�Create a file object with zstd (de)compression.

    The object returned from this function will be a
    :py:class:`ZstdDecompressionReader` if opened for reading in binary mode,
    a :py:class:`ZstdCompressionWriter` if opened for writing in binary mode,
    or an ``io.TextIOWrapper`` if opened for reading or writing in text mode.

    :param filename:
       ``bytes``, ``str``, or ``os.PathLike`` defining a file to open or a
       file object (with a ``read()`` or ``write()`` method).
    :param mode:
       ``str`` File open mode. Accepts any of the open modes recognized by
       ``open()``.
    :param cctx:
       ``ZstdCompressor`` to use for compression. If not specified and file
       is opened for writing, the default ``ZstdCompressor`` will be used.
    :param dctx:
       ``ZstdDecompressor`` to use for decompression. If not specified and file
       is opened for reading, the default ``ZstdDecompressor`` will be used.
    :param encoding:
        ``str`` that defines text encoding to use when file is opened in text
        mode.
    :param errors:
       ``str`` defining text encoding error handling mode.
    :param newline:
       ``str`` defining newline to use in text mode.
    :param closefd:
       ``bool`` whether to close the file when the returned object is closed.
        Only used if a file object is passed. If a filename is specified, the
        opened file is always closed when the returned object is closed.
    �t�)�rrrr)�w�wb�a�ab�x�xbr�bzInvalid mode: {!r}�PathLikeT�read�writez6filename must be a str, bytes, file or PathLike object)�closefdz2logic error in zstandard.open() handling open mode)�encoding�errors�newline)�replace�ZstdDecompressor�ZstdCompressor�endswith�
ValueError�format�hasattr�os�str�bytesr�
isinstance�builtins�open�bool�	TypeError�
stream_reader�
stream_writer�RuntimeError�io�
TextIOWrapper)�filename�mode�cctx�dctxrr r!r�normalized_mode�	open_mode�
raw_open_mode�types�inner_fh�fh�r@�=/usr/local/lib/python3.10/dist-packages/zstandard/__init__.pyr.ZsF)


�


��r.��data�level�returncCst|d�}|�|�S)a�Compress source data using the zstd compression format.

    This performs one-shot compression using basic/default compression
    settings.

    This method is provided for convenience and is equivalent to calling
    ``ZstdCompressor(level=level).compress(data)``.

    If you find yourself calling this function in a tight loop,
    performance will be greater if you construct a single ``ZstdCompressor``
    and repeatedly call ``compress()`` on it.
    )rD)r$�compress)rCrDr8r@r@rArF�s

rF�max_output_sizecCst�}|j||d�S)a�Decompress a zstd frame into its original data.

    This performs one-shot decompression using basic/default compression
    settings.

    This method is provided for convenience and is equivalent to calling
    ``ZstdDecompressor().decompress(data, max_output_size=max_output_size)``.

    If you find yourself calling this function in a tight loop, performance
    will be greater if you construct a single ``ZstdDecompressor`` and
    repeatedly call ``decompress()`` on it.
    )rG)r#�
decompress)rCrGr9r@r@rArH�s
rH)rNNNNNN)rB)r)�__doc__�
__future__rrr-r4r)�platform�typingr�environ�get�_module_policy�python_implementation�	backend_c�backend�backend_cffi�ImportError�backend_rust�__version__�_MODE_CLOSED�
_MODE_READ�_MODE_WRITEr.�intr+rFrHr@r@r@rA�<module>st����
�W