o
    d<                     @   sB  d dl 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m	Z	 d dl
m  mZ d dlmZ d dlmZ ejdd Zejdd Zejdd	 Zejd
d Zejdd Zejdddd Zejdd Zddddddddddejdedd ejd!edd gZejed"d d#d$d% Zejed#d&d' ZdS )(    N)is_ci_environmentis_platform_armis_platform_macis_platform_windowsread_csvc                 C      | ddddS )zPath to the tips datasetiodatacsvtips.csv datapathr   r   ]/var/www/html/visualizacion-main/env/lib/python3.10/site-packages/pandas/tests/io/conftest.py	tips_file      r   c                 C   r   )zPath to a JSONL datasetr	   parserr
   items.jsonlr   r   r   r   r   
jsonl_file   r   r   c                 C   s   t | ddddddS )z#DataFrame with the salaries datasetr	   r   r
   zsalaries.csv	)sepr   r   r   r   r   salaries_table!   s   r   c                 C   r   )Nr	   r
   featherzfeather-0_3_1.featherr   r   r   r   r   feather_file'   s   r   c                 C   s:   t  rd}n| dkrdn| d} d|  d}dd|iiS )	Nzhttp://localhost:5000/master5gwzhttp://127.0.0.1:555/client_kwargsendpoint_url)r   lstrip)	worker_idurlr   r   r   s3so,   s
   r$   session)scopec              
   c   s   t d t d t  tjdd tjdd t r4t s*t	 s*t
 r0t d ndV  nt d	}t jd
dd t d | dkrKdn| d} d|  }d| d}tjtd| tjtjd8}d}|dkrz||}|jr}W nW n	 ty   Y nw |d8 }td |dksr|V  |  W d   n 1 sw   Y  W d   dS W d   dS W d   dS W d   dS 1 sw   Y  dS )z
    Fixture for mocking S3 interaction.

    Sets up moto server in separate process locally
    Return url for motoserver/moto CI service
    s3fsboto3AWS_ACCESS_KEY_ID
foobar_keyAWS_SECRET_ACCESS_KEYfoobar_secretzOS3 tests do not have a corresponding service in Windows, macOS or ARM platformszhttp://localhost:5000requestsmotoz1.3.14)
minversionflaskr   r   r   555zhttp://127.0.0.1:r   zmoto_server s3 -p )stdoutstderr   r   皙?N)pytestimportorskiptm!ensure_safe_environment_variablesosenviron
setdefaultr   r   r   r   skipr!   
subprocessPopenshlexsplitDEVNULLgetok	Exceptiontimesleep	terminate)r"   r-   endpoint_portendpoint_uriproctimeoutrr   r   r   s3_base6   s^   









"rN   c                 #   s   ddl }ddl}d|fd|fd|d fd|d fd	|fd
|fg fdd}d}|jd| d}|jd| d z j|d W n	 tyI   Y nw z	 jddd W n	 ty\   Y nw d}	  d s||	dkr|td |	d8 }	  d s||	dksi|| |d |j	
  |V  |j	d| id}
z	|
j|dd W n	 ty   Y nw z	|
jddd W n	 ty   Y nw d}	  d r|	dkrtd |	d8 }	  d r|	dksdS dS dS dS )a0  
    Sets up S3 bucket with contents

    The primary bucket name is "pandas-test". The following datasets
    are loaded.

    - tips.csv
    - tips.csv.gz
    - tips.csv.bz2
    - items.jsonl

    A private bucket "cant_get_it" is also created. The boto3 s3 resource
    is yielded by the fixture.
    r   Nz
tips#1.csvr   ztips.csv.gz.gzztips.csv.bz2.bz2r   zsimple_dataset.featherc              	      sL   D ]!\}}t |d} j| ||d W d    n1 sw   Y  qd S )Nrb)BucketKeyBody)open
put_object)bucket_names3_key	file_namefclitest_s3_filesr   r   add_tips_files   s   z#s3_resource.<locals>.add_tips_fileszpandas-tests3)r    )rR   cant_get_itprivate)rR   ACL   Bucketsr5   r    )r   T)	recursive)r(   r'   resourceclientcreate_bucketrE   list_bucketsrF   rG   S3FileSystemclear_instance_cacherm)rN   r   r   r   r(   r'   r^   bucketconnrL   r_   r   r[   r   s3_resourceu   sb   

	


$ro   )z.no_compressN) N)rO   gzip)z.GZrq   )rP   bz2)z.BZ2rr   )z.zipzip)z.ZIPrs   )z.xzxz)z.XZrt   )z.zstzstd	zstandard)marks)z.ZSTru      )paramsc                 C   s   | j S )Nparamrequestr   r   r   compression_format   s   r~   c                 C   s
   | j d S )Nr   rz   r|   r   r   r   compression_ext   s   
r   ) r:   r@   r>   rF   r6   pandas.compatr   r   r   r   pandas.util._test_decoratorsutil_test_decoratorstdpandas._testing_testingr8   pandas.io.parsersr   fixturer   r   r   r   r$   rN   ro   r{   
skip_if_no_compression_formats_paramsr~   r   r   r   r   r   <module>   sP    





	
>
I

