Ë
    ýÿæiŒ  ã                  óš   — d dl mZ d dlZd dlZd dlZd dlmZmZ d dlZd dl	m
Z
 d dlZerd dlmZ d dlmZ d dlmZmZ dd„Zdd	„Zddd
„Zy)é    )ÚannotationsN)ÚTYPE_CHECKINGÚAny)Úimport_optional_dependency)ÚCallable)ÚPath)Ú	DataFrameÚSeriesc                óX   — t        j                  | |«       t        j                  |«      S )a�  
    Pickle an object and then read it again.

    Parameters
    ----------
    obj : any object
        The object to pickle and then re-read.
    path : str, path object or file-like object, default None
        The path where the pickled object is written and then read.

    Returns
    -------
    pandas object
        The original object that was pickled and then re-read.
    )ÚpdÚ	to_pickleÚread_pickle)ÚobjÚtmp_paths     úh/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/pandas/_testing/_io.pyÚround_trip_pickler      s!   € ô  ‡L�L��hÔÜ�>‰>˜(Ó#Ð#ó    c                ó&   —  | |«        ||«      }|S )aÛ  
    Write an object to file specified by a pathlib.Path and read it back

    Parameters
    ----------
    writer : callable bound to pandas object
        IO writing function (e.g. DataFrame.to_csv )
    reader : callable
        IO reading function (e.g. pd.read_csv )
    path : str, default None
        The path where the object is written and then read.

    Returns
    -------
    pandas object
        The original object that was serialized and then re-read.
    © )ÚwriterÚreaderr   r   s       r   Úround_trip_pathlibr   1   s   € ñ$ ˆ8ÔÙ
�Ó
€CØ€Jr   c                ó2  — |f}d}d}| dk(  rt         j                  }d}||f}d}nÄ| dk(  rTt        j                  }d}t        j                  |¬«      }t        j                  |«      }	t        |«      |_        ||	f}d}nk| d	k(  rt        j                  }nU| d
k(  rddl}
|
j                  }n?| dk(  rt        d«      j                  }n$| dk(  rddl}|j                   }nt#        d| › �«      ‚ |||¬«      5 } t%        ||«      |Ž  ddd«       y# 1 sw Y   yxY w)a¦  
    Write data to a compressed file.

    Parameters
    ----------
    compression : {'gzip', 'bz2', 'zip', 'xz', 'zstd'}
        The compression type to use.
    path : str
        The file path to write the data.
    data : str
        The data to write.
    dest : str, default "test"
        The destination file (for ZIP only)

    Raises
    ------
    ValueError : An invalid compression value was passed in.
    ÚwbÚwriteÚzipÚwÚwritestrÚtar)ÚnameÚaddfileÚgzipÚbz2r   NÚzstdÚ	zstandardÚxzzUnrecognized compression type: )Úmode)ÚzipfileÚZipFileÚtarfileÚTarFileÚTarInfoÚioÚBytesIOÚlenÚsizer"   ÚGzipFiler#   ÚBZ2Filer   ÚopenÚlzmaÚLZMAFileÚ
ValueErrorÚgetattr)ÚcompressionÚpathÚdataÚdestÚargsr'   ÚmethodÚcompress_methodÚfileÚbytesr#   r4   Úfs                r   Úwrite_to_compressedrB   H   s  € ð& "˜G€DØ€DØ€Fð �eÒÜ!Ÿ/™/ˆØˆØ�dˆ|ˆØ‰Ø	˜Ò	Ü!Ÿ/™/ˆØˆÜ�‰ DÔ)ˆÜ—
‘
˜4Ó ˆÜ˜“IˆŒ	Ø�eˆ}ˆØ‰Ø	˜Ò	ÜŸ-™-‰Ø	˜Ò	ÛàŸ+™+‰Ø	˜Ò	Ü4°[ÓA×FÑF‰Ø	˜Ò	ÛàŸ-™-‰äÐ:¸;¸-ÐHÓIÐIñ 
˜ DÕ	)¨QØŒ��6Ó˜DÑ!÷ 
*×	)Ñ	)ús   Ã4DÄD)r   r   r   r   ÚreturnzDataFrame | Series)r   r   )Útest)r9   Ústrr;   rE   rC   ÚNone)Ú
__future__r   r"   r-   r*   Útypingr   r   r(   Úpandas.compat._optionalr   Úpandasr   Úcollections.abcr   Úpathlibr   r	   r
   r   r   rB   r   r   r   Ú<module>rM      s>   ðÝ "ã Û 	Û ÷ó å >ã áÝ(Ý÷ó$ó(õ.9"r   