o
    gn                  
   @   sn   	 d dl Z d dlZd dlZdd Zedkr5ze  W dS  ey4 Z zeej W Y dZ[dS dZ[ww dS )    Nc                  C   s  d} d}t j| |d}|jddt jdddtjd	 |jd
dt jddddtjd	 |jddddd |jddddd |jddddd | }|jddtdd |jdddd d!d" |jd#ddd d$d" |jd%dd&d' |	 }|j
|j|jd(}|jrd |d< d)|d*< |j\}|j@}z'|jrd+d, |D }nt|f}|D ]}	tj|	|fi | |d- qW n ty }
 zt|
d }
~
ww W d    n1 sw   Y  W d    d S W d    d S 1 sw   Y  d S ).Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)progdescriptioninfile?zutf-8)encodingz-a JSON file to be validated or pretty-printed)nargstypehelpdefaultoutfilewz%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_asciiZstore_falsez(disable escaping of non-ASCII characters)destr   r	   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
   r   r	   z--tabstore_constindent	z9separate items with newlines and use tabs for indentation)r   r   constr	   z--no-indentz/separate items with spaces rather than newlinesz	--compactz1suppress all whitespace separation (most compact))r   r	   )	sort_keysr   r   ),:Z
separatorsc                 s   s    | ]}t |V  qd S )N)jsonloads).0line r   ?/Users/admin/.pyenv/versions/3.10.0/lib/python3.10/json/tool.py	<genexpr>@   s    zmain.<locals>.<genexpr>
)argparseArgumentParseradd_argumentZFileTypesysstdinstdoutZadd_mutually_exclusive_groupint
parse_argsr   r   r   compactr   r   Z
json_linesr   loaddumpwrite
ValueError
SystemExit)r   r   parsergroupoptionsZ	dump_argsr   r   Zobjsobjer   r   r   main   sv   






Pr4   __main__)	r!   r   r$   r4   __name__BrokenPipeErrorexcexiterrnor   r   r   r   <module>   s    8