zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
U
­ý°d!ã+@stddlmZddlZddlZddlmZddlmZmZddl    m
Z Gdd„dƒZ Gdd„de ƒZ Gd    d
„d
e ƒZGd d „d e ƒZGd d„de ƒZGdd„de ƒZejdd„ƒZejdd„ƒZeZeZeZeZegZeegZejeejjdgZeee•ZdgZ ddgZ!dgZ"e!e e"•Z#ejee#ddd„ƒZ$ejee!ddd„ƒZ%ejee ddd „ƒZ&ejee"dd!d"„ƒZ'd#d$„Z(eje(ƒd%e(ƒd&dd'd(„ƒZ)d)d*d+gZ*d,d-d.gZ+d/d0gZ,d1d2„e+DƒZ-eje*d3d4d5„ƒZ.eje-d3d6d7„ƒZ/ejd8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dag*d3dbdc„ƒZ0ejddde„ƒZ1ejdfdg„ƒZ2dS)hé)Ú annotationsN)ÚVERSIONS)Úread_csvÚ
read_tablec@sbeZdZUdZded<dZgZded<dd„Zd    d
„Zd d d œdd„Z    dd„Z
d d d œdd„Z dS)Ú
BaseParserNz
str | NoneÚengineTzlist[str | None]Úfloat_precision_choicescCs | ¡}| |j|jdœ¡|S)N)rÚ
low_memory)ÚcopyÚupdaterr    )ÚselfÚkwargs©rúVd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/io/parser/conftest.pyÚ update_kwargsszBaseParser.update_kwargscOs| |¡}t||ŽS©N)rr©r Úargsr rrrrs
zBaseParser.read_csvz type[Warning]Ústr)Ú    warn_typeÚwarn_msgc
Os:| |¡}tj||dt||ŽW5QR£SQRXdS©N)Úmatch)rÚtmÚassert_produces_warningr©r rrrr rrrÚread_csv_check_warningss
z"BaseParser.read_csv_check_warningscOs| |¡}t||ŽSr)rrrrrrr)s
zBaseParser.read_tablec
Os:| |¡}tj||dt||ŽW5QR£SQRXdSr)rrrrrrrrÚread_table_check_warnings-s
z$BaseParser.read_table_check_warnings) Ú__name__Ú
__module__Ú __qualname__rÚ__annotations__r    rrrrrrrrrrrs
 
rc@seZdZdZdddgZdS)ÚCParserÚcNÚhighZ
round_trip©rrr rrrrrrr"8sr"c@seZdZdZdS)ÚCParserHighMemoryFN©rrr r    rrrrr&=sr&c@seZdZdZdS)ÚCParserLowMemoryTNr'rrrrr(Asr(c@seZdZdZdgZdS)Ú PythonParserÚpythonNr%rrrrr)Esr)c@seZdZdZdgZdS)Ú PyArrowParserÚpyarrowNr%rrrrr+Jsr+cCs |dddƒS)zG
    The directory path to the data files needed for parser tests.
    ÚioÚparserÚdatar©ÚdatapathrrrÚ csv_dir_pathOsr2cCstj |dddƒd¡S)zH
    The path to the data file "test1.csv" needed for parser tests.
    r-r/Úcsvz    test1.csv)ÚosÚpathÚjoinr0rrrÚcsv1Wsr7©Zmarksr*Zc_highZc_lowr,©ÚparamsÚidscCs8| ¡}|jdkr4t dtd¡ddl}| d¡|S)z)
    Fixture all of the CSV parsers.
    r,rNé)ÚparamrÚpytestZ importorskiprr,Z set_cpu_count)Úrequestr.r,rrrÚ all_parsersqs 
 
r@cCs| ¡S)z<
    Fixture all of the CSV parsers using the C engine.
    ©r=©r?rrrÚ c_parser_onlysrCcCs| ¡S)zA
    Fixture all of the CSV parsers using the Python engine.
    rArBrrrÚpython_parser_only‰srDcCs| ¡S)zB
    Fixture all of the CSV parsers using the Pyarrow engine.
    rArBrrrÚpyarrow_parser_only‘srEcCsŽg}g}tttƒD]p\}}t|dƒr.|jd}|jD]L}|jdkrJtjj    nd}tj
|ƒ|f|d}|  |¡|  |›d|›¡q4q||dœS)za
    Return all allowable parser and float precision
    combinations and corresponding ids.
    Úvaluesrr,rr8ú-r9) ÚzipÚ _all_parsersÚ_all_parser_idsÚhasattrrFrrr>ÚmarkÚ
single_cpur=Úappend)r:r;r.Z    parser_idZ    precisionrLr=rrrÚ,_get_all_parser_float_precision_combinations™s
 
 
 
rOr:r;cCs|jS)zR
    Fixture for all allowable combinations of parser
    and float precision
    rArBrrrÚall_parsers_all_precisions®s    rPééé ÚrGÚ_ÚutfZUTFcCs&g|]}tD]}|›|›d‘q qS)z{0})Ú_encoding_prefixes)Ú.0ÚsepÚprefixrrrÚ
<listcomp>¿sr[)r:cCs|jS)zE
    Fixture for all possible integer values for a UTF encoding.
    rArBrrrÚ    utf_valueÄsr\cCs|jS)zD
    Fixture for all possible string formats of a UTF encoding.
    rArBrrrÚ encoding_fmtÌsr])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,56e0ra)rUrU)ú-_rb)ú-_1rc)ú-_1e0rd)Ú_1re)ú_1,rf)ú_1,_rg)Ú_1e0rh)ú1,2e_1ri)ú1,2e1_0rj)ú1,_2rk)ú,1__2rl)ú,1erm)ú-,1ern)ú 1_000,000_000ro)ú1,e1_2rp)úe11,2rq)ú1e11,2rr)ú1,2,2rs)ú1,2_1rt)ú    1,2e-10e1ru)ú--1,2rv)ú1a_2,1rw)z1,2E-1g¸…ëQ¸¾?)z1,2E1g(@cCs|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.
    rArBrrrÚnumeric_decimalÔs4rxcCs\d|jkr| d¡}nd|jkr0| d¡d}ndS|jdkrXtjjdd}|j |¡dS)z>
    Fixture that xfails a test if the engine is pyarrow.
    r@rPrNr,úpyarrow doesn't support this.)Úreason)Ú fixturenamesÚgetfixturevaluerr>rLZxfailÚnodeZ
add_marker)r?r.rLrrrÚ pyarrow_xfail s
 
 
r~cCsLd|jkr| d¡}nd|jkr0| d¡d}ndS|jdkrHt d¡dS)z=
    Fixture that skips a test if the engine is pyarrow.
    r@rPrNr,ry)r{r|rr>Úskip)r?r.rrrÚ pyarrow_skips
 
 
r€)3Ú
__future__rr4r>Zpandas.compat._optionalrZpandasrrZpandas._testingZ_testingrrr"r&r(r)r+Zfixturer2r7Z_cParserHighMemoryZ_cParserLowMemoryZ _pythonParserZ_pyarrowParserZ_py_parsers_onlyZ_c_parsers_onlyr=rLrMZ_pyarrow_parsers_onlyrIZ_py_parser_idsZ _c_parser_idsZ_pyarrow_parsers_idsrJr@rCrDrErOrPZ _utf_valuesZ_encoding_sepsrWZ_encoding_fmtsr\r]rxr~r€rrrrÚ<module>sÊ   (
 
 
 
 
 
 
 
þ
 
 
ÿ
 
 
 
Õÿ/