KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21585/root/usr/lib64/python2.4/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21585/root/usr/lib64/python2.4/csv.pyc
mò
‚=5Dc@sŽdZdkZdklZlZlZlZlZlZl	Z	l
Z
lZlZl
Z
lZlZydklZWn ej
odklZnXdddddd	d
ddd
ddddddddgZd	fd„ƒYZd
efd„ƒYZed
eƒdefd„ƒYZedeƒdfd„ƒYZdfd„ƒYZyeWnej
o
eZnXdfd„ƒYZdS(s+
csv.py - read/write/investigate CSV files
N(
sErrors__version__swritersreadersregister_dialectsunregister_dialectsget_dialects
list_dialectss
QUOTE_MINIMALs	QUOTE_ALLsQUOTE_NONNUMERICs
QUOTE_NONEs__doc__(sStringIOt
QUOTE_MINIMALt	QUOTE_ALLtQUOTE_NONNUMERICt
QUOTE_NONEtErrortDialecttexcelt	excel_tabtreadertwritertregister_dialecttget_dialectt
list_dialectstSniffertunregister_dialectt__version__t
DictReadert
DictWritercBsPtZdZeZdZdZdZdZ	dZ
dZdZd„Z
d„ZRS(NtcCsT|itjo
t|_n|iƒ}|gjotddi|ƒ‚ndS(NsDialect did not validate: %ss, (	tselft	__class__RtTruet_validt	_validateterrorsRtjoin(RR((t/usr/lib64/python2.4/csv.pyt__init__"s


cCsúg}|ip|idƒn|idjo|idƒn<t|itƒpt|iƒdjo|idƒn|i	djo%|i
tjo|idƒqín<t|i	tƒpt|i	ƒdjo|idƒn|idjo|idƒn%t|itƒp|idƒn|i
ttfjo|id	ƒn|ittfjo|id
ƒn|i
djo|idƒn|i
tjoEt|ittfƒpt|iƒdjo|idƒqön|S(
Ns(can't directly instantiate Dialect classsdelimiter character not setis&delimiter must be one-character stringsquotechar not sets&quotechar must be one-character stringslineterminator not setslineterminator must be a strings+doublequote parameter must be True or Falses0skipinitialspace parameter must be True or Falsesquoting parameter not sets;escapechar must be a one-character string or unicode object(RRRtappendt	delimitertNonet
isinstancetstrtlent	quotechartquotingRtlineterminatortdoublequoteRtFalsetskipinitialspacet
escapechartunicode(RR((RR)s4
**0(t__name__t
__module__t_nameR&RRRR"R(R%R'R$R#RR(((RRs	cBs,tZdZdZeZeZdZe	Z
RS(Nt,t"s
(R*R+RR"RR%R&R'R$RR#(((RRPscBstZdZRS(Ns	(R*R+R(((RRYss	excel-tabcBs/tZddddd„Zd„Zd„ZRS(NRcOs7||_||_||_t||||Ž|_dS(N(	t
fieldnamesRtrestkeytrestvalRtftdialecttargstkwds(RR2R/R0R1R3R4R5((RR_s			cCs|S(N(R(R((Rt__iter__fscCsî|iiƒ}|idjo||_|iiƒ}nx!|gjo|iiƒ}q>Wtt|i|ƒƒ}t	|iƒ}t	|ƒ}||jo||||i<n7||jo)x&|i|D]}|i||<qÏWn|S(N(RRtnexttrowR/RtdicttziptdR!tlftlrR0tkeyR1(RR<R;R>R=R8((RR7is"	


(R*R+RRR6R7(((RR^s	cBs5tZdddd„Zd„Zd„Zd„ZRS(NRtraiseRcOs[||_||_|iƒdjotd|‚n||_t||||Ž|_dS(NR?tignores-extrasaction (%s) must be 'raise' or 'ignore'(R?signore(R/RR1textrasactiontlowert
ValueErrorR	R2R3R4R5(RR2R/R1RAR3R4R5((RR€s			cCsy|idjo8x5|iƒD]#}||ijo
td‚qqWng}|iD]}||i	||i
ƒqV~S(NR?s&dict contains fields not in fieldnames(RRAtrowdicttkeystkR/RCt_[1]R>tgetR1(RRDRGR>RF((Rt
_dict_to_list‹s
cCs|ii|i|ƒƒS(N(RR	twriterowRIRD(RRD((RRJ’scCs=g}x$|D]}|i|i|ƒƒq
W|ii|ƒS(N(trowstrowdictsRDRRRIR	t	writerows(RRLRKRD((RRM•s
(R*R+RRIRJRM(((RRs		cBs>tZdZd„Zed„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:(Rt	preferred(R((RR¦scCs€|i||ƒ\}}}|djo|i||ƒ\}}ndt	fd„ƒY}||_|pd|_||_|S(sI
        Returns a dialect (or None) corresponding to the sample
        R3cBs tZdZdZeZeZRS(Ntsniffeds
(R*R+R,R$RR#R&R%(((RR3¶sR.N(Rt_guess_quote_and_delimitertsamplet
delimitersR"RR'Rt_guess_delimiterRR3(RRTRUR3R'RR"((Rtsniff«s
			cCsÿg}xEdD]=}ti|titiBƒ}
|
i|ƒ}|oPq
q
W|pdSnh}
h}d}	x|D]}|
idd}||}|o|
i|dƒd|
|<ny|
id	d}||}Wntj
o
qvnX|o8|djp
||jo|i|dƒd||<ny|
id
d}Wntj
o
qvnX||o|	d7}	qvqvWt|
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)(?:$|
)RitquoteitdelimtspacecCs ||||jo|p|S(N(tquotestatb(R\R]R[((Rt<lambda>ôscCs ||||jo|p|S(N(tdelimsR\R](R\R]R_((RR^øss
N(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)(?:$|
)(RNi(tmatchestrestrtretcompiletDOTALLt	MULTILINEtregexptfindalltdataRR[R_tspacestmt
groupindextnR>RHtKeyErrorRUtreduceRER"RYR'(RRhRURaR'RjR_RlR`RiR[R>R"RfRY((RRSÅsV
	
!
cCsÿtd
|idƒƒ}g}tdƒD]}|t|ƒq)~}t	dt
|ƒƒ}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_td„|ƒ||<|i||ƒ||d||dtd„|ƒdf||<q)|d||<q)W|iƒ}t||ƒ}d}d	}x©t
|
ƒdjo•||joˆxw|D]o\}}|ddjoR|ddjoA|d||jo(|d
jp
||jo||
|<q³qDqDW|d
8}qWt
|
ƒdjoH|
iƒd}
|di|
ƒ|did|
ƒj}|
|fSn|	}|	|7}	q‘W|
pdSnt
|
ƒdjocx`|i'D]Q}||
iƒjo8|di|ƒ|did|ƒj}||fSqbqbWn|
iƒ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
iicCs |d|djo|p|S(Ni(R\R](R\R]((RR^4scCsd|d|dfS(Nii(R\R](R\R]((RR^:sf1.0f0.90000000000000002f0.01s%c RN(Ri()tfilterRRhtsplitRGtrangetctchrtasciitminR!tchunkLengtht	iterationt
charFrequencytmodesR_tstarttendtlinetcharRHt
metaFrequencytcounttfreqREtitemsRntremovetmodeListtfloatttotaltconsistencyt	thresholdRFtvRURYR'RRQR;(RRhRUR~R}R‡R…RtR€R{R_RzRvRYRˆRxR|R;RrRyR'RRFRwRGRƒR†((RRVsz-

(	
 "/*
**c
	Cs*tt|ƒ|i|ƒƒ}	|	iƒ}t|ƒ}h}xt|ƒD]}d||<qIWd}x	|	D]}|djoPn|d7}t|ƒ|joqjnxÂ|iƒD]´}xYttttgD]5}
y|
||ƒPWqÌttfj
oqÌXqÌWt||ƒ}
|
tjo
t}
n|
||jo*||djo|
||<qg||=q³q³WqjWd}x¨|iƒD]š\}}t|ƒtdƒjo3t||ƒ|jo|d7}q|d8}q‚y|||ƒWn#ttfj
o|d7}q‚X|d8}q‚W|djS(Niii(RtStringIORTRRWtrdrR7theaderR!tcolumnstcolumnTypesRqtiRtcheckedR8REtcoltinttlongR„tcomplextthisTypeRCt
OverflowErrort	hasHeaderRtcolTypettypet	TypeError(
RRTR‹R—R8RRRŒRŽRŠR”RR–((Rt
has_headerjsX




	


(	R*R+t__doc__RRRWRSRVRš(((RR
¡s		@	e(R›Rbt_csvRRR	RR
RRRRRRRt	cStringIOR‰tImportErrort__all__RRRRRR“t	NameErrorR„R
(RRRR‰RRŸRR	RRRR“R
RRR›RRRbR
RRR((Rt?s&	U<:

!

Anon7 - 2021