AlkantarClanX12

Your IP : 3.147.86.143


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/csv.cpython-310.opt-2.pyc

o

6��f�>�@s	ddlZddlmZmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlmZddlmZgd�ZGdd�d�ZGdd	�d	e�Zed	e�Gd
d�de�Zede�Gd
d�de�Zede�Gdd�d�ZGdd�d�ZzeWney�eZYnwGdd�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)�StringIO)rrr
rrrr�excel�	excel_tabr
rrrrr	�Snifferrr�
DictReader�
DictWriter�unix_dialectc@sBeZdZ	dZdZdZdZdZdZdZ	dZ
dZdd�Zdd�Z
dS)r�FNcCs|jtkrd|_|��dS)NT)�	__class__r�_valid�	_validate��self�r�*/opt/alt/python310/lib64/python3.10/csv.py�__init__*s
zDialect.__init__c
Cs4zt|�WdSty}ztt|���d}~ww�N)�_Dialect�	TypeErrorr�str)r�errrr/s��zDialect._validate)�__name__�
__module__�__qualname__�_namer�	delimiter�	quotecharZ
escapechar�doublequote�skipinitialspace�lineterminator�quotingr rrrrrrsrc@�&eZdZ	dZdZdZdZdZeZ	dS)r�,�"TF�
N)
r&r'r(r*r+r,r-r.rr/rrrrr6�rc@seZdZ	dZdS)r�	N)r&r'r(r*rrrrr@srz	excel-tabc@r0)rr1r2TF�
N)
r&r'r(r*r+r,r-r.rr/rrrrrEr4rZunixc@sDeZdZ		ddd�Zdd�Zedd��Zejd	d��Zd
d�ZdS)
rNrcOs<||_||_||_t||g|�Ri|��|_||_d|_dS�Nr)�_fieldnames�restkey�restvalr�dialect�line_num)r�f�
fieldnamesr9r:r;�args�kwdsrrrr Qs
zDictReader.__init__cCs|Sr!rrrrr�__iter__ZszDictReader.__iter__cCs>|jdurzt|j�|_Wn	tyYnw|jj|_|jSr!)r8�nextr�
StopIterationr<rrrrr>]s
�
zDictReader.fieldnamescCs
||_dSr!)r8)r�valuerrrr>gs
cCs�|jdkr|jt|j�}|jj|_|gkrt|j�}|gkstt|j|��}t|j�}t|�}||kr?||d�||j<|S||krR|j|d�D]}|j||<qJ|Sr7)	r<r>rBr�dict�zip�lenr9r:)r�row�dZlfZlr�keyrrr�__next__ks"



�
�zDictReader.__next__)NNNr)	r&r'r(r rA�propertyr>�setterrKrrrrrPs
�	
	
rc@s:eZdZ		ddd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)rr�raisercOsH||_||_|��dvrtd|��||_t||g|�Ri|��|_dS)N)rN�ignorez-extrasaction (%s) must be 'raise' or 'ignore')r>r:�lower�
ValueError�extrasactionr)rr=r>r:rRr;r?r@rrrr �s�zDictWriter.__init__cCstt|j|j��}|�|�Sr!)rErFr>�writerow)r�headerrrr�writeheader�s
zDictWriter.writeheadercsN�jdkr����j}|rtdd�dd�|D������fdd��jD�S)NrNz(dict contains fields not in fieldnames: z, cS�g|]}t|��qSr)�repr)�.0�xrrr�
<listcomp>��z,DictWriter._dict_to_list.<locals>.<listcomp>c3s�|]
}��|�j�VqdSr!)�getr:)rXrJ��rowdictrrr�	<genexpr>�s�z+DictWriter._dict_to_list.<locals>.<genexpr>)rR�keysr>rQ�join)rr^Zwrong_fieldsrr]r�
_dict_to_list�s
�zDictWriter._dict_to_listcCs|j�|�|��Sr!)rrSrb)rr^rrrrS�szDictWriter.writerowcCs|j�t|j|��Sr!)r�	writerows�maprb)rZrowdictsrrrrc�szDictWriter.writerowsN)rrNr)r&r'r(r rUrbrSrcrrrrr�s
�
rc@s8eZdZ	dd�Zddd�Zdd�Zdd	�Zd
d�ZdS)
rcCsgd�|_dS)N)r1r5�;� �:)�	preferredrrrrr �szSniffer.__init__NcCsf	|�||�\}}}}|s|�||�\}}|std��Gdd�dt�}||_||_|p,d|_||_|S)NzCould not determine delimiterc@seZdZdZdZeZdS)zSniffer.sniff.<locals>.dialectZsniffedr3N)r&r'r(r)r.rr/rrrrr;�sr;r2)�_guess_quote_and_delimiter�_guess_delimiterrrr,r*r+r-)r�sample�
delimitersr+r,r*r-r;rrr�sniff�s

��
z
Sniffer.sniffc	Cs�	g}dD]}t�|tjtjB�}|�|�}|rnq|sdSi}i}d}|j}	|D]\}
|	dd}|
|}|rB|�|d�d||<z|	dd}|
|}Wn	tyWYq*w|rl|dusb||vrl|�|d�d||<z|	dd}Wn	ty}Yq*w|
|r�|d7}q*t||jd�}
|r�t||jd�}|||k}|d	kr�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�rJr6rz]((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$))rprnTF)�re�compile�DOTALL�	MULTILINE�findall�
groupindexr\�KeyError�max�escape�search)r�datarlZmatchesZrestrZregexpZquotes�delims�spacesrw�m�nrJr+rpr-Z	dq_regexpr,rrrri�sl
�������
z"Sniffer._guess_quote_and_delimitercCs
	ttd|�d���}dd�td�D�}tdt|��}d}i}i}i}d|}	}
|	t|�k�r.|d7}||	|
�D] }|D]}|�|i�}
|�|�}|
�|d�d|
|<|
||<q=q9|��D]N}t||�	��}t|�dkrw|dddkrwq^t|�dkr�t
|dd	�d
�||<|�||�||d||dtdd�|D��f||<q^|d||<q^|�	�}t
t||t|���}d
}d}t|�dkr�||kr�|D]$\}}|ddkr�|ddkr�|d||kr�|dus�||vr�|||<q�|d8}t|�dkr�||ks�t|�dk�r"t|���d}|d�|�|d�d|�k}||fS|
}	|
|7}
|	t|�ks/|�s3dSt|�dk�r^|jD] }||��v�r\|d�|�|d�d|�k}||fS�q=dd�|�	�D�}|��|dd}|d�|�|d�d|�k}||fS)Nr6cSrVr)�chr)rX�crrrrZ-r[z,Sniffer._guess_delimiter.<locals>.<listcomp>��
rrocSs|dS)Nror)rYrrr�<lambda>Gsz*Sniffer._guess_delimiter.<locals>.<lambda>rqcss�|]}|dVqdS)roNr)rX�itemrrrr_Ls�z+Sniffer._guess_delimiter.<locals>.<genexpr>g�?g�������?g{�G�z�?z%c )rrcSsg|]\}}||f�qSrr)rX�k�vrrrrZvs���)�list�filter�split�range�minrGr\�countr`�itemsry�remove�sum�floatrh�sort)rr|rl�asciiZchunkLengthZ	iterationZ
charFrequencyZmodesr}�start�end�line�charZ
metaFrequencyZfreqr�ZmodeList�totalZconsistencyZ	thresholdr�r�rpr-rIrrrrjs�


������3
���zSniffer._guess_delimiterc
Csjtt|�|�|��}t|�}t|�}i}t|�D]}d||<qd}|D]L}|dkr+nE|d7}t|�|kr6q#t|���D]2}	t}
z|
||	�Wnt	t
fyYt||	�}
Ynw|
||	krn||	durk|
||	<q<||	=q<q#d}|��D]:\}	}t|�td�kr�t||	�|kr�|d7}qv|d8}qvz|||	�Wnt	t
fy�|d7}Yqvw|d8}qv|dkS)Nr�ro)rrrmrBrGr�r�r`�complexrQ�
OverflowErrorr��typer#)
rrkZrdrrT�columnsZcolumnTypes�i�checkedrH�colZthisTypeZ	hasHeaderZcolTyperrr�
has_headersL
�
��

�
zSniffer.has_headerr!)r&r'r(r rmrirjr�rrrrr�s
Lgr)rrZ_csvrrrrrrrr	r
rrr
rrrr"�ior�__all__rrrrrr��	NameErrorr�rrrrr�<module>s*@


2�