
    Wh=                     p   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c mZ d dlmZ d dlmZ ej        d             Zej        d             Zej        d             Zej        d             Zej        d             Z ej        d	
          d             Zej        d             Zdddddddddd ej        d ej        d                     ej        d ej        d                    gZ ej        edd                   d             Z ej        e          d             ZdS )    N)is_ci_environmentis_platform_armis_platform_macis_platform_windowsread_csvc                      | dddd          S )zPath to the tips datasetiodatacsvtips.csv datapaths    ^/var/www/html/movieo_spanner_bot/venv/lib/python3.11/site-packages/pandas/tests/io/conftest.py	tips_filer      s     8D&%444    c                      | dddd          S )zPath to a JSONL datasetr
   parserr   items.jsonlr   r   s    r   
jsonl_filer      s     8D(FM:::r   c                 <    t           | dddd          d          S )z#DataFrame with the salaries datasetr
   r   r   zsalaries.csv	)sepr   r   s    r   salaries_tabler   !   s'     HHT8V^DD$OOOOr   c                      | dddd          S )Nr
   r   featherzfeather-0_3_1.featherr   r   s    r   feather_filer   '   s    8D&)-DEEEr   c                 v    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urls     r   s3sor)   ,   sX     2&$00CCi6F6Ft6L6L	1Y111nc233r   session)scopec              #   2  K   t          j        d           t          j        d           t          j                    5  t          j                            dd           t          j                            dd           t                      rFt                      st                      st                      rt          j        d           n2dV  n,t          j        d	          }t          j        d
d           t          j        d           | dk    rdn|                     d          } d|  }d| d}t          j        t          j        d|           t          j        t          j                  5 }d}|dk    rN	 |                    |          }|j        rn0n# t(          $ r Y nw xY w|dz  }t+          j        d           |dk    N|V  |                                 ddd           n# 1 swxY w Y   ddd           dS # 1 swxY w 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'   r3   endpoint_portendpoint_uriproctimeoutrs          r   s3_baserT   6   s      
   		-	/	/ 2! 2! 	
1<@@@

5GGG -	!   .O$5$5 .9L9N9N . 6   
 .----*:66H8<<<<(((
  )H44):J:J4:P:PI-)--M?}???L !@@@AA!)!)   ! kk$LL664 "!"$   sNGJsOOO kk #"""   '! ! ! ! ! ! ! ! ! ! ! ! ! ! !?2! 2! 2! 2! 2! 2! 2! 2! 2! 2! 2! 2! 2! 2! 2! 2! 2! 2!sZ   D;H9	G4F!G4!
F.+G4-F..:G4(H4G8	8H;G8	<HHHc              #     K   ddl }ddl}d|fd|fd|dz   fd|dz   fd	|fd
|fgfd}d}|                    d|           }|                    d|           	                     |           n# t
          $ r Y nw xY w	                     dd           n# t
          $ r Y nw xY wd}	                                d         s?|	dk    r9t          j        d           |	dz  }	                                d         s|	dk    9 ||            |d           |j	        
                                 |V  |	                    d| i          }
	 |
                    |d           n# t
          $ r Y nw xY w	 |
                    dd           n# t
          $ r Y nw xY wd}	                                d         rA|	dk    r?t          j        d           |	dz  }	                                d         r
|	dk    9d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                     D ]E\  }}t          |d          5 }                    | ||           d d d            n# 1 swxY w Y   Fd S )Nrb)BucketKeyBody)open
put_object)bucket_names3_key	file_namefclitest_s3_filess       r   add_tips_filesz#s3_resource.<locals>.add_tips_files   s    !. 	G 	GFIi&& G!kvAFFFG G G G G G G G G G G G G G G	G 	Gs   >A	A	zpandas-tests3)r%   )rZ   cant_get_itprivate)rZ   ACL   Bucketsr;   r%   )r$   T)	recursive)r.   r-   resourceclientcreate_bucketrK   list_bucketsrL   rM   S3FileSystemclear_instance_cacherm)rT   r   r   r   r.   r-   re   bucketconnrR   rf   rc   rd   s              @@r   s3_resourcerv   v   s       LLLKKK 
y!	Y		E)*	V+,	
#	!<0MG G G G G G
 F>>$W>55D
,,t',
2
2C((((   I>>>>    G  + !
33   + ! N6N=!!!**,,,
JJJ			.')B		C	CB
f%%%%   
mt,,,,   G




Y
' GaKK
33 



Y
' GaKKKK    KKsH   A5 5
BBB 
B+*B+E- -
E:9E:>F 
F#"F#)z.no_compressN) N)rV   gzip)z.GZrx   )rW   bz2)z.BZ2ry   )z.zipzip)z.ZIPrz   )z.xzxz)z.XZr{   )z.zstzstd	zstandard)marks)z.ZSTr|      )paramsc                     | j         S )Nparamrequests    r   compression_formatr      s
    =r   c                     | j         d         S )Nr   r   r   s    r   compression_extr      s    =r   ) r@   rF   rD   rL   r<   pandas.compatr   r   r   r   pandas.util._test_decoratorsutil_test_decoratorstdpandas._testing_testingr>   pandas.io.parsersr   fixturer   r   r   r   r)   rT   rv   r   
skip_if_no_compression_formats_paramsr   r   r   r   r   <module>r      sk   				                   * ) ) ) ) ) ) ) )       & & & & & & 5 5 5
 ; ; ;
 P P P
 F F F 4 4 4 i   <! <! ! <!~ E E ER FL!{)C)CDDDFL!{)C)CDDD   21226777  87 2333  43  r   