a
    Oªf·  ã                   @  s¸   d Z ddlmZ ddlmZ ddlmZ zddlZdZW n e	yN   dZY n0 zddl
Z
dZW n e	yv   dZY n0 dd	d
œdd„ZeržG dd„ dejƒZer´G dd„ de
jƒZdS )zC
Patched ``BZ2File`` and ``LZMAFile`` to handle pickle protocol 5.
é    )Úannotations)ÚPickleBuffer)ÚPY310NTFz-bytes | bytearray | memoryview | PickleBufferzbytes | bytearray | memoryview)ÚbÚreturnc                 C  sT   t | ttfƒr| S t | tƒs$t| ƒ} z
|  ¡ W S  tyN   t| ƒ d¡ Y S 0 dS )z²
    Return some 1-D `uint8` typed buffer.

    Coerces anything that does not match that description to one that does
    without copying if possible (otherwise will copy).
    ÚAN)Ú
isinstanceÚbytesÚ	bytearrayr   ÚrawÚBufferErrorÚ
memoryviewÚtobytes)r   © r   úR/var/www/ai-form-bot/venv/lib/python3.9/site-packages/pandas/compat/compressors.pyÚflatten_buffer   s    


r   c                      s&   e Zd Zesddœ‡ fdd„Z‡  ZS )ÚBZ2FileÚint©r   c                   s   t ƒ  t|ƒ¡S ©N©ÚsuperÚwriter   ©Úselfr   ©Ú	__class__r   r   r   7   s    zBZ2File.write©Ú__name__Ú
__module__Ú__qualname__r   r   Ú__classcell__r   r   r   r   r   4   s   r   c                      s&   e Zd Zesddœ‡ fdd„Z‡  ZS )ÚLZMAFiler   r   c                   s   t ƒ  t|ƒ¡S r   r   r   r   r   r   r   F   s    zLZMAFile.writer   r   r   r   r   r"   C   s   r"   )Ú__doc__Ú
__future__r   Úpickler   Zpandas.compat._constantsr   Úbz2Zhas_bz2ÚImportErrorÚlzmaZhas_lzmar   r   r"   r   r   r   r   Ú<module>   s$   

