
    Mh`                        S SK Jr  S SKrS SKrS SKrS SKrS SKJrJrJ	r	  S SK
r
S SKrS SKJrJr  S SKJr  S SKrS SKJr  \(       a  S SKJrJr  S SKJrJr   S     SS	 jjrSSS
 jjrSSS jjrSSS jjrg)    )annotationsN)TYPE_CHECKINGAnyCallable)get_bz2_fileget_lzma_file)import_optional_dependency)ensure_clean)FilePathReadPickleBuffer)	DataFrameSeriesc                    UnUc  S[         R                  " 5        S3n[        U5       n[        R                  " X5        [        R
                  " U5      sSSS5        $ ! , (       d  f       g= f)aQ  
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       E/var/www/html/env/lib/python3.13/site-packages/pandas/_testing/_io.pyround_trip_pickler   '   sP    $ E}TZZ\N),	e		
S$~~i( 
		s   ,A  
A.c                    [         R                  nUc  Sn[        U5       nU " U" U5      5        U" U" U5      5      nSSS5        U$ ! , (       d  f       W$ = f)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   sW    $ <<D|	d	ttDzT$Z  
 J 
	 Js   A
Ac                    SSK nUR                  S5      R                  nUc  Sn[        U5       nU " U" U5      5        U" U" U5      5      nSSS5        U$ ! , (       d  f       W$ = f)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)   \   sg    $ ##I.44I| 	d	tyYt_% 
 J 
	 Js   A
A&c                    U4nSnSnU S:X  a  [         R                  nSnX24nSnOU S:X  aR  [        R                  nSn[        R                  " US9n[
        R                  " U5      n	[        U5      Ul        X4nSnOcU S	:X  a  [        R                  nOLU S
:X  a  [        5       nO;U S:X  a  [        S5      R                  nOU S:X  a  [        5       nO[        SU  35      eU" XS9 n
[!        X5      " U6   SSS5        g! , (       d  f       g= f)aj  
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    & "GDDF e!//|		!//D)

4 I	}		--		&.		4[AFF		'/:;-HII		)QD! 
*	)	)s   'C??
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\   