File "tool.cpython-38.pyc"
Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/lib64/python3.8/json/__pycache__/tool.cpython-38.pyc
File size: 1.85 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit
U
e5d
@ sj d Z ddlZddlZddlZdd Zedkrfz
e W n. ek
rd Z zeej W 5 dZ[X Y nX dS )a Command-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 C s4 d} d}t j| |d}|jddt jdddtjd |jd
dt jddddtjd |jd
dddd |jddddd | }|j}|j }|j
}|j}| |~ zJ|rdd |D }nt
|f}|D ] } tj| ||dd |d qW n, tk
r }
zt|
W 5 d }
~
X Y nX W 5 Q R X W 5 Q R X d S )Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)progdescriptioninfile?zutf-8)encodingz-a JSON file to be validated or pretty-printed)nargstypehelpdefaultoutfilewz%write the output of infile to outfilez--sort-keys
store_trueFz5sort the output of dictionaries alphabetically by key)actionr
r z--json-linesz&parse input using the jsonlines formatc s s | ]}t |V qd S )N)jsonloads).0line r !/usr/lib64/python3.8/json/tool.py <genexpr>, s zmain.<locals>.<genexpr> ) sort_keysindent
)argparseArgumentParseradd_argumentZFileTypesysstdinstdout
parse_argsr r r
json_linesr loaddumpwrite
ValueError
SystemExit)r r parserZoptionsr r r r! Zobjsobjer r r main sD
r* __main__)
__doc__r r r r* __name__BrokenPipeErrorexcexiterrnor r r r <module> s $