b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 172.67.192.52 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 /
Filename/usr/lib64/python2.6/csv.pyo
Size12.92 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified20-Jun-2019 19:45
Last accessed22-Apr-2026 05:24
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
Ñò
§ÚêLc@sÆdZddkZddklZddklZlZlZlZl Z l
Z
l Z l Z l
Z
lZlZlZlZlZddklZyddklZWn#ej
oddklZnXddd d
d d d
dddddddddddddgZd d"d��YZdefd��YZe de�defd��YZe de�dd#d��YZdd$d ��YZyeWnej
o
eZnXdd%d!��YZdS(&s+
csv.py - read/write/investigate CSV files
iÿÿÿÿN(treduce(tErrort __version__twritertreadertregister_dialecttunregister_dialectt get_dialectt
list_dialectstfield_size_limitt
QUOTE_MINIMALt QUOTE_ALLtQUOTE_NONNUMERICt
QUOTE_NONEt__doc__(tDialect(tStringIOR
R R R
RRRtexcelt excel_tabR RRRRRtSnifferRRt
DictReadert
DictWritercBsVeZdZdZeZdZdZdZ dZ
dZ dZ dZ
d�Zd�ZRS(sÇDescribe an Excel dialect.

This must be subclassed (see csv.excel). Valid attributes are:
delimiter, quotechar, escapechar, doublequote, skipinitialspace,
lineterminator, quoting.

tcCs+|itjo
t|_n|i�dS(N(t __class__RtTruet_validt _validate(tself((s/usr/lib64/python2.6/csv.pyt__init__-s
cCs<yt|�Wn'tj
o}tt|���nXdS(N(t_Dialectt TypeErrorRtstr(Rte((s/usr/lib64/python2.6/csv.pyR2sN(t__name__t
__module__Rt_nametFalseRtNonet delimitert quotechart
escapechart doublequotetskipinitialspacetlineterminatortquotingRR(((s/usr/lib64/python2.6/csv.pyRs cBs2eZdZdZdZeZeZdZ e
Z RS(s;Describe the usual properties of Excel-generated CSV files.t,t"s
( R!R"RR&R'RR)R$R*R+R
R,(((s/usr/lib64/python2.6/csv.pyR9scBseZdZdZRS(sEDescribe the usual properties of Excel-generated TAB-delimited files.s (R!R"RR&(((s/usr/lib64/python2.6/csv.pyRCss excel-tabcBsPeZddddd�Zd�Zed��Zeid��Zd�ZRS(RcOsI||_||_||_t||||�|_||_d|_dS(Ni(t _fieldnamestrestkeytrestvalRtdialecttline_num(Rtft
fieldnamesR0R1R2targstkwds((s/usr/lib64/python2.6/csv.pyRJs     cCs|S(N((R((s/usr/lib64/python2.6/csv.pyt__iter__SscCsV|idjo0y|ii�|_Wq@tj
oq@Xn|ii|_|iS(N(R/R%Rtnextt
StopIterationR3(R((s/usr/lib64/python2.6/csv.pyR5Vs cCs
||_dS(N(R/(Rtvalue((s/usr/lib64/python2.6/csv.pyR5`scCsì|idjo |in|ii�}|ii|_x!|gjo|ii�}q<Wtt|i|��}t|i�}t|�}||jo||||i<n7||jo)x&|i|D]}|i||<qÍWn|S(Ni( R3R5RR9tdicttziptlenR0R1(Rtrowtdtlftlrtkey((s/usr/lib64/python2.6/csv.pyR9ds" 
 

N( R!R"R%RR8tpropertyR5tsetterR9(((s/usr/lib64/python2.6/csv.pyRIs    
cBs5eZdddd�Zd�Zd�Zd�ZRS(RtraiseRcOs[||_||_|i�djotd|�n||_t||||�|_dS(NRFtignores-extrasaction (%s) must be 'raise' or 'ignore'(RFsignore(R5R1tlowert
ValueErrort extrasactionR(RR4R5R1RJR2R6R7((s/usr/lib64/python2.6/csv.pyR|s    cCs�|idjo]g}|D]!}||ijo ||qq~}|otddi|���qmng}|iD]}||i||i�q{~S(NRFs(dict contains fields not in fieldnames: s, (RJR5RItjointgetR1(Rtrowdictt_[1]tkt wrong_fieldst_[2]RC((s/usr/lib64/python2.6/csv.pyt
_dict_to_list�s 5cCs|ii|i|��S(N(RtwriterowRR(RRM((s/usr/lib64/python2.6/csv.pyRS�scCs=g}x$|D]}|i|i|��q
W|ii|�S(N(tappendRRRt writerows(RtrowdictstrowsRM((s/usr/lib64/python2.6/csv.pyRU�s
(R!R"RRRRSRU(((s/usr/lib64/python2.6/csv.pyR{s

 cBs>eZdZd�Zdd�Zd�Zd�Zd�ZRS(se
"Sniffs" the format of a CSV file (i.e. delimiter, quotechar)
Returns a Dialect object.
cCsdddddg|_dS(NR-s t;t t:(t preferred(R((s/usr/lib64/python2.6/csv.pyR£scCs�|i||�\}}}|p|i||�\}}n|p
td�ndtfd��Y}||_|pd|_||_|S(sI
Returns a dialect (or None) corresponding to the sample
sCould not determine delimiterR2cBs eZdZdZeZeZRS(tsniffeds
(R!R"R#R+R
R,R$R)(((s/usr/lib64/python2.6/csv.pyR2¶sR.(t_guess_quote_and_delimitert_guess_delimiterRRR&R'R*(Rtsamplet
delimitersR'R&R*R2((s/usr/lib64/python2.6/csv.pytsniff¨s 
  c Csüg}xEdD]=}ti|titiB�}|i|�}|oPq
q
W|pdSh}h}d}x |D]} |idd}
| |
} | o|i| d�d|| <ny|id d}
| |
} Wntj
o
qsnX| o8|djp
| |jo|i| d�d|| <ny|id
d}
Wntj
o
qsnX| |
o|d7}qsqsWt |d �|i
��} |oFt |d �|i
��}
||
|j}|
d
jo
d}
qïn
d}
d}| |
|fS(s�
Looks for text enclosed between two identical quotes
(the probable quotechar) which are preceded and followed
by the same character (the probable delimiter).
For example:
,'some text',
The quote with the most wins, same with the delimiter.
If there is no quotechar the delimiter can't be determined
this way.
sF(?P<delim>[^\w
"'])(?P<space> ?)(?P<quote>["']).*?(?P=quote)(?P=delim)sC(?:^|
)(?P<quote>["']).*?(?P=quote)(?P<delim>[^\w
"'])(?P<space> ?)sD(?P<delim>>[^\w
"'])(?P<space> ?)(?P<quote>["']).*?(?P=quote)(?:$|
)s*(?:^|
)(?P<quote>["']).*?(?P=quote)(?:$|
)RitquoteitdelimtspacecSs ||||jo|p|S(((tatbtquotes((s/usr/lib64/python2.6/csv.pyt<lambda>ôscSs ||||jo|p|S(((ReRftdelims((s/usr/lib64/python2.6/csv.pyRhøss
(sF(?P<delim>[^\w
"'])(?P<space> ?)(?P<quote>["']).*?(?P=quote)(?P=delim)sC(?:^|
)(?P<quote>["']).*?(?P=quote)(?P<delim>[^\w
"'])(?P<space> ?)sD(?P<delim>>[^\w
"'])(?P<space> ?)(?P<quote>["']).*?(?P=quote)(?:$|
)s*(?:^|
)(?P<quote>["']).*?(?P=quote)(?:$|
)N(RNi( tretcompiletDOTALLt MULTILINEtfindallR%t
groupindexRLtKeyErrorRtkeys(RtdataR`tmatchestrestrtregexpRgRitspacestmtnRCR'RcR*((s/usr/lib64/python2.6/csv.pyR]ÅsZ  
!   
c Cs1td|id��}g}td�D]}|t|�q)~}tdt|��}d}h}h} h}
dt|t|��} } x¢| t|�jo�|d7}xk|| | !D]\}
xS|D]K}|i|h�}|
i|�}|i|d�d||<|||<qÉWq¼WxÓ|i �D]Å}||i
�}t|�djo|dddjoq)nt|�djo_t d�|�| |<|i | |�| |d| |dt d�|�df| |<q)|d| |<q)W| i
�}t
||�}d}d }x©t|
�djo�||jo�xw|D]o\}}|ddjoR|ddjoA|d||jo(|djp
||jo||
|<q³qDqDW|d
8}qWt|
�djoE|
i �d}|di|�|did |�j}||fS| } | |7} q�W|
pdSt|
�djo`x]|iD]N}||
i �jo5|di|�|did |�j}||fSq\Wng}|
i
�D]\}}|||fqÃ~}|i�|d
d}|di|�|did |�j}||fS(s¼
The delimiter /should/ occur the same number of times on
each row. However, due to malformed data, it may not. We don't want
an all or nothing approach, so we allow for small variations in this
number.
1) build a table of the frequency of each character on every line.
2) build a table of freqencies of this frequency (meta-frequency?),
e.g. 'x occurred 5 times in 10 rows, 6 times in 1000 rows,
7 times in 2 rows'
3) use the mode of the meta-frequency to determine the /expected/
frequency for that character
4) find out how often the character actually meets that goal
5) the character that best meets its goal is the delimiter
For performance reasons, the data is evaluated in chunks, so it can
try and evaluate the smallest portion of the data possible, evaluating
additional chunks as necessary.
s
ii
iicSs |d|djo|p|S(i((ReRf((s/usr/lib64/python2.6/csv.pyRh4scSsd|d|dfS(ii((ReRf((s/usr/lib64/python2.6/csv.pyRh:sgð?gÍÌÌÌÌÌì?g{®Gáz�?s%c RiÿÿÿÿN(Ri(tfilterR%tsplittrangetchrtminR>RLtcountRqtitemsRtremovetfloatR[tsort(RRrR`RNtctasciit chunkLengtht iterationt
charFrequencytmodesRitstarttendtlinetchart
metaFrequencytfreqRtmodeListttotalt consistencyt thresholdROtvRcR*R@RQ((s/usr/lib64/python2.6/csv.pyR^s�-

( 
    " 
3
c
Cs*tt|�|i|��}|i�}t|�}h}xt|�D]}d||<qIWd}x |D]}|djoPn|d7}t|�|joqjnxÂ|i�D]´} xYtt t
t gD]5}
y|
|| �PWqÌt t
fj
oqÌXqÌWt|| �}
|
t jo
t}
n|
|| jo*|| djo|
|| <qg|| =q³q³WqjWd} x¨|i�D]�\} } t| �td�jo3t|| �| jo| d7} q| d8} q�y| || �Wn#t tfj
o| d7} q�X| d8} q�W| djS(Niii(RRRaR9R>R{R%RqtinttlongR�tcomplexRIt
OverflowErrorRttypeR(
RR_trdrtheadertcolumnst columnTypestitcheckedR?tcoltthisTypet hasHeadertcolType((s/usr/lib64/python2.6/csv.pyt
has_headernsX
  



 


N( R!R"RRR%RaR]R^R£(((s/usr/lib64/python2.6/csv.pyR�s    @ i((((( RRjt functoolsRt_csvRRRRRRRRR R
R R R
RRt cStringIORt ImportErrort__all__RRRRR�t NameErrorR�R(((s/usr/lib64/python2.6/csv.pyt<module>s2 ^   

2