gL i#jddlmZddlZddlZddlmZddlmZddlm Z m Z ddl m Z GddZGdd eZGd d eZGd d eZGddeZGddeZej(dZej(dZeZeZeZeZegZeegZej:eej<j>ej<jAe dggZ!geee!Z"dgZ#ddgZ$dgZ%ge$e#e%Z&ej(e"e&dZ'ej(ee$dZ(ej(ee#dZ)ej(e!e%dZ*d Z+ej(e+d!e+d"d#Z,gd$Z-gd%Z.d&d'gZ/e.Dcgc]}e/D] }||d( c}}Z0ej(e-)d*Z1ej(e0)d+Z2ej(gd,)d-Z3ej(d.Z4ej(d/Z5ycc}}w)0) annotationsN) HAS_PYARROW)VERSIONS)read_csv read_tablecneZdZUdZded<dZgZded<dZdZddd  dd Z d Z dd  dd Z y) BaseParserNz str | NoneengineTzlist[str | None]float_precision_choicescv|j}|j|j|jd|S)N)r low_memory)copyupdater r )selfkwargss e/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pandas/tests/io/parser/conftest.py update_kwargszBaseParser.update_kwargss+ DOOLM c:|j|}t|i|SN)rrrargsrs rrzBaseParser.read_csvs"##F+(((r)raise_on_extra_warningscheck_stacklevelc|j|}tj||||5t|i|cdddS#1swYyxYw)N)matchrr)rtmassert_produces_warningr)r warn_typewarn_msgrrrrs rread_csv_check_warningsz"BaseParser.read_csv_check_warnings sR##F+  ' ' $;-   - T,V,  - - -s AA c:|j|}t|i|Sr)rrrs rrzBaseParser.read_table5s"##F+4*6**r)rc|j|}tj|||5t|i|cdddS#1swYyxYw)N)rr)rrrr)rrr rrrs rread_table_check_warningsz$BaseParser.read_table_check_warnings9sN##F+  ' ' X?V  /t.v. / / /s ?A)r type[Warning]r strrbool)rr%r r&) __name__ __module__ __qualname__r __annotations__r r rrr!rr$rrr r sqFJJ02-2 )!%!% - --  -*+!% / //rr ceZdZdZgdZy)CParserc)Nhigh round_tripNr(r)r*r r r,rrr.r.Ks F:rr.ceZdZdZy)CParserHighMemoryFNr(r)r*r r,rrr4r4PsJrr4ceZdZdZy)CParserLowMemoryTNr5r,rrr7r7TsJrr7ceZdZdZdgZy) PythonParserpythonNr2r,rrr9r9Xs F#frr9ceZdZdZdgZy) PyArrowParserpyarrowNr2r,rrr<r<]s F#frr<c|dddS)zG The directory path to the data files needed for parser tests. ioparserdatar,datapaths r csv_dir_pathrDbs D(F ++rcRtjj|ddddS)zH The path to the data file "test1.csv" needed for parser tests. r?rAcsvz test1.csv)ospathjoinrBs rcsv1rJjs" 77<<vu5{ CCrpyarrow is not installedreasonmarksr:c_highc_lowr=paramsidsc|j}|jdk(r2tjdtdddl}|j d|S)z) Fixture all of the CSV parsers. r=rN)paramr pytest importorskiprr= set_cpu_count)requestr@r=s r all_parsersr\sH ]]_F }} !Ix ':; a Mrc"|jS)z< Fixture all of the CSV parsers using the C engine. rWr[s r c_parser_onlyr` ==?rc"|jS)zA Fixture all of the CSV parsers using the Python engine. r^r_s rpython_parser_onlyrcrarc"|jS)zB Fixture all of the CSV parsers using the Pyarrow engine. r^r_s rpyarrow_parser_onlyrerarcg}g}tttD]\}}t|dr|jd}|j D]}|j dk(r@tjjtjjt dgnd}tj||f|}|j||j|d|||d S) za Return all allowable parser and float precision combinations and corresponding ids. valuesrr=rKrLr,rN-rR)zip _all_parsers_all_parser_idshasattrrgr r rXmark single_cpuskipifrrWappend)rSrTr@ parser_id precisionrmrWs r,_get_all_parser_float_precision_combinationsrss F C ?3 68 $]]1%F77 3I==I- KK**KK&&'0J' LL&(I!6dCE MM% JJ)Ai[1 2 3 3(S ))rrSrTc|jS)zR Fixture for all allowable combinations of parser and float precision r^r_s rall_parsers_all_precisionsrus ==r) )rh_utfUTFz{0})rSc|jS)zE Fixture for all possible integer values for a UTF encoding. r^r_s r utf_valuer~ ==rc|jS)zD Fixture for all possible string formats of a UTF encoding. r^r_s r encoding_fmtrrr)*)z-1,0)z-1,2e0g333333)z-1e0r)z+1e0?)z+1e+0r)z+1e-1皙?)z+,1e1r)z+1,e0r)z-,1e1r)z-1,e0r)z0,1r)z1,r)z,1r)z-,1g)z1_,r)z1_234,56 ףp=J@)z 1_234,56e0r)rzrz)-_r)-_1r)-_1e0r)_1r)_1,r)_1,_r)_1e0r)1,2e_1r)1,2e1_0r)1,_2r),1__2r),1er)-,1er) 1_000,000_000r)1,e1_2r)e11,2r)1e11,2r)1,2,2r)1,2_1r) 1,2e-10e1r)--1,2r)1a_2,1r)z1,2E-1gQ?)z1,2E1g(@c|jS)z Fixture for all numeric formats which should get recognized. The first entry represents the value to read while the second represents the expected result. r^r_s rnumeric_decimalrsh ==rcd|jvr|jd}n$d|jvr|jdd}ny|jdk(r2tjj d}|j |yy)z Fixture that xfails a test if the engine is pyarrow. Use if failure is do to unsupported keywords or inconsistent results. r\rurNr=zpyarrow doesn't support this.rL) fixturenamesgetfixturevaluer rXrmxfail applymarker)r[r@rms r pyarrow_xfailr/s,,,((7 %)=)= =(()EFqI }} !{{  (G HD!"rcd|jvr|jd}n$d|jvr|jdd}ny|jdk(rtjdyy)z Fixture that skips a test if the engine is pyarrow. Use if failure is do a parsing failure from pyarrow.csv.read_csv r\rurNr=z,https://github.com/apache/arrow/issues/38676rL)rrr rXskip)r[r@s r pyarrow_skiprBsg,,,((7 %)=)= =(()EFqI }} ! IJ"r)6 __future__rrGrX pandas.compatrpandas.compat._optionalrpandasrrpandas._testing_testingrr r.r4r7r9r<fixturerDrJ_cParserHighMemory_cParserLowMemory _pythonParser_pyarrowParser_py_parsers_only_c_parsers_onlyrWrmrnro_pyarrow_parsers_onlyrj_py_parser_ids _c_parser_ids_pyarrow_parsers_idsrkr\r`rcrersru _utf_values_encoding_seps_encoding_prefixes_encoding_fmtsr~rrrr)sepprefixs00rrs" %,7/7/t;j; w%:% %J% ,,DD'$ !?%'89FLL KK " " KK  ;7Q  R ML#3L6KL 7# !{JMJNJ5IJ|9 : M:;'^<=,2FGH*< 7 9( C46u=  U^&4!BT8>vhse5 {#$~&', .^_.^""$KKAs$H/