o
    2hq	                     @   s2   d Z ddlZddlZedZedZdddZdS )	a  A module providing a function for serializing JSON values with Infinity.

Python provides no way to override how json.dumps serializes
Infinity/-Infinity/NaN; if allow_nan is true, it encodes them as
Infinity/-Infinity/NaN, in violation of the JSON spec and in violation
of what JSON.parse accepts. If it's false, it throws a ValueError,
Neither subclassing JSONEncoder nor passing a function in the |default|
keyword argument overrides this.
    Ninfz-infutf-8c                    s   t | tr| S t | tr!| tkrdS | tkrdS t| rdS | S t | tr+|  S t | t	t
fr; fdd| D S t | trK fddt| D S t | tr^t fdd|  D S | S )	a  Makes Python object appropriate for JSON serialization.

    - Replaces instances of Infinity/-Infinity/NaN with strings.
    - Turns byte strings into unicode strings.
    - Turns sets into sorted lists.
    - Turns tuples into lists.

    Args:
      obj: Python data structure.
      encoding: Charset used to decode byte strings.

    Returns:
      Unicode JSON data structure.
    Infinityz	-InfinityNaNc                       g | ]}t | qS  Cleanse.0iencodingr   X/var/www/html/chatgem/venv/lib/python3.10/site-packages/tensorboard/backend/json_util.py
<listcomp>@       zCleanse.<locals>.<listcomp>c                    r   r   r   r
   r   r   r   r   B   r   c                 3   s(    | ]\}}t | t | fV  qd S )Nr   )r   kvr   r   r   	<genexpr>D   s    
zCleanse.<locals>.<genexpr>)
isinstanceintfloat	_INFINITY_NEGATIVE_INFINITYmathisnanbytesdecodelisttuplesetsorteddictcollectionsOrderedDictitems)objr   r   r   r   r	   #   s*   






r	   )r   )__doc__r#   r   r   r   r   r	   r   r   r   r   <module>   s   