Your IP : 18.191.84.179


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/csv.cpython-312.opt-2.pyc

�

�Q�f@��F�	ddlZddlZddlmZmZmZmZmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZddlmZddlmZgd�ZGd�d�ZGd�d	e�Zed	e�Gd
�de�Zede�Gd
�de�Zede�Gd�d�ZGd�d�ZGd�d�Zy)�N)�Error�__version__�writer�reader�register_dialect�unregister_dialect�get_dialect�
list_dialects�field_size_limit�
QUOTE_MINIMAL�	QUOTE_ALL�QUOTE_NONNUMERIC�
QUOTE_NONE�
QUOTE_STRINGS�
QUOTE_NOTNULL�__doc__)�Dialect)�StringIO)rr
rrrrrrr�excel�	excel_tabrrrrr	r
�Snifferrr�
DictReader�
DictWriter�unix_dialectc�>�eZdZ	dZdZdZdZdZdZdZ	dZ
dZd�Zd�Z
y)r�FNc�X�|jtk7rd|_|j�y)NT)�	__class__r�_valid�	_validate��selfs �*/opt/alt/python312/lib64/python3.12/csv.py�__init__zDialect.__init__-s���>�>�W�$��D�K�����c�f�	t|�y#t$r}tt|���d}~wwxYw�N)�_Dialect�	TypeErrorr�str)r"�es  r#r zDialect._validate2s,��	 ��T�N���	 ���A��-���	 �s��	0�+�0)�__name__�
__module__�__qualname__�_namer�	delimiter�	quotechar�
escapechar�doublequote�skipinitialspace�lineterminator�quotingr$r �r%r#rrsA���
�E�
�F��I��I��J��K����N��G��
 r%rc�&�eZdZ	dZdZdZdZdZeZ	y)r�,�"TF�
N)
r,r-r.r0r1r3r4r5rr6r7r%r#rr9s$��E��I��I��K����N��Gr%rc��eZdZ	dZy)r�	N)r,r-r.r0r7r%r#rrCs
��O��Ir%rz	excel-tabc�&�eZdZ	dZdZdZdZdZeZ	y)rr9r:TF�
N)
r,r-r.r0r1r3r4r5r
r6r7r%r#rrHs$��D��I��I��K����N��Gr%r�unixc�|�eZdZ		dd�Zd�Zed��Zejd��Zd�Ze	e
j�Zy)rNc��|�t|�|urt|�}||_||_||_t||g|��i|��|_||_d|_y�Nr)�iter�list�_fieldnames�restkey�restvalr�dialect�line_num)r"�f�
fieldnamesrGrHrI�args�kwdss        r#r$zDictReader.__init__TsZ���!�d�:�&6�*�&D��j�)�J�%����������Q��7�$�7�$�7��������
r%c��|Sr'r7r!s r#�__iter__zDictReader.__iter___s���r%c��|j�	t|j�|_|jj|_|jS#t$rY�2wxYwr')rF�nextr�
StopIterationrJr!s r#rLzDictReader.fieldnamesbsW�����#�
�#'����#4�� ����,�,��
������!�
��
�s�A�	A�Ac��||_yr')rF)r"�values  r#rLzDictReader.fieldnamesls
�� ��r%c���|jdk(r|jt|j�}|jj|_|gk(rt|j�}|gk(r�t	t|j|��}t
|j�}t
|�}||kr||d||j<|S||kDr#|j|dD]}|j||<�|SrC)	rJrLrRr�dict�zip�lenrGrH)r"�row�d�lf�lr�keys      r#�__next__zDictReader.__next__ps����=�=�A���O�O��4�;�;������,�,��
�
�R�i��t�{�{�#�C��R�i���T�_�_�c�*�+��
����
!��
��X��
��7�!�"�#�h�A�d�l�l�O����"�W����r�s�+������#��,��r%)NNNr)
r,r-r.r$rP�propertyrL�setterr_�classmethod�types�GenericAlias�__class_getitem__r7r%r#rrSsX��AE� �	��� �� ����!��!��,$�E�$6�$6�7�r%rc�T�eZdZ		dd�Zd�Zd�Zd�Zd�Zee	j�Zy)rc���|�t|�|urt|�}||_||_|j	�}|dvrtd|z��||_t||g|��i|��|_y)N)�raise�ignorez-extrasaction (%s) must be 'raise' or 'ignore')rDrErLrH�lower�
ValueError�extrasactionr)r"rKrLrHrlrIrMrNs        r#r$zDictWriter.__init__�s{���!�d�:�&6�*�&D��j�)�J�$������#�)�)�+���2�2��L�+�,�-�
-�(����Q��7�$�7�$�7��r%c�v�tt|j|j��}|j|�Sr')rWrXrL�writerow)r"�headers  r#�writeheaderzDictWriter.writeheader�s*���c�$�/�/�4�?�?�;�<���}�}�V�$�$r%c�����jdk(rS�j��jz
}|r4tddj	|D�cgc]
}t|���c}�z����fd��jD�Scc}w)Nrhz(dict contains fields not in fieldnames: z, c3�V�K�|] }�j|�j����"y�wr')�getrH)�.0r^�rowdictr"s  ��r#�	<genexpr>z+DictWriter._dict_to_list.<locals>.<genexpr>�s!�����J�/�3����C����.�/�s�&))rl�keysrLrk�join�repr)r"ru�wrong_fields�xs``  r#�
_dict_to_listzDictWriter._dict_to_list�st�������'�"�<�<�>�D�O�O�;�L�� �!K�#'�9�9�|�-L�|�!�d�1�g�|�-L�#M�"N�O�O�J�$�/�/�J�J��.Ms�A;c�V�|jj|j|��Sr')rrnr|)r"rus  r#rnzDictWriter.writerow�s"���{�{�#�#�D�$6�$6�w�$?�@�@r%c�`�|jjt|j|��Sr')r�	writerows�mapr|)r"�rowdictss  r#rzDictWriter.writerows�s$���{�{�$�$�S��);�);�X�%F�G�Gr%N)rrhr)r,r-r.r$rpr|rnrrbrcrdrer7r%r#rr�s7��?F� �8�%�K�A�H�$�E�$6�$6�7�r%rc�.�eZdZ	d�Zdd�Zd�Zd�Zd�Zy)rc��gd�|_y)N)r9r=�;� �:)�	preferredr!s r#r$zSniffer.__init__�s	��3��r%Nc���	|j||�\}}}}|s|j||�\}}|std��Gd�dt�}||_||_|xsd|_||_|S)NzCould not determine delimiterc��eZdZdZdZeZy)�Sniffer.sniff.<locals>.dialect�sniffedr;N)r,r-r.r/r5rr6r7r%r#rIr��s���E�#�N�#�Gr%rIr:)�_guess_quote_and_delimiter�_guess_delimiterrrr3r0r1r4)r"�sample�
delimitersr1r3r0r4rIs        r#�sniffz
Sniffer.sniff�s���	�
�2�2�6�:�F�	<�	�;�	�+;��*.�*?�*?��@J�+L�'�I�'���7�8�8�	$�g�	$�*���%���%�,����#3�� ��r%c�.�	g}dD]L}tj|tjtjz�}|j	|�}|s�Ln|syi}i}d}j
}	|D]k}
|	ddz
}|
|}|r|j
|d�dz||<	|	ddz
}|
|}|r|�||vr|j
|d�dz||<	|	ddz
}|
|s�g|dz
}�mt||j��}
|r't||j��}|||k(}|d	k(rd
}nd
}d}tjdtj|�|
d�ztj�}|j|�rd
}nd}|
|||fS#t$rY��wxYw#t$rY��'wxYw)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��delim�space�r^r?rz]((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$))r�r�TF)�re�compile�DOTALL�	MULTILINE�findall�
groupindexrs�KeyError�max�escape�search)r"�datar��matches�restr�regexp�quotes�delims�spacesr��m�nr^r1r�r4�	dq_regexpr3s                  r#r�z"Sniffer._guess_quote_and_delimiter�s���		���H�E��Z�Z��r�y�y�2�<�<�'?�@�F��n�n�T�*�G���H��'��������&�&�
��A��7�#�a�'�A��A�$�C��$�j�j��a�0�1�4��s��
��w�'�!�+����d���
�*�c�Z�.?�$�j�j��a�0�1�4��s��
��w�'�!�+����t��!���#�&��F�J�J�/�	����F�J�J�/�E�%�e�}��6����}����E� ���J�J��(*�	�	�%�(8�)�L� M�NP�l�l�\�	����D�!��K��K��;��/?�@�@��I�
��
���
��
�s$�
E7�F�7	F�F�	F�Fc��	ttd|jd���}td�D�cgc]
}t	|���}}tdt
|��}d}i}i}i}	d|}}
|
t
|�k�r	|dz
}||
|D]I}|D]B}
|j|
i�}|j|
�}|j|d�dz||<|||
<�D�K|j�D]�}
t||
j��}t
|�dk(r|dddk(r�9t
|�dkDrLt|d���||
<|j||
�||
d||
dtd�|D��z
f||
<��|d||
<��|j�}tt||zt
|���}d	}d
}t
|	�dk(rR||k\rM|D]/\}}|ddkDs�|ddkDs�|d|z|k\s�$|�||vs�+||	|<�1|dz}t
|	�dk(r||k\r�Mt
|	�dk(rLt|	j��d}|dj|�|djd|z�k(}||fS|}
||z
}|
t
|�kr��	|	sy
t
|	�dkDrU|jD]F}||	j�vs�|dj|�|djd|z�k(}||fcS|	j�D��cgc]	\}}||f��}}}|j!�|dd}|dj|�|djd|z�k(}||fScc}wcc}}w)Nr?��
rr�c��|dS)Nr�r7)r{s r#�<lambda>z*Sniffer._guess_delimiter.<locals>.<lambda>Ns��1�Q�4r%r�c3�&K�|]	}|d���y�w)r�Nr7)rt�items  r#rvz+Sniffer._guess_delimiter.<locals>.<genexpr>Ss����(C�U�T��a��U�s�g�?g�������?g{�G�z�?z%c )rr���)rE�filter�split�range�chr�minrYrs�countrw�itemsr��remove�sum�floatr��sort)r"r�r��c�ascii�chunkLength�	iteration�
charFrequency�modesr��start�end�line�char�
metaFrequency�freqr��modeList�total�consistency�	threshold�k�vr�r4r[s                          r#r�zSniffer._guess_delimiters���	�$�F�4����D�!1�2�3��!&�s��,��A��Q����,��"�c�$�i�(���	��
�������s���c�$�i����N�I��U�3���!�D�$1�$5�$5�d�B�$?�M��:�:�d�+�D�*7�*;�*;�D�!�*D�q�*H�M�$�'�*7�M�$�'�
"�(�&�*�*�,���]�4�0�6�6�8�9���u�:��?�u�Q�x��{�a�'7���u�:��>�"%�e��"@�E�$�K��L�L��t��-�#(��;�q�>�5��;�q�>�%(�(C�U�(C�%C�4D�#E�E�$�K�#(��(�E�$�K�-� �{�{�}�H��#�k�I�5�s�4�y�A�B�E��K��I��f�+��"�{�i�'?�$�D�A�q���t�a�x�A�a�D�1�H��q�T�%�Z�K�7�'�/�1�
�?�()�F�1�I�	%�
�t�#��
�f�+��"�{�i�'?��6�{�a���V�[�[�]�+�A�.��$(��G�M�M�%�$8�$(��G�M�M�%�%�-�$@�%A� ��/�0�0��E��;��C�c�c�$�i��f���v�;��?��^�^������
�%�(,�Q��
�
�a�(8�(,�Q��
�
�e�a�i�(@�)A�$��/�0�0�	$�%+�L�L�N�3�N�5�A�a�!�A��N��3�
�
�
���b�	�!��� ��G�M�M�%�0� ��G�M�M�%�%�-�8�9���'�(�(��_-��R4s�M�9Mc��tt|�|j|��}t|�}t	|�}i}t|�D]}d||<�	d}|D]d}|dkDrn]|dz
}t	|�|k7r�t
|j��D]+}	t}
	|
||	�|
||	k7s�||	�|
||	<�)||	=�-�fd}|j�D]C\}	}t|t�rt	||	�|k7r|dz
}�-|dz}�3	|||	�|dz}�E|dkDS#ttf$rt	||	�}
Y��wxYw#ttf$r|dz
}Y��wxYw)Nr�r�)rrr�rRrYr�rErw�complexrk�
OverflowErrorr��
isinstance�intr))
r"r��rdrro�columns�columnTypes�i�checkedrZ�col�thisType�	hasHeader�colTypes
             r#�
has_headerzSniffer.has_header�s����X�f�%�t�z�z�&�'9�:���c����f�+�����w��A�$��Q������C���|���q�L�G��3�x�7�"���K�,�,�.�/��"��-��S��X�&�
�{�3�/�/�"�3�'�/�+3��C�(�(��,�0��6�	�'�-�-�/�L�C���'�3�'��v�c�{�#�w�.���N�I���N�I�#��F�3�K�(���N�I�0��1�}���;#�M�2�-�"�3�s�8�}�H�-��0#�I�.�#���N�I�#�s$�D�D=�D:�9D:�=E�Er')r,r-r.r$r�r�r�r�r7r%r#rr�s%���4�
�:IA�Xd)�N=r%r)r�rc�_csvrrrrrrr	r
rrr
rrrrrrr(�ior�__all__rrrrrrr7r%r#�<module>r�s����
�������%���� � �>�G����%� ������i�(��7�����&�38�38�l 8� 8�FW�Wr%

?>