HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /lib/python3/dist-packages/charset_normalizer/cli/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/charset_normalizer/cli/__pycache__/normalizer.cpython-311.pyc
�

�c&���ddlZddlZddlmZddlmZmZmZmZm	Z	ddl
mZddlm
Z
mZddlmZddlmZddlmZddlmZdd	lmZddeded
efd�Zddee
ed
efd�Zedkre��dSdS)�N)�dumps)�abspath�basename�dirname�join�realpath)�python_version)�List�Optional)�unidata_version)�from_fp)�CliDetectionResult)�__version__�yes�question�default�returnc�b�dddddd�}|�d}n$|dkrd}n|dkrd	}ntd
|z���	tj�||z��t	�����}|�|dkr||S||vr||Stj�d���~)
a�Ask a yes/no question via input() and return their answer.

    "question" is a string that is presented to the user.
    "default" is the presumed answer if the user just hits <Enter>.
        It must be "yes" (the default), "no" or None (meaning
        an answer is required of the user).

    The "answer" return value is True for "yes" or False for "no".

    Credit goes to (c) https://stackoverflow.com/questions/3041986/apt-command-line-interface-like-yes-no-input
    TF)r�y�ye�no�nNz [y/n] rz [Y/n] rz [y/N] zinvalid default answer: '%s'�z3Please respond with 'yes' or 'no' (or 'y' or 'n').
)�
ValueError�sys�stdout�write�input�lower)rr�valid�prompt�choices     �C/usr/lib/python3/dist-packages/charset_normalizer/cli/normalizer.py�query_yes_nor$s����t�4�u�5�I�I�E������	�E�	�	����	�D�������7�'�A�B�B�B�X��
����F�*�+�+�+�����������6�R�<�<���>�!�
�u�_�_���=� ��J���V�W�W�W�X��argvc��
�
���tjd���}|�dtjd��dd���|�dd	d
ddd
���|�ddd
ddd���|�ddd
ddd���|�ddd
ddd���|�ddd
ddd���|�dd d
dd!d"���|�d#d$d%d&td'd(�)��|�d*d+d,�tt��ttj
����d-��rd.nd/��d0�1��|�
|��}|jd2ur&|jdurt!d3t"j�4��d5S|jd2ur&|jdurt!d6t"j�4��d5S|jd7ks|jd8krt!d9t"j�4��d5Sg}|jD�]$�t-�|j|j�:��}|����
�
��t!d<��j|jd8krd=nd>��t"j�4��|�t7t9�j��d;ggd?gdd8d7d;d2�����nQ|�t7t9�j���
j�
j�
fd@��
jD���
j �
j!�
j"�
j#�
j$d;d2����tK|��d5kr�|j&r}|D]z���
krr|�t7t9�j���j�j�fdA��jD���j �j!�j"�j#�j$d;d�����{|jd2u�r>�
j�'dB��d2urRt!dC��j��t"j�4���j(dur��)����7tUtW�j����}tYtW�j����}|�-dD��}|jdur9|�.dE�
j���j(dur��)��nR|jdurIt_dF��j��dG��dur�j(dur��)����"	ta|dD�0|����|dH_1te|dHj1dIdJ�K��5}|�3ti�
����d;d;d;��n#1swxYwYn^#tj$rQ}	t!ti|	��t"j�4���j(dur��)��Yd;}	~	dLSd;}	~	wwxYw�j(dur��)����&|j6durJt!totK|��d5krdM�|D��n|dHj8d2dN�O����n8|jD]0�t!dP�0�fdQ�|D�������1dHS)Rz�
    CLI assistant using ARGV and ArgumentParser
    :param argv:
    :return: 0 if everything is fine, anything else equal trouble
    zvThe Real First Universal Charset Detector. Discover originating encoding used on text file. Normalize text to unicode.)�description�files�rb�+zFile(s) to be analysed)�type�nargs�helpz-vz	--verbose�
store_trueF�verbosezjDisplay complementary information about file if any. Stdout will contain logs about the detection process.)�actionr�destr.z-az--with-alternative�alternativeszIOutput complementary possibilities if any. Top-level JSON WILL be a list.z-nz--normalize�	normalizezLPermit to normalize input file. If not set, program does not write anything.z-mz	--minimal�minimalzBOnly output the charset detected to STDOUT. Disabling JSON output.z-rz	--replace�replacezGReplace file when trying to normalize it instead of creating a new one.z-fz--force�forcezHReplace file without asking if you are sure, use this flag with caution.z-tz--threshold�storeg�������?�	thresholdzUDefine a custom maximum amount of chaos allowed in decoded content. 0. <= chaos <= 1.)r1rr,r2r.z	--version�versionz;Charset-Normalizer {} - Python {} - Unicode {} - SpeedUp {}z.py�OFF�ONz"Show version information and exit.)r1r:r.Tz.Use --replace in addition of --normalize only.)�file�z*Use --force in addition of --replace only.gg�?z---threshold VALUE should be between 0. AND 1.)r9�explainNz4Unable to identify originating encoding for "{}". {}z-Maybe try increasing maximum amount of chaos.r�Unknownc�*��g|]}|�jk�
|��S���encoding)�.0�cp�
best_guesss  �r#�
<listcomp>zcli_detect.<locals>.<listcomp>�s1���������!4�4�4��4�4�4r%c�*��g|]}|�jk�
|��SrBrC)rErF�els  �r#rHzcli_detect.<locals>.<listcomp>�s0���!"�!"�!"�(*�')�R�[�'8�'8�%'�'8�'8�'8r%�utfzJ"{}" file does not need to be normalized, as it already came from unicode.�.���z0Are you sure to normalize "{}" by replacing it ?rr�wzutf-8rC�c��g|]	}|j��
SrB)�__dict__)rErJs  r#rHzcli_detect.<locals>.<listcomp>s��*�*�*����*�*�*r%�)�ensure_ascii�indentz, c�\��g|](}|jt�j��k�|jpd��)S)�	undefined)�pathr�namerD)rErJ�my_files  �r#rHzcli_detect.<locals>.<listcomp>sA��������7�g�g�l�&;�&;�;�;���2�{�;�;�;r%)9�argparse�ArgumentParser�add_argument�FileType�float�formatrr	r�	md_module�__file__r�endswith�
parse_argsr6r4�printr�stderrr7r9r)r
r0�bestrX�appendrrrD�encoding_aliases�could_be_from_charset�language�	alphabets�bom�
percent_chaos�percent_coherence�lenr3�
startswith�closed�closerrr�split�insertr$r�unicode_path�openr�str�IOErrorr5rrQ)
r&�parser�args�x_�matches�dir_path�	file_name�o_�fp�erGrJrYs
          @@@r#�
cli_detectr�0sh������
$�%����F�����h�'��-�-�S�?W������������
�@�
�����������
�
X�
�����������
�
[�
�����������
�
Q�
�����������
�
V�
�����������
�
W�
�����������
�
�
d����������M�T�T�������'�-�-�/�/�8�8��?�?�I�E�E�T�	
�
�2��
�
�
����T�"�"�D��|�t�����%� 7� 7�
�>�S�Z�P�P�P�P��q��z�T���d�l�e�3�3�
�:���L�L�L�L��q��~����t�~��3�3�
�=�C�J�O�O�O�O��q�	�B��:�{�{���'�T�^�T�\�R�R�R���\�\�^�^�
����F�M�M��L��~��+�+�D�C��	���Z�
�
�
�
�
�I�I�"��G�L�)�)�������������
�
�
�
� 
�I�I�"��G�L�)�)��'��/�����",�"B����
�'��(��N��,��0�����
�
�
�(�7�|�|�a���D�$5��!���B��Z�'�'��	�	�.� '��� 5� 5� "�� "� 3�!"�!"�!"�!"�.0�.F�!"�!"�!"�
!#�� "�� "�� "� 0� "� 4� $� %�������(�~��%�%��&�1�1�%�8�8�D�@�@��d�k�k�#�L���!�Z�	�����~��.�.��
�
�����"�8�G�L�#9�#9�:�:��$�X�g�l�%;�%;�<�<�	� )���� 4� 4���<�5�(�(��I�I�b�*�"5�6�6�6��~��.�.��
�
������J�%�'�'�$�J�Q�Q�#�L����	���
���~��.�.��
�
�����	�)-�h�������)E�)E�B�q�E�&��b��e�0�#��H�H�H�2�B�����Z���1�1�1�2�2�2�2�2�2�2�2�2�2�2����2�2�2�2��������#�a�&�&�s�z�2�2�2�2��~��.�.��
�
�����1�1�1�1�1�1�����	�����>�U�"�"��M�M�O�O�O���|�u���
��.1�"�g�g��k�k�*�*�r�*�*�*�*�r�!�u�~�!��
�
�
�	
�	
�	
�	
��z�		�		�G���	�	�����"$������
�
�
�
�
�1s>�AW�#W�?W�W	�W�W	�W�
X2�!AX-�-X2�__main__)r)N) rZr�jsonr�os.pathrrrrr�platformr	�typingr
r�unicodedatar�charset_normalizer.md�mdr`�charset_normalizerr
�charset_normalizer.modelsr�charset_normalizer.versionrrw�boolr$�intr��__name__rBr%r#�<module>r�sj������
�
�
�
�������>�>�>�>�>�>�>�>�>�>�>�>�>�>�#�#�#�#�#�#�!�!�!�!�!�!�!�!�'�'�'�'�'�'�)�)�)�)�)�)�&�&�&�&�&�&�8�8�8�8�8�8�2�2�2�2�2�2�X�X�3�X��X��X�X�X�X�Bv
�v
�X�d�3�i�(�v
�C�v
�v
�v
�v
�r�z����J�L�L�L�L�L��r%