관리-도구
편집 파일: tool.cpython-39.pyc
a �����DOg ������������������� ���@���sx���d�Z�ddlZddlZddlZddlmZ�dd��Zedkrtz e���W�n0�eyr�Z �ze� e j��W�Y�dZ [ n dZ [ 0�0�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) �����N)�Pathc������������������C���s���d}�d}t�j|�|d�}|jddt�jdd�dtjd ��|jd dtdd�d ��|jdd ddd��|jddddd��|jdd ddd��|���}|jddtdd��|jddddd d!��|jd"ddd�d#d!��|jd$d d%d&��|� ��}|j |j|jd'�}|j �rd�|d<�d(|d)<�|j��}z�|j�r$d*d+��|D��}nt�|�f}|jd�u��rDtj}n|jjd,dd�}|�:} |D�]$} tj| | fi�|���| �d-���q^W�d�����n1��s�0����Y��W�n.�t�y��}�zt|��W�Y�d�}~n d�}~0�0�W�d�����n1��s�0����Y��d�S�).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)�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��qd�S�)N)�json�loads)�.0�line��r����!/usr/lib64/python3.9/json/tool.py� <genexpr>A��������zmain.<locals>.<genexpr>�w� )�argparse�ArgumentParser�add_argument�FileType�sys�stdinr����add_mutually_exclusive_group�int� parse_argsr���r���r���Zcompactr���Z json_linesr����loadr����stdout�open�dump�write� ValueError� SystemExit)r���r����parser�group�optionsZ dump_argsr���Zobjs�outr����obj�er���r���r����main���st���� �� � � � � � ���2r:����__main__)�__doc__r$���r���r(����pathlibr���r:����__name__�BrokenPipeError�exc�exit�errnor���r���r���r����<module>���s���>