AlkantarClanX12

Your IP : 18.117.107.78


Current Path : /proc/self/root/lib64/python3.8/__pycache__/
Upload File :
Current File : //proc/self/root/lib64/python3.8/__pycache__/csv.cpython-38.opt-2.pyc

U

e5d?�@s<ddlZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlmZddlmZddddd	d
ddd
ddddddddddddgZGdd
�d
�ZGdd�de�Zede�Gdd
�d
e�Zede�Gdd�de�Zede�Gd d�d�ZGd!d�d�ZzeWnek
�r(eZYnXGd"d�d�ZdS)#�N)�Error�__version__�writer�reader�register_dialect�unregister_dialect�get_dialect�
list_dialects�field_size_limit�
QUOTE_MINIMAL�	QUOTE_ALL�QUOTE_NONNUMERIC�
QUOTE_NONE�__doc__)�Dialect)�StringIOrrr
rrrr�excel�	excel_tabr
rrrrr	�Snifferrr�
DictReader�
DictWriter�unix_dialectc@s@eZdZdZdZdZdZdZdZdZ	dZ
dZdd�Zdd�Z
dS)r�FNcCs|jtkrd|_|��dS)NT)�	__class__r�_valid�	_validate��self�r�/usr/lib64/python3.8/csv.py�__init__*s
zDialect.__init__c
Cs@zt|�Wn.tk
r:}ztt|���W5d}~XYnXdS�N)�_Dialect�	TypeErrorr�str)r�errrr/szDialect._validate)�__name__�
__module__�__qualname__�_namer�	delimiter�	quotecharZ
escapechar�doublequote�skipinitialspace�lineterminator�quotingr rrrrrrsc@s$eZdZdZdZdZdZdZeZ	dS)r�,�"TF�
N)
r&r'r(r*r+r,r-r.rr/rrrrr6sc@seZdZdZdS)r�	N)r&r'r(r*rrrrr@sz	excel-tabc@s$eZdZdZdZdZdZdZeZ	dS)rr0r1TF�
N)
r&r'r(r*r+r,r-r.rr/rrrrrEsZunixc@s@eZdZddd�Zdd�Zedd��Zejd	d��Zd
d�ZdS)
rNrcOs6||_||_||_t||f|�|�|_||_d|_dS�Nr)�_fieldnames�restkey�restvalr�dialect�line_num)r�f�
fieldnamesr7r8r9�args�kwdsrrrr QszDictReader.__init__cCs|Sr!rrrrr�__iter__ZszDictReader.__iter__cCs@|jdkr0zt|j�|_Wntk
r.YnX|jj|_|jSr!)r6�nextr�
StopIterationr:rrrrr<]s

zDictReader.fieldnamescCs
||_dSr!)r6)r�valuerrrr<gscCs�|jdkr|jt|j�}|jj|_|gkr8t|j�}q$tt|j|��}t|j�}t|�}||krv||d�||j<n&||kr�|j|d�D]}|j||<q�|Sr5)	r:r<r@r�dict�zip�lenr7r8)r�row�dZlfZlr�keyrrr�__next__ks



zDictReader.__next__)NNNr)	r&r'r(r r?�propertyr<�setterrIrrrrrPs�
	
	
c@s6eZdZddd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)rr�raisercOsB||_||_|��dkr$td|��||_t||f|�|�|_dS)N)rL�ignorez-extrasaction (%s) must be 'raise' or 'ignore')r<r8�lower�
ValueError�extrasactionr)rr;r<r8rPr9r=r>rrrr �s�zDictWriter.__init__cCstt|j|j��}|�|�Sr!)rCrDr<�writerow)r�headerrrr�writeheader�szDictWriter.writeheadercsN�jdkr8����j}|r8tdd�dd�|D������fdd��jD�S)NrLz(dict contains fields not in fieldnames: z, cSsg|]}t|��qSr)�repr)�.0�xrrr�
<listcomp>�sz,DictWriter._dict_to_list.<locals>.<listcomp>c3s|]}��|�j�VqdSr!)�getr8)rUrH��rowdictrrr�	<genexpr>�sz+DictWriter._dict_to_list.<locals>.<genexpr>)rP�keysr<rO�join)rrZZwrong_fieldsrrYr�
_dict_to_list�s
�zDictWriter._dict_to_listcCs|j�|�|��Sr!)rrQr^)rrZrrrrQ�szDictWriter.writerowcCs|j�t|j|��Sr!)r�	writerows�mapr^)rZrowdictsrrrr_�szDictWriter.writerowsN)rrLr)r&r'r(r rSr^rQr_rrrrr�s�

c@s6eZdZdd�Zddd�Zdd�Zdd	�Zd
d�ZdS)
rcCsdddddg|_dS)Nr0r3�;� �:)�	preferredrrrrr �szSniffer.__init__NcCsd|�||�\}}}}|s(|�||�\}}|s4td��Gdd�dt�}||_||_|pVd|_||_|S)NzCould not determine delimiterc@seZdZdZdZeZdS)zSniffer.sniff.<locals>.dialectZsniffedr2N)r&r'r(r)r.rr/rrrrr9�sr9r1)�_guess_quote_and_delimiter�_guess_delimiterrrr,r*r+r-)r�sample�
delimitersr+r,r*r-r9rrr�sniff�s
�
�
z
Sniffer.sniffc	Cs�g}dD]*}t�|tjtjB�}|�|�}|rq4q|s<dSi}i}d}|j}	|D]�}
|	dd}|
|}|r�|�|d�d||<z|	dd}|
|}Wntk
r�YqRYnX|r�|dks�||kr�|�|d�d||<z|	dd}Wntk
�rYqRYnX|
|rR|d7}qRt||jd�}
|�rXt||jd�}|||k}|d	k�r`d
}nd
}d}t�dt�	|�|
d�tj�}|�
|��r�d
}nd}|
|||fS)N)zI(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)zG(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)zG(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)z-(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n))rFNrr�quote��delimZspace�rHr4rz]((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$))rlrjTF)�re�compile�DOTALL�	MULTILINE�findall�
groupindexrX�KeyError�max�escape�search)r�datarhZmatchesZrestrZregexpZquotes�delimsZspacesrs�m�nrHr+rlr-Z	dq_regexpr,rrrre�s`




��z"Sniffer._guess_quote_and_delimitercCsttd|�d���}dd�td�D�}tdt|��}d}i}i}i}d|}	}
|	t|�k�rR|d7}||	|
�D]@}|D]6}|�|i�}
|�|�}|
�|d�d|
|<|
||<qxqp|��D]�}t||�	��}t|�dkr�|dddkr�q�t|�dk�rLt
|dd	�d
�||<|�||�||d||dtdd�|D��f||<q�|d||<q�|�	�}t
t||t|���}d
}d}t|�dk�r�||k�r�|D]T\}}|ddk�r�|ddk�r�|d||k�r�|dk�s�||k�r�|||<�q�|d8}�q�t|�dk�rDt|���d}|d�|�|d�d|�k}||fS|
}	|
|7}
qN|�s\dSt|�dk�r�|jD]@}||��k�rp|d�|�|d�d|�k}||fS�qpdd�|�	�D�}|��|dd}|d�|�|d�d|�k}||fS)Nr4cSsg|]}t|��qSr)�chr)rU�crrrrW-sz,Sniffer._guess_delimiter.<locals>.<listcomp>��
rrkcSs|dS)Nrkr)rVrrr�<lambda>G�z*Sniffer._guess_delimiter.<locals>.<lambda>rmcss|]}|dVqdS)rkNr)rU�itemrrrr[Lsz+Sniffer._guess_delimiter.<locals>.<genexpr>g�?g�������?g{�G�z�?z%c )rrcSsg|]\}}||f�qSrr)rU�k�vrrrrWvs���)�list�filter�split�range�minrErX�countr\�itemsru�remove�sum�floatrd�sort)rrxrh�asciiZchunkLengthZ	iterationZ
charFrequencyZmodesry�start�end�line�charZ
metaFrequencyZfreqr�ZmodeListZtotalZconsistencyZ	thresholdr�r�rlr-rGrrrrfs�

����

��zSniffer._guess_delimiterc
Cs�tt|�|�|��}t|�}t|�}i}t|�D]}d||<q0d}|D]�}|dkrVq�|d7}t|�|krlqFt|���D]x}	tt	t
fD]4}
z|
||	�Wq�Wq�ttfk
r�Yq�Xq�t||	�}
|
||	krx||	dkr�|
||	<qx||	=qxqFd}|�
�D]~\}	}t|�td�k�r@t||	�|k�r6|d7}n|d8}n<z|||	�Wn"ttfk
�rr|d7}Yn
X|d8}�q|dkS)Nr�rk)rrrir@rEr�r�r\�intr��complexrO�
OverflowErrorr��typer#)
rrgZrdrrR�columnsZcolumnTypes�i�checkedrF�colZthisTypeZ	hasHeaderZcolTyperrr�
has_headersJ






zSniffer.has_header)N)r&r'r(r rirerfr�rrrrr�s

Lg)rnZ_csvrrrrrrrr	r
rrr
rrrr"�ior�__all__rrrrrr��	NameErrorr�rrrrr�<module>sH@�


2