HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/lib/python3.5/__pycache__/csv.cpython-35.pyc


Fa?@sdZddlZddlmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZddlmZddlmZdddd	d
ddd
ddddddddddddgZGdddZGdd
d
eZed
eGdddeZedeGdddeZed eGd!ddZGd"ddZyeWnek
reZYnXGd#ddZdS)$z+
csv.py - read/write/investigate CSV files
N)Error__version__writerreaderregister_dialectunregister_dialectget_dialect
list_dialectsfield_size_limit
QUOTE_MINIMAL	QUOTE_ALLQUOTE_NONNUMERIC
QUOTE_NONE__doc__)Dialect)StringIOrrr
rrrrexcel	excel_tabr
rrrrr	Snifferrr
DictReader
DictWriterc@sdeZdZdZdZdZdZdZdZdZ	dZ
dZdZddZ
ddZdS)	rzDescribe a CSV dialect.

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

    FNcCs&|jtkrd|_|jdS)NT)	__class__r_valid	_validate)selfr/usr/lib/python3.5/csv.py__init__)s	zDialect.__init__cCsLyt|Wn7tk
rG}ztt|WYdd}~XnXdS)N)_Dialect	TypeErrorrstr)rerrrr.szDialect._validate)__name__
__module____qualname__r_namer	delimiter	quotecharZ
escapechardoublequoteskipinitialspacelineterminatorquotingrrrrrrrsc@s:eZdZdZdZdZdZdZdZe	Z
dS)rz;Describe the usual properties of Excel-generated CSV files.,"TFz
N)r#r$r%rr'r(r)r*r+rr,rrrrr5sc@seZdZdZdZdS)rzEDescribe the usual properties of Excel-generated TAB-delimited files.	N)r#r$r%rr'rrrrr?sz	excel-tabc@s:eZdZdZdZdZdZdZdZe	Z
dS)unix_dialectz:Describe the usual properties of Unix-generated CSV files.r-r.TF
N)r#r$r%rr'r(r)r*r+rr,rrrrr0Dsr0Zunixc@sgeZdZddddddZddZeddZejd	dZd
dZdS)rNrcOsI||_||_||_t|||||_||_d|_dS)Nr)_fieldnamesrestkeyrestvalrdialectline_num)rf
fieldnamesr3r4r5argskwdsrrrrPs				zDictReader.__init__cCs|S)Nr)rrrr__iter__YszDictReader.__iter__cCsP|jdkr:yt|j|_Wntk
r9YnX|jj|_|jS)N)r2nextr
StopIterationr6)rrrrr8\s
zDictReader.fieldnamescCs
||_dS)N)r2)rvaluerrrr8fscCs|jdkr|jt|j}|jj|_x|gkrUt|j}q7Wtt|j|}t|j}t|}||kr||d||j<n7||krx(|j|dD]}|j||<qW|S)Nr)	r6r8r<rdictziplenr3r4)rrowdZlfZlrkeyrrr__next__jszDictReader.__next__)	r#r$r%rr;propertyr8setterrErrrrrOs	
c@sUeZdZdddddZddZdd	Zd
dZdd
ZdS)rrraisercOsY||_||_|jdkr4td|||_t|||||_dS)NrHignorez-extrasaction (%s) must be 'raise' or 'ignore')rHrI)r8r4lower
ValueErrorextrasactionr)rr7r8r4rLr5r9r:rrrrs		
	zDictWriter.__init__cCs,tt|j|j}|j|dS)N)r?r@r8writerow)rheaderrrrwriteheaderszDictWriter.writeheadercsqjdkrTfddD}|rTtddjdd|DfddjDS)	NrHcs%g|]}|jkr|qSr)r8).0k)rrr
<listcomp>s	z,DictWriter._dict_to_list.<locals>.<listcomp>z(dict contains fields not in fieldnames: z, cSsg|]}t|qSr)repr)rPxrrrrRs	c3s$|]}j|jVqdS)N)getr4)rPrD)rowdictrrr	<genexpr>sz+DictWriter._dict_to_list.<locals>.<genexpr>)rLrKjoinr8)rrVZwrong_fieldsr)rVrr
_dict_to_lists zDictWriter._dict_to_listcCs|jj|j|S)N)rrMrY)rrVrrrrMszDictWriter.writerowcCs|jjt|j|S)N)r	writerowsmaprY)rZrowdictsrrrrZszDictWriter.writerowsN)r#r$r%rrOrYrMrZrrrrrs	c@sUeZdZdZddZdddZddZd	d
ZddZdS)
rze
    "Sniffs" the format of a CSV file (i.e. delimiter, quotechar)
    Returns a Dialect object.
    cCsdddddg|_dS)Nr-r/; :)	preferred)rrrrrszSniffer.__init__NcCs|j||\}}}}|s<|j||\}}|sNtdGdddt}||_||_|pd|_||_|S)zI
        Returns a dialect (or None) corresponding to the sample
        zCould not determine delimiterc@s"eZdZdZdZeZdS)zSniffer.sniff.<locals>.dialectZsniffedz
N)r#r$r%r&r+rr,rrrrr5sr5r.)_guess_quote_and_delimiter_guess_delimiterrrr)r'r(r*)rsample
delimitersr(r)r'r*r5rrrsniffs				z
Sniffer.sniffcCsg}x@dD]8}tj|tjtjB}|j|}|r
Pq
W|sSdSi}i}d}|j}	x|D]}
|	d	d
}|
|}|r|j|dd
||<y|	dd
}|
|}Wntk
rwuYnX|r|dks||kr|j|dd
||<y|	dd
}Wntk
rHwuYnX|
|ru|d
7}quWt|d
|j}
|rt|d
|j}|||k}|dkrd}nd}d}tjddtj	|d	|
itj}|j
|rd}nd}|
|||fS)a
        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.
        F(?P<delim>[^\w
"'])(?P<space> ?)(?P<quote>["']).*?(?P=quote)(?P=delim)C(?:^|
)(?P<quote>["']).*?(?P=quote)(?P<delim>[^\w
"'])(?P<space> ?)D(?P<delim>>[^\w
"'])(?P<space> ?)(?P<quote>["']).*?(?P=quote)(?:$|
)*(?:^|
)(?P<quote>["']).*?(?P=quote)(?:$|
)rFNrZquotedelimZspacerDr1z]((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$)T)rerfrgrh)rFNr)recompileDOTALL	MULTILINEfindall
groupindexrUKeyErrormaxescapesearch)rdatarcZmatchesZrestrZregexpZquotesdelimsZspacesrpmnrDr(rjr*Z	dq_regexpr)rrrr`s`
	




	%	z"Sniffer._guess_quote_and_delimitercCsttd|jd}ddtdD}tdt|}d}i}i}i}dt|t|}	}
x|	t|kr |d7}xn||	|
D]\}xS|D]K}|j|i}
|j|}|
j|dd|
|<|
||<qWqWx|jD]}t||j	}t|dkrb|dddkrbqt|dkrt
|d	d
d||<|j||||d||dtdd
|Df||<q|d||<qW|j	}t
||}d}d}xt|dkr||krxj|D]b\}}|ddkr=|ddkr=|d||kr=|dks||kr=|||<q=W|d8}qWt|dkr
t|jd}|dj||djd|k}||fS|
}	|
|7}
qW|s+dSt|dkrxW|jD]L}||jkrG|dj||djd|k}||fSqGWdd|j	D}|j|dd}|dj||djd|k}||fS)a
        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 frequencies 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.
        Nr1cSsg|]}t|qSr)chr)rPcrrrrR,s	z,Sniffer._guess_delimiter.<locals>.<listcomp>
rrirDcSs|dS)Nrir)rTrrr<lambda>Fsz*Sniffer._guess_delimiter.<locals>.<lambda>css|]}|dVqdS)riNr)rPitemrrrrWKsz+Sniffer._guess_delimiter.<locals>.<genexpr>g?g?g{Gz?z%c rcSs"g|]\}}||fqSrr)rPrQvrrrrRus	)rr)listfiltersplitrangeminrArUcountkeysitemsrrremovesumfloatr_sort)rrurcasciiZchunkLengthZ	iterationZ
charFrequencyZmodesrvstartendlinecharZ
metaFrequencyZfreqrZmodeListZtotalZconsistencyZ	thresholdrQrrjr*rCrrrrast

&$! 

zSniffer._guess_delimiterc
Cstt||j|}t|}t|}i}xt|D]}d||<qIWd}x|D]}|dkr}P|d7}t||krqjxt|jD]}	xUtt	t
gD]4}
y|
||	PWqttfk
rYqXqWt||	}
|
||	kr||	dkr:|
||	<q||	=qWqjWd}x|j
D]\}	}t|tdkrt||	|kr|d7}q|d8}q\y|||	Wn"ttfk
r|d7}Yq\X|d8}q\W|dkS)Nrri)rrrdr<rArrrintrcomplexrK
OverflowErrorrtyper )
rrbZrdrrNcolumnsZcolumnTypesiZcheckedrBcolZthisTypeZ	hasHeaderZcolTyperrr
has_header~sJ


	


zSniffer.has_header)	r#r$r%rrrdr`rarrrrrrsLg)rrkZ_csvrrrrrrrr	r
rrr
rrrior__all__rrr0rrr	NameErrorrrrrrr<module>s.^	


2