
    j?                     p   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j,                   ej.                  ddd	
            Z ej,                   ej.                  dd            Z ej6                   ej8                               Z ej6                   ej<                               Z ej6                   ej@                               Z! ej6                   ejD                               Z# ej6                   ejH                               Z% ej6                   ejL                               Z' ejP                  ej@                   ejR                  d d            Z* ejV                  e!e#e%e'e*      Z, ejZ                   ej\                          ej^                          ej`                          ejb                         g      Z2 ejZ                   ejf                          ejh                          ejj                          ejl                         g      Z7 ejV                  e2e7      Z8 ejZ                   ejr                          ejt                          ejv                         g      Z< ejP                  ejz                   ejR                  dd       ejR                  dd            Z> ejP                  ej~                   ejR                  dd       ejR                  dd            Z@ ejP                  ej                   ejR                  dd       ejR                  dd            ZB ejP                  ej                   ejR                  dd       ejR                  dd            ZD ejV                  e8e<eBeD      ZE ejZ                   ej                          ej                         g      ZH ejZ                   ej                  d       ej                  d       ej                  d       ej                  d      g      ZK eLdd      D  cg c]o  } dD ]h  } e j                  d       e j                  | |      cxk  r e j                  d      k  r'n n$ e j                   e j                  | |            j q c}} ZOej                  d        ZQ eQ       ZRerEerC ejV                   ej                          ej                          ej                         eR      ZTner3 ejV                   ej                          ej                         eR      ZTnWer3 ejV                   ej                          ej                         eR      ZTn" ejV                   ej                         eR      ZT ejP                  ej                   ejZ                  g d       eT!      ZV ejP                  ej                   ejZ                  g d             ZX ej6                   ej                               ZZ ejV                  eHeKeVeXeZ      Z[ ejV                  eeeEe[e,      Z\ ej                   ej,                          ej,                               Z^ej                  e\dfd"       Z_e\fd#Z`ej                  e\fd$       Zad3d%Zbej                  e\e\fd&       Zce\dfd'Zd ej                  d(       Zf ejV                   e_ef       e_efe)       e_efe)            Zg edef      Zh ejR                  d d*      Ziej                  d4d+       Zjej                  d4d,       Zkej                  d5d-       Zlej                  d6d.       Zmej                  d3d/       Znej                  d3d0       Zo elef      Zp emef      Zq enef      Zr eoef      Zs ejV                  eee8 ejZ                   ejt                          ejv                         g      eBeHeKeZe!e#e%e'      Zt ejV                  ee8e!e#e*      Zuetfd1Zv ej                  d2       Zwy# e$ r dZY Uw xY w# e$ r dZY Yw xY w# e$ r dZY bw xY w# e$ r dZY \w xY w# e$ r dZY ew xY wc c}} w )7    Nwin32A   ~   )min_codepointmax_codepoint)alphabet)LlLuNd0   z   )whitelist_categoriesr   r   i   i    	min_value	max_value   	   )	precisionscale   &   L   smsusnsi   )r      -   hoursr"   minutes   c                 @     | t        j                  t                    S N)stsampled_from_fixed_offset_timezone_list)draws    ?/tmp/pip-target-jj7clzyk/lib/python/pyarrow/tests/strategies.py_draw_fixed_offset_timezoner-      s     ;<==    )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_nullr(   booleansr4   field)r+   type_strategyname_strategynametypr3   metas          r,   fieldsr@      sf    #D
}
C	xx&>D88DsXEEr.   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(   buildsr6   list_
large_listintegers	list_viewlarge_list_viewitem_strategys    r,   
list_typesrJ      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 r'   )
r(   listsr@   r=   hassumelensetr6   struct)r+   rI   fields_strategyfields_renderedr:   field_namess         r,   struct_typesrU      sj    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 r'   )signed_integer_typesr(   one_of	bool_typeinteger_typesr)   r6   float32float64binary_typestring_typefixed_size_binary_typerB   
dictionary)key_strategyvalue_strategys     r,   dictionary_typesrc      sf    +OORZZ\2::<89"
 99R]]L.AAr.   c                      | |      }t        j                  t        j                  j	                  |               | |      }t        j
                  ||      S r'   )rM   rN   r6   r7   r8   map_)r+   ra   rI   key_type
value_types        r,   	map_typesrh      sG     L!HHH!!(++,m$J778Z((r.   c                     t        j                  t        |       |      }t        j                  t        j
                  |      S )N)max_size)r(   rL   r@   rB   r6   schema)r;   
max_fieldschildrens      r,   schemasrn     s,    xx}-
CH99RYY))r.   c                      t         t               z  t               z  t               z  t	               z  t        t
              z  t        t
              z  S r'   )primitive_typesrJ   rU   rc   rh   	all_types r.   r,   <lambda>rs     sU    		 		 			
 	9	 	Y	  r.   )r<      c                 J     | t        ||d            }|j                         S NFsizer3   )arrays	to_pylist)r+   rg   rx   r3   arrs        r,   _pylistr|   '  s!    
vjte<
=C==?r.   c                      | |      } | t        ||d            } | t        |||            }t        t        ||            S rv   )r|   listzip)r+   rf   rg   rx   r3   lengthkeysvaluess           r,   _pymapr   -  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                         }ngt        j                  j7                  |      rt        j8                         }n2t        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      \  }}|jM                  d      rdnd}tE        jH                  tO        t        |            t        |            }tE        jP                  ||z        }t        jV                  t        jX                  |      |	|
      }nt        j                  j[                  |      r|j\                  dv r5tD        jH                  j^                  }tD        jH                  j`                  }np|j\                  dk(  r5d	}|dz  }tE        jH                  |       }tE        jH                  |      }n,tE        jH                  d      }tE        jH                  d      }t        jb                  ||      }nt        j                  je                  |      rAt        jb                  tE        jH                  d      tE        jH                  d            }njt        j                  jg                  |      st        j                  ji                  |      rt        jj                         }nt        j                  jm                  |      st        j                  jo                  |      rt        jp                         }nt        j                  js                  |      r-t        jj                  |jt                  |jt                        }nvt        j                  jw                  |      rty        |jz                  ||      }n=t        j                  j}                  |      rty        |jz                  ||      }nt        j                  j                  |      r$ty        |jz                  |j                  |      }nt        j                  j                  |      rty        |jz                  ||      }nt        j                  j                  |      rty        |jz                  ||      }nOt        j                  j                  |      r5ty        |jz                  ||      }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 # tR        $ r# t=        jT                  |jB                        }Y lw xY w)NzType must be a pyarrow DataTypezSize must be an integer)shaper2   g      Ez/no module named zoneinfo (or tzdata on Windows)zrequires timezone not Nonel         l    i ʚ;   r!   :-r   r#   )	timezonesr   r   )r   r   r   l    `;P )daysiiKw r   min_sizerj   rw   r   rx   )r@   )Q
isinstancer(   SearchStrategyr6   DataType	TypeError_default_array_sizesintr7   r8   rM   rN   none
is_booleanr9   
is_integernpstry   to_pandas_dtypearrayis_floatingnpisnan
is_decimalrejectis_timetimesis_datedatesis_timestampzoneinfopytestskipr0   datetimefromtimestamp	timedeltasplit
startswithabstimezone
ValueErrorZoneInfo	datetimesjustis_durationr/   minmax
timedeltasis_interval	is_binaryis_large_binarybinary	is_stringis_large_stringtextis_fixed_size_binary
byte_widthis_listr|   rg   is_large_listis_fixed_size_list	list_sizeis_list_viewis_large_list_viewis_dictionaryis_mapr   rf   	item_type	is_structrO   appendr2   StructArrayfrom_arraysNotImplementedErrorrX   rL   )r+   r2   rx   r3   tyvaluer   	min_int64	max_int64min_datetimemax_datetimeoffset_hours
offset_minsignoffsetr0   r   r   max_daysr@   child_arraysr:   s                         r,   ry   ry   5  se   $))*$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{{3'7$L*%00521D''#l+,c*oGF""4&=1B rwwr{l'35			b	!77k! **..I **..IWW_!I ]3H **	:I **9I !**8I **7I	YG			b	!((g6((f5
 
		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EMM% VEJJT%B CD	E ~~)),v)FF!"%%		"'')U+XXedT:F88DLr**y  	*""255)B	*s   &A=d$ $(eec                     t        |t        j                        r | |      }t        ||      }t        j                  |||      }t        j                   | |      |      S )Nr   r   r   )r   r(   r   ry   rL   r6   chunked_array)r+   r2   
min_chunks
max_chunks
chunk_sizechunkchunkss          r,   chunked_arraysr     sP    $))*Dz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)rl   r   )rk   )r   r(   r   r   r   r   rn   ry   r2   r6   RecordBatchr   r+   r2   rowsrl   rk   r:   rm   s          r,   record_batchesr     s    $))*Dz	()c"122'$:67FAGHVEJJT23HH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   rn   ry   r2   r6   Tabler   r   s          r,   tablesr     s    $))*Dz	()c"122'$:67FAGHVEJJT23HHH8888 Ir   c                     t        j                  t        j                  |       t        j                  t        j                  |       z  S r'   )r(   rB   r6   rC   rD   rH   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)rb   )r(   rX   !pandas_compatible_primitive_typesr   rU   rc   (pandas_compatible_dictionary_value_typespandas_compatible_typesrr   r.   r,   rs   rs     sC    BII)$%FG67C	
 	%%<=,-	 r.   )NN)T)NT)r   NN)xr   sysr   
hypothesisrM   hypothesis.strategies
strategiesr(   hypothesis.extra.numpyextranumpyr   ImportErrorhypothesis.extra.pytzpytztzstr   platformtzdatar   pyarrowr6   r   
charactersr5   alphanum_textsurrogate_textr   null	null_typebool_rY   r   r]   stringr^   large_binarylarge_binary_typelarge_stringlarge_string_typerB   rE   r_   rX   binary_like_typesr)   int8int16int32int64rW   uint8uint16uint32uint64unsigned_integer_typesrZ   float16r[   r\   floating_types	decimal32decimal32_type	decimal64decimal64_type
decimal128decimal128_type
decimal256decimal256_typenumeric_typesdate32date64
date_typestime32time64
time_typesranger   r   r*   	compositer-   fixed_offset_timezonesr   r   	timestamptimestamp_typesdurationduration_typesmonth_day_nano_intervalinterval_typestemporal_typesrp   dictionariesr4   r@   rJ   rU   rc   rh   rn   deferredrq   
all_fieldsall_schemasr   r|   r   ry   r   r   r   
all_arraysall_chunked_arraysall_record_batches
all_tablesr   r   r   r   )rM   ms   00r,   <module>r:     s  $  
   "))(( <<7  bggR]] R]]/ 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" 
 LLbkkA3
"++Q
/
 LLbkkA4
"++R
0
 "))MMbkkA4
"++R
0
 "))MMbkkA4
"++R
0
 		-)?< R__BIIKBIIK 
 R__BIIcNBIIdOBIIdOBIIdO	 
 3^	 	
x$x1-$x#$ H(h((q!<==  > > 56 H			>4>>#\R\\^5KMI			'"'')^T^^%57MNI		'"'')\R\\^5KLI		'"'')%;<I"))LL	0	1
 KKBOO+, 33356 ")) 2??72779gbggi0 .d 
F 
F -  %4 & &B !0+) ) *d *
 BKK
	 RYY
9
9M2
9N3

 i  #r{{Q"=   
 # # r+ r+j 5 5 
? 
? 
9 
9 I
#I. #I. I
 %.BIIBOOZRZZ\:2::<01
 !% !* ,5299, ( 4 &"++	 U  D  D  H
    	BPs^   	a, 	a: b  b b$ 6A4b2,a76a7:bbbbb! b!$b/.b/