
    gf6                        d dl Z d dlZd dlZd dlZd dlmZ 	 d dlm	c m
Z 	 d dlm	c mZ 	 d dlZej"                  dk(  r	 d dlZ	 d dl
Zd dlZ ej,                   ej.                  dd            Z ej2                   ej4                               Z ej2                   ej8                               Z ej2                   ej<                               Z ej2                   ej@                               Z! ej2                   ejD                               Z# ej2                   ejH                               Z% ejL                  ej<                   ejN                  d d            Z( ejR                  ee!e#e%e(      Z* ejV                   ejX                          ejZ                          ej\                          ej^                         g      Z0 ejV                   ejb                          ejd                          ejf                          ejh                         g      Z5 ejR                  e0e5      Z6 ejV                   ejn                          ejp                          ejr                         g      Z: ejL                  ejv                   ejN                  d	d
       ejN                  d	d
            Z< ejL                  ejz                   ejN                  d	d       ejN                  d	d            Z> ejR                  e6e:e<e>      Z? ejV                   ej                          ej                         g      ZB ejV                   ej                  d       ej                  d       ej                  d       ej                  d      g      ZEerDerB ejR                   ej                          ej                          ej                               ZGnyer2 ejR                   ej                          ej                               ZGnEer2 ejR                   ej                          ej                               ZGn ej                         ZG ejL                  ej                   ejV                  g d      eG      ZI ejL                  ej                   ejV                  g d            ZK ej2                   ej                               ZM ejR                  eBeEeIeKeM      ZN ejR                  eee?eNe*      ZO ej                   ej,                          ej,                               ZQej                  eOfd       ZSeOfdZTej                  eOfd       ZUd#dZVej                  eOeOfd       ZWeOdfdZX ej                  d       ZZ eSeZ      Z[ eXeZ      Z\ ejN                  d d      Z]ej                  d$d       Z^ej                  d$d       Z_ej                  d%d       Z`ej                  d&d       Zaej                  d#d       Zbej                  d#d        Zc e`eZ      Zd eaeZ      Ze ebeZ      Zf eceZ      Zg ejR                  eee6 ejV                   ejp                          ejr                         g      e<eBeEeMee!e#e%      Zh ejR                  ee6ee!e(      Ziehfd!Zj ej                  d"       Zky# e$ r dZY w xY w# e$ r dZY w xY w# e$ r dZY w xY w# e$ r dZY w xY w# e$ r dZY w xY w)'    Nwin32A   ~   )min_codepointmax_codepoint)alphabet   	min_value	max_value   &   )	precisionscaleL   smsusns)r   r   r   r   )unittzc                      | t               } | |      }t        j                  j                  |      rd}n | t	        j
                               } | t              }t        j                  ||||      S )NT)typenullablemetadata)custom_textpatypesis_nullstbooleansr   field)drawtype_strategynametypr   metas         M/var/www/openai/venv/lib/python3.12/site-packages/pyarrow/tests/strategies.pyfieldsr)      s[    D
}
C	xx&>D88DsXEE    c           	         t        j                  t        j                  |       t        j                  t        j                  |       z  t        j                  t        j                  | t        j
                  dd            z  t        j                  t        j                  |       z  t        j                  t        j                  |       z  S )Nr   r	   r
   )r    buildsr   list_
large_listintegers	list_viewlarge_list_viewitem_strategys    r(   
list_typesr4      s    
		"((M*
		"--/	0
		HHKK!r2	
	
 			",,.	/ 			"$$m4	5
r*   c                    t        j                  t        |            } | |      }|D cg c]  }|j                   }}t	        j
                  t        t        |            t        |      k(         t        j                  |      S c c}w N)
r    listsr)   r%   hassumelensetr   struct)r#   r3   fields_strategyfields_renderedr"   field_namess         r(   struct_typesr@      sk    hhvm45O?+O+:;?%5::?K;HHS[!"c+&66799_%% <s   Bc           	      .   | t         } |gt        j                  t        t        t        j
                  t        j                         t        j                         g      t        t        t              }t        j                  t        j                  | |      S r6   )signed_integer_typesr    one_of	bool_typeinteger_typessampled_fromr   float32float64binary_typestring_typefixed_size_binary_typer,   
dictionary)key_strategyvalue_strategys     r(   dictionary_typesrO      sf    +OORZZ\2::<89"
 99R]]L.AAr*   c                      | |      }t        j                  t        j                  j	                  |               | |      }t        j
                  ||      S r6   )r8   r9   r   r   r   map_)r#   rM   r3   key_type
value_types        r(   	map_typesrT      sG     L!HHH!!(++,m$J778Z((r*   c                     t        j                  t        |       |      }t        j                  t        j
                  |      S )N)max_size)r    r7   r)   r,   r   schema)r$   
max_fieldschildrens      r(   schemasrZ      s,    xx}-
CH99RYY))r*   c                      t         t               z  t               z  t               z  t	               z  t        t
              z  t        t
              z  S r6   )primitive_typesr4   r@   rO   rT   	all_types r*   r(   <lambda>r_      sP    		 		 			
 	9	 	Y	 r*      c                 J     | t        ||d            }|j                         S NFsizer   )arrays	to_pylist)r#   rS   rd   r   arrs        r(   _pylistrh      s!    
vjte<
=C==?r*   c                      | |      } | t        ||d            } | t        |||            }t        t        ||            S rb   )rh   listzip)r#   rR   rS   rd   r   lengthkeysvaluess           r(   _pymapro      sC    $ZFv>?D'*6HEFFD&!""r*   c           	         t        |t        j                        r	 | |      }n(t        |t        j                        r|}nt        d      t        |t        j                        r	 | |      }n*| | t              }nt        |t              st        d      t        j                  j                  |      r+t        j                  |       t        j                         }nt        j                  j                  |      rt        j                         }nt        j                  j                  |      rC | t!        j"                  |j%                         |f            }t        j&                  ||      S t        j                  j)                  |      r[ | t!        j"                  |j%                         |f            }d|t+        j,                  |      <   t        j&                  ||      S t        j                  j/                  |      rt        j0                          nt        j                  j3                  |      rt        j4                         }nWt        j                  j7                  |      rt        j8                         }n"t        j                  j;                  |      r.t<        t?        j@                  d       |jB                  t?        j@                  d       d}d	}tD        jD                  jG                  |d
z        tE        jH                  d      z   }	tD        jD                  jG                  |d
z        tE        jH                  d      z
  }
	 |jB                  jK                  d      }t        |d         }t        |d         }tE        jH                  ||      }t        jP                  t        jR                  |      |	|
      }nt        j                  jU                  |      rt        jV                         }nt        j                  jY                  |      rt        jV                         }njt        j                  j[                  |      st        j                  j]                  |      rt        j^                         }nt        j                  ja                  |      st        j                  jc                  |      rt        jd                         }nt        j                  jg                  |      r-t        j^                  |jh                  |jh                        }nvt        j                  jk                  |      rtm        |jn                  ||      }n=t        j                  jq                  |      rtm        |jn                  ||      }nt        j                  js                  |      r$tm        |jn                  |jt                  |      }nt        j                  jw                  |      rtm        |jn                  ||      }nt        j                  jy                  |      rtm        |jn                  ||      }nOt        j                  j{                  |      r5tm        |jn                  ||      }t        j&                   | |      |      S t        j                  j}                  |      r(t        |j                  |j                  t        |      }nt        j                  j                  |      rt        j                  t        |      dkD         g g }}|D ]?  }|j                  |       |j                   | t#        |j                  |                   A t        j                  j                  ||      S t        |      |r(t        j                  t        j                               }t        j                  ||      }t        j&                   | |      |      S # tL        $ r# t=        jN                  |jB                        }Y w xY w)NzType must be a pyarrow DataTypezSize must be an integer)shaper   g      Ez/no module named zoneinfo (or tzdata on Windows)zrequires timezone not Nonel         l    i ʚ;   )hours:r   r   )rt   minutes)	timezonesr   r   min_sizerV   rc   rd   )r)   )K
isinstancer    SearchStrategyr   DataType	TypeError_default_array_sizesintr   r   r8   r9   none
is_booleanr!   
is_integernpstre   to_pandas_dtypearrayis_floatingnpisnan
is_decimalrejectis_timetimesis_datedatesis_timestampzoneinfopytestskipr   datetimefromtimestamp	timedeltasplit
ValueErrorZoneInfo	datetimesjustis_duration
timedeltasis_interval	is_binaryis_large_binarybinary	is_stringis_large_stringtextis_fixed_size_binary
byte_widthis_listrh   rS   is_large_listis_fixed_size_list	list_sizeis_list_viewis_large_list_viewis_dictionaryis_mapro   rR   	item_type	is_structr:   appendr   StructArrayfrom_arraysNotImplementedErrorrC   r7   )r#   r   rd   r   tyvaluern   	min_int64	max_int64min_datetimemax_datetimeoffsetoffset_hours
offset_minr   r)   child_arraysr"   s                     r(   re   re     s   $))*$Z	D"++	&9::$))*Dz	()c"122	xx					R	 			R	 dkk""4"4"6tgFGxxR((			b	!dkk""4"4"6tgFG $)rxx xxR((			R	  	

			"	
			"	
			r	"KKIJ55=KK45		((66 "*"4"42">?((66 "*"4"42">?	*UU[[%Fvay>LVAYJ##,
KB rwwr{l'35			b	!			b	!			B	288#;#;B#?					B	288#;#;B#?			&	&r	*		2==2==I			"	D8D				#D8D		$	$R	(BLL8L			r	"D8D		$	$R	(D8D				#THExxV2..		r{{BLL7K (*			B		R1!2EMM% VEJJT%B CD  ~~)),v)FF!"%%		"'')U+XXedT:F88DLr**Y  	*""255)B	*s   &A` (a ?a c                 0   t        |t        j                        r | |      }t        j                  t
        j                  j                  |              t        ||      }t        j                  |||      }t        j                   | |      |      S )Nrz   rx   rr   )r{   r    r|   r8   r9   r   r   r   re   r7   chunked_array)r#   r   
min_chunks
max_chunks
chunk_sizechunkchunkss          r(   chunked_arraysr   f  sp    $))*Dz HH##D))*4j)EXXej:FFDLt44r*   c           	      b   t        |t        j                        r	 | |      }n*| | t              }nt        |t              st        d       | t        ||            }|D cg c]  } | t        |j                  |            ! }}t        j                  j                  ||      S c c}w NzRows must be an integer)rX   rz   )rW   )r{   r    r|   r   r   r~   rZ   re   r   r   RecordBatchr   r#   r   rowsrX   rW   r"   rY   s          r(   record_batchesr   t  s    $))*Dz	()c"122'$:67FAGHVEJJT23HH >>%%hv%>> I   %$B,c           	      b   t        |t        j                        r	 | |      }n*| | t              }nt        |t              st        d       | t        ||            }|D cg c]  } | t        |j                  |            ! }}t        j                  j                  ||      S c c}w r   )r{   r    r|   r   r   r~   rZ   re   r   r   Tabler   r   s          r(   tablesr     s    $))*Dz	()c"122'$:67FAGHVEJJT23HH8888 Ir   c                     t        j                  t        j                  |       t        j                  t        j                  |       z  S r6   )r    r,   r   r-   r.   r2   s    r(   pandas_compatible_list_typesr     s2     			"((M*
		"--/	0r*   c            
          t        j                  t        t        t              t	        t              t        t              t        t              t	        t                    S )N)rN   )r    rC   !pandas_compatible_primitive_typesr   r@   rO   (pandas_compatible_dictionary_value_typespandas_compatible_typesr^   r*   r(   r_   r_     sA    BII)$%FG67C	
 	%%<=,-	r*   )NN)T)NT)r   NN)lr   sysr   
hypothesisr8   hypothesis.strategies
strategiesr    hypothesis.extra.numpyextranumpyr   ImportErrorhypothesis.extra.pytzpytztzstr   platformtzdatar   pyarrowr   r   
charactersr   r   null	null_typebool_rD   r   rI   stringrJ   large_binarylarge_binary_typelarge_stringlarge_string_typer,   r/   rK   rC   binary_like_typesrF   int8int16int32int64rB   uint8uint16uint32uint64unsigned_integer_typesrE   float16rG   rH   floating_types
decimal128decimal128_type
decimal256decimal256_typenumeric_typesdate32date64
date_typestime32time64
time_typesr   rw   	timestamptimestamp_typesdurationduration_typesmonth_day_nano_intervalinterval_typestemporal_typesr\   dictionariesr   	compositer)   r4   r@   rO   rT   rZ   deferredr]   
all_fieldsall_schemasr   rh   ro   re   r   r   r   
all_arraysall_chunked_arraysall_record_batches
all_tablesr   r   r   r   r^   r*   r(   <module>r     s  $  
   "))(( <<7  bggR]] BGGGBGGI	BGGHBHHJ	bggibiik"bggibiik"BGGOBOO-. BGGOBOO-. "IIBKK!r*  BII  'rBGGIBHHJBHHJBHHJ	(   )BHHJBIIKBIIKBIIK	*   		.0FG BJJLBJJLBJJL" 
 "))MMbkkA4
"++R
0
 "))MMbkkA4
"++R
0
 		-)?< R__BIIKBIIK 
 R__BIIcNBIIdOBIIdOBIIdO	 
 H		'"'')^T^^%5|r||~FI			'"'')^T^^%56I		'"'')\R\\^4I	I"))LL	0	1
 KKBOO+, 33356 ")) 2??72779gbggi0 . F F -  %4 & &B !0+) ) *d *
 BKK
	 I
i  #r{{Q"=   
 # # a+ a+H 
5 
5 ? ? 
9 
9 I
#I. #I. I
 %.BIIBOOZRZZ\:2::<01
 !% !* ,5299, ( 4 &"++	 U  D  D  H
    	BsW   	[ 	[ [#  [1 [? [[[ [ #[.-[.1[<;[<?\
	\
