Ë
    ¤eh`  ã                  óÜ   — d dl mZ d dlZd dlZd dlZd dlZd dlmZmZm	Z	 d dl
Z
d dlZd dlmZmZ d dlmZ d dlZd dlmZ erd dlmZmZ d dlmZmZ 	 d	 	 	 	 	 dd	„Zddd
„Zddd„Zddd„Zy)é    )ÚannotationsN)ÚTYPE_CHECKINGÚAnyÚCallable)Úget_bz2_fileÚget_lzma_file)Úimport_optional_dependency)Úensure_clean)ÚFilePathÚReadPickleBuffer)Ú	DataFrameÚSeriesc                óÒ   — |}|€dt        j                  «       › d�}t        |«      5 }t        j                  | |«       t        j
                  |«      cddd«       S # 1 sw Y   yxY w)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.
    NÚ__z	__.pickle)ÚuuidÚuuid4r
   ÚpdÚ	to_pickleÚread_pickle)ÚobjÚpathÚ_pathÚ	temp_paths       úQ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/pandas/_testing/_io.pyÚround_trip_pickler   '   s[   € ð$ €EØ€}Ø”T—Z‘Z“\�N )Ð,ˆÜ	�eÓ	ð ) 	Ü
�‰�S˜)Ô$Ü�~‰~˜iÓ(÷)÷ )ò )ús   ¨+AÁA&c                ó¨   — t         j                  }|€d}t        |«      5 } |  ||«      «        | ||«      «      }ddd«       |S # 1 sw Y   S xY w)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.
    NÚ___pathlib___)ÚpathlibÚPathr
   )ÚwriterÚreaderr   r   r   s        r   Úround_trip_pathlibr"   A   sY   € ô$ �<‰<€DØ€|ØˆÜ	�dÓ	ð !˜tÙ‰t�D‹zÔÙ‘T˜$“ZÓ ˆ÷!ð €J÷!ð €Jús    AÁAc                óÆ   — ddl }|j                  d«      j                  }|€d}t        |«      5 } |  ||«      «        | ||«      «      }ddd«       |S # 1 sw Y   S xY w)aá  
    Write an object to file specified by a py.path LocalPath 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.
    r   Nzpy.pathÚ___localpath___)ÚpytestÚimportorskipÚlocalr
   )r    r!   r   r%   Ú	LocalPathr   s         r   Úround_trip_localpathr)   \   si   € ó$ à×#Ñ# IÓ.×4Ñ4€IØ€|Ø ˆÜ	�dÓ	ð &˜tÙ‰y˜‹ÔÙ‘Y˜t“_Ó%ˆ÷&ð €J÷&ð €Jús   ¯AÁA c                ó  — |f}d}d}| dk(  rt         j                  }d}||f}d}n¸| dk(  rTt        j                  }d}t        j                  |¬«      }t        j                  |«      }	t        |«      |_        ||	f}d}n_| d	k(  rt        j                  }nI| d
k(  rt        «       }n9| dk(  rt        d«      j                  }n| dk(  rt        «       }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Úbz2ÚzstdÚ	zstandardÚxzzUnrecognized compression type: )ÚmodeN)ÚzipfileÚZipFileÚtarfileÚTarFileÚTarInfoÚioÚBytesIOÚlenÚsizer3   ÚGzipFiler   r	   Úopenr   Ú
ValueErrorÚgetattr)Úcompressionr   ÚdataÚdestÚargsr8   ÚmethodÚcompress_methodÚfileÚbytesÚfs              r   Úwrite_to_compressedrO   y   s  € ð& "˜G€DØ€DØ€Fð �eÒÜ!Ÿ/™/ˆØˆØ�dˆ|ˆØ‰Ø	˜Ò	Ü!Ÿ/™/ˆØˆÜ�‰ DÔ)ˆÜ—
‘
˜4Ó ˆÜ˜“IˆŒ	Ø�eˆ}ˆØ‰Ø	˜Ò	ÜŸ-™-‰Ø	˜Ò	Ü&›.‰Ø	˜Ò	Ü4°[ÓA×FÑF‰Ø	˜Ò	Ü'›/‰äÐ:¸;¸-ÐHÓIÐIá	˜ DÔ	)ð "¨QØŒ��6Ó˜DÑ!÷"÷ "ñ "ús   Ã(DÄD
)N)r   r   r   z"FilePath | ReadPickleBuffer | NoneÚreturnzDataFrame | Series)r   z
str | None)Útest)rH   ÚstrrP   ÚNone)Ú
__future__r   r3   r>   r   r;   Útypingr   r   r   r   r9   Úpandas.compatr   r   Úpandas.compat._optionalr	   Úpandasr   Úpandas._testing.contextsr
   Úpandas._typingr   r   r   r   r   r"   r)   rO   © ó    r   ú<module>r]      st   ðÝ "ã Û 	Û Û ÷ñ ó
 Û ÷õ ?ã Ý 1á÷÷
ð :>ð)Ø	ð)Ø6ð)àó)ô4ô6õ:1"r\   