AlkantarClanX12

Your IP : 3.145.109.244


Current Path : /opt/alt/python37/lib64/python3.7/json/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/json/__pycache__/tool.cpython-37.opt-1.pyc

B

� f%�
@sjdZddlZddlZddlZdd�Zedkrfy
e�Wn.ek
rdZze�ej	�WddZ[XYnXdS)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)

�Nc	Cs�d}d}tj||d�}|jddtjdd�dd	�|jd
dtjddd�dd	�|jd
dddd�|��}|jpptj}|jp|tj	}|j
}|�@yt�|�}Wn*t
k
r�}zt|��Wdd}~XYnXWdQRX|�"tj|||dd�|�d�WdQRXdS)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�outfile�wz%write the output of infile to outfilez--sort-keys�
store_trueFz5sort the output of dictionaries alphabetically by key)�action�defaultr	�)�	sort_keys�indent�
)�argparse�ArgumentParser�add_argumentZFileType�
parse_argsr�sys�stdinr
�stdoutr�json�load�
ValueError�
SystemExit�dump�write)	rr�parserZoptionsrr
r�obj�e�r#�./opt/alt/python37/lib64/python3.7/json/tool.py�mains*
$r%�__main__)
�__doc__rrrr%�__name__�BrokenPipeError�exc�exit�errnor#r#r#r$�<module>s