
    Pi                        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dS )    )annotationsN)TYPE_CHECKINGAny)import_optional_dependency)Callable)Path)	DataFrameSeriesobjr   tmp_pathr   returnDataFrame | Seriesc                T    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)r   r   s     g/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/pandas/_testing/_io.pyround_trip_pickler      s&      Lh>(###    c                2     | |            ||          }|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(    $ F8
&

CJr   testpathstrdestNonec                4   |f}d}d}| dk    rt           j        }d}||f}d}n| dk    rRt          j        }d}t          j        |          }t          j        |          }	t          |          |_        ||	f}d}nd| d	k    rt          j
        }nQ| 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           dS # 1 swxY w Y   dS )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)compressionr   datar   argsr.   methodcompress_methodfilebytesr*   r;   fs                r   write_to_compressedrG   H   s   & "GDDF e!/d|			!/D)))
4  II	e}			-			


+			4[AAF			-H;HHIII 
D	)	)	) "Q6D!!" " " " " " " " " " " " " " " " " "s   ,DDD)r   r   r   r   r   r   )r   r   )r   )r   r   r   r   r   r   )
__future__r   r)   r4   r1   typingr   r   r/   pandas.compat._optionalr   pandasr   collections.abcr   pathlibr   r	   r
   r   r   rG   r   r   r   <module>rN      s"   " " " " " "  				          > > > > > >     ((((((       $ $ $ $(   .9" 9" 9" 9" 9" 9" 9"r   