HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/pip/_vendor/rich/__pycache__/json.cpython-37.pyc
B

L��g��
@sZddlmZddlmZmZddlmZmZmZm	Z	ddl
mZddlm
Z
mZGdd�d�Zed	k�rVdd
lZdd
lZejdd�Zejd
ddd�ejdddeddd�e��ZddlmZe�Zedd�Zy(ejdkr�ej��Z neej��!�Z WnFe"k
�r<Z#z&e�$dej�de#���e�%d�Wd
d
Z#[#XYnXej$ee ej&d�dd�d
S) �)�Path)�loads�dumps)�Any�Callable�Optional�Union�)�Text)�JSONHighlighter�NullHighlighterc
@s�eZdZdZdeedeefeeeeeee	e
ge
fedd�
dd�Zede
edeefeeeeeee	e
ge
fedd	�
d
d��Z
ed�d
d�ZdS)�JSONa_A renderable which pretty prints JSON.

    Args:
        json (str): JSON encoded data.
        indent (Union[None, int, str], optional): Number of characters to indent by. Defaults to 2.
        highlight (bool, optional): Enable highlighting. Defaults to True.
        skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False.
        ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False.
        check_circular (bool, optional): Check for circular references. Defaults to True.
        allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True.
        default (Callable, optional): A callable that converts values that can not be encoded
            in to something that can be JSON encoded. Defaults to None.
        sort_keys (bool, optional): Sort dictionary keys. Defaults to False.
    �TFN)
�json�indent�	highlight�	skip_keys�ensure_ascii�check_circular�	allow_nan�default�	sort_keys�returnc

CsNt|�}
t|
|||||||	d�}|r*t�nt�}||�|_d|j_d|j_dS)N)r�skipkeysrrrrrT)rrrr�text�no_wrap�overflow)�selfrrrrrrrrr�data�highlighter�r �9/tmp/pip-unpacked-wheel-hv55ucu3/pip/_vendor/rich/json.py�__init__s
z
JSON.__init__)
rrrrrrrrrrc


CsP|�|�}
t||||||||	d�}|r,t�nt�}||�|
_d|
j_d|
j_|
S)a|Encodes a JSON object from arbitrary data.

        Args:
            data (Any): An object that may be encoded in to JSON
            indent (Union[None, int, str], optional): Number of characters to indent by. Defaults to 2.
            highlight (bool, optional): Enable highlighting. Defaults to True.
            default (Callable, optional): Optional callable which will be called for objects that cannot be serialized. Defaults to None.
            skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False.
            ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False.
            check_circular (bool, optional): Check for circular references. Defaults to True.
            allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True.
            default (Callable, optional): A callable that converts values that can not be encoded
                in to something that can be JSON encoded. Defaults to None.
            sort_keys (bool, optional): Sort dictionary keys. Defaults to False.

        Returns:
            JSON: New JSON object from the given data.
        )rrrrrrrTN)�__new__rrrrrr)
�clsrrrrrrrrrZ
json_instancerrr r r!�	from_data5s

zJSON.from_data)rcCs|jS)N)r)rr r r!�__rich__esz
JSON.__rich__)rTFFTTNF)rTFFTTNF)�__name__�
__module__�__qualname__�__doc__�strr�int�boolrrrr"�classmethodr%r
r&r r r r!r
	s*,,$r
�__main__NzPretty print json)�description�path�PATHzpath to file, or - for stdin)�metavar�helpz-iz--indentZSPACESzNumber of spaces in an indentr)r3�typer4r)�ConsoleT)�stderr�-zUnable to read z; ���)r)Z	soft_wrap)'�pathlibrrrr�typingrrrrrr
rrrr
r'�argparse�sys�ArgumentParser�parser�add_argumentr,�
parse_args�argsZpip._vendor.rich.consoler6�consoleZ
error_consoler1�stdin�readZ	json_data�	read_text�	Exception�error�print�exitrr r r r!�<module>s@`