o
    tf                     @   sb   d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddd	Z	e
d
kr/ee	  dS dS )zA tool to parse and pretty-print JSON5.

Usage:

    $ echo '{foo:"bar"}' | python -m json5.tool
    {
        foo: 'bar',
    }
    $ echo '{foo:"bar"}' | python -m json5.tool --as-json
    {
        "foo": "bar"
    }
    N   )
arg_parser)lib)Host)__version__c                 C   s  |pt  }tj|dtd}|jddddd |jdd	d
dddd |jddddd |jddddd |jddddd |jddddd |jdd dd!d" |jd#d$d%d&d'd( || }|jd ure|jS |jro|t	 d)S |j
rv|j
}n|jd&kr|j }n||j}|jd*krd |_nzt|j|_W n	 ty   Y nw |jrd|_d|_t|}tj||j|j|jd+}|| d)S ),NZjson5)progZdescz-cZSTRcmdz:inline json5 string to read instead of reading from a file)metavardesthelpz	--as-jsonas_jsonstore_constTFz:output as JSON (same as --quote-keys --no-trailing-commas))r
   actionconstdefaultr   z--indentindent   z0amount to indent each line (default is 4 spaces))r
   r   r   z--quote-keys
store_truezquote all object keys)r   r   r   z--no-quote-keysstore_false
quote_keyszBdon't quote object keys that are identifiers (this is the default))r   r
   r   z--trailing-commaszUadd commas after the last item in multi-line objects and arrays (this is the default)z--no-trailing-commastrailing_commaszEdo not add commas after the last item in multi-line lists and objects)r
   r   r   fileFILE?-z`optional file to read JSON5 document from; if not specified or "-", will read from stdin instead)r	   nargsr   r   r   None)r   r   r   )r   r   ArgumentParser__doc__add_argument
parse_argsZexit_statusversionprint_r   r   r   stdinreadZread_text_filer   int
ValueErrorr   r   r   r   loadsdumps)argvhostparserargsinpobjs r0   S/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/json5/tool.pymain%   s   

	





r2   __main__)NN)r   sys r   r   r*   r   r!   r   r2   __name__exitr0   r0   r0   r1   <module>   s   
c