Your IP : 3.147.82.108


Current Path : /opt/alt/python312/lib64/python3.12/json/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/json/__pycache__/tool.cpython-312.opt-1.pyc

�

�Q�f
���dZddlZddlZddlZddlmZd�Zedk(r		e�yy#e$r&Z	eje	j�YdZ	[	ydZ	[	wwxYw)aCommand-line tool to validate and pretty-print JSON

Usage::

    $ echo '{"json":"obj"}' | python -m json.tool
    {
        "json": "obj"
    }
    $ echo '{ 1.2:3.4}' | python -m json.tool
    Expecting property name enclosed in double quotes: line 1 column 3 (char 2)

�N)�Pathc��d}d}tj||��}|jddtjd��dtj
�	�|jd
dtdd�	�|jdd
dd��|jdddd��|jdd
dd��|j�}|jddtd��|jddddd �!�|jd"dddd#�!�|jd$d
d%�&�|j�}|j|j|jd'�}|jr
d|d<d(|d)<|j5}	|jr
d*�|D�}nt!j"|�f}|j$�tj&}n|j$j)d+d��}|5}	|D]*}
t!j*|
|	fi|��|	j-d,��,	ddd�ddd�y#1swY�xYw#t.$r}t1|��d}~wwxYw#1swYyxYw)-Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)�prog�description�infile�?zutf-8)�encodingz-a JSON file to be validated or pretty-printed)�nargs�type�help�default�outfilez%write the output of infile to outfilez--sort-keys�
store_trueFz5sort the output of dictionaries alphabetically by key)�actionr
rz--no-ensure-ascii�ensure_ascii�store_falsez(disable escaping of non-ASCII characters)�destrrz--json-linesznparse input using the JSON Lines format. Use with --no-indent or --compact to produce valid JSON Lines output.z--indent�zJseparate items with newlines and use this number of spaces for indentation)r
rrz--tab�store_const�indent�	z9separate items with newlines and use tabs for indentation)rr�constrz--no-indentz/separate items with spaces rather than newlinesz	--compactz1suppress all whitespace separation (most compact))rr)�	sort_keysrr)�,�:�
separatorsc3�FK�|]}tj|����y�w)N)�json�loads)�.0�lines  �0/opt/alt/python312/lib64/python3.12/json/tool.py�	<genexpr>zmain.<locals>.<genexpr>As����<�V�T��
�
�4�(�V�s�!�w�
)�argparse�ArgumentParser�add_argument�FileType�sys�stdinr�add_mutually_exclusive_group�int�
parse_argsrrr�compactr�
json_linesr�loadr�stdout�open�dump�write�
ValueError�
SystemExit)rr�parser�group�options�	dump_argsr�objs�outr�obj�es            r"�mainr@so�� �D�@�K�
�
$�
$�$�K�
H�F�
�����%�.�.��@�L� #�	�	��+����	��!�D� $��&����
�l�E�T��V�
���+�.��G��I�
����|�U�`��a�
�/�/�1�E�	���z�1�3�3��4�
���w�}�8�!�).��/�
���}�]��!�M��O�
���{�<�O��Q����!�G��&�&��.�.��,�,��I�
���"�	�(��"*�	�,��	���6�	 ��!�!�<�V�<���	�	�&�)�+�����&��j�j���o�o�*�*�3��*�A�����C��I�I�c�7�8�i�8��M�M�$�'� ��
������	 ��Q�-���	 ��
��sC�,I�.A(H$�0H�H$�H!	�H$�$	H=�-H8�8H=�=I�I	�__main__)�__doc__r&rr*�pathlibrr@�__name__�BrokenPipeError�exc�exit�errno��r"�<module>rKs^�����
��; �|�z��������������������s�'�A�A
�
A

?>