L i$ddlmZddlZddlZddlmZmZddlmZm Z m Z ddl m Z m Z mZddlmZddlmZddlmZmZmZmZerdd lmZd d ZGd d Zy)) annotationsN)ChainMapUserDict) TYPE_CHECKINGAnycast) LayoutConfigWidthWithoutContentvalidate_width)Json)gather_metrics)is_custom_dict is_list_like is_namedtupleis_pydantic_model)DeltaGeneratorcNt|tr t|St|S)z\A repr function for json.dumps default arg, which tries to serialize sets as lists. ) isinstancesetlistrepr)os ]/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/elements/json.py_ensure_serializationr(s !C(475d1g5cReZdZedddd ddZed dZy) JsonMixinjsonTstretch)expandedwidthc4t|r|j}t|r|j}t |t t jtfs t|r t|}t|r t|}t |ts tj|t }t)}||_t |t,r||_n7t |t0rd|_||_nt#dt5|dt7|t9| }|j$j;d || S#t"$rE}|j$j'd|dtj|dt }Yd}~d}~wwxYw) aDisplay an object or string as a pretty-printed, interactive JSON string. Parameters ---------- body : object or str The object to print as JSON. All referenced objects should be serializable to JSON as well. If object is a string, we assume it contains serialized JSON. expanded : bool or int The initial expansion state of the JSON element. This can be one of the following: - ``True`` (default): The element is fully expanded. - ``False``: The element is fully collapsed. - An integer: The element is expanded to the depth specified. The integer must be non-negative. ``expanded=0`` is equivalent to ``expanded=False``. Regardless of the initial expansion state, users can collapse or expand any key-value pair to show or hide any part of the object. width : "stretch" or int The width of the JSON element. This can be one of the following: - ``"stretch"`` (default): The width of the element matches the width of the parent container. - An integer specifying the width in pixels: The element has a fixed width. If the specified width is greater than the width of the parent container, the width of the element matches the width of the parent container. Example ------- >>> import streamlit as st >>> >>> st.json( ... { ... "foo": "bar", ... "stuff": [ ... "stuff 1", ... "stuff 2", ... "stuff 3", ... ], ... "level1": {"level2": {"level3": {"a": "b"}}}, ... }, ... expanded=2, ... ) .. output:: https://doc-json.streamlit.app/ height: 385px )defaultzqWarning: this data structure was not fully serializable as JSON due to one or more unexpected keys. (Error was: )T)skipkeysr#Nz The type z5 of `expanded` is not supported, must be bool or int.)r!r) layout_config)rto_dictr_asdictrrtypesMappingProxyTyperrdictrrstrrdumpsr TypeErrordgwarning JsonProtobodyboolr intmax_expand_depthtyper r _enqueue)selfr2r r!err json_protor&s rrzJsonMixin.json0sd~ $ <<>D  <<>D  8U33X> t $:D  :D$$ Vzz$0EF[   h %"*J  # &"&J *2J 'DN+,))  u$51 ww -PP1 VMMPEQRTzz$?TU  VsE F;FFctd|S)zGet our DeltaGenerator.r)r)r8s rr/z JsonMixin.dgs$d++rN)r2objectr z bool | intr!r returnr)r=r)__name__ __module__ __qualname__r rpropertyr/rrrr/shF $%. hQhQ hQ # hQ  hQhQT,,rr)rr<r=zstr | list[Any]) __future__rrr) collectionsrrtypingrrr#streamlit.elements.lib.layout_utilsr r r streamlit.proto.Json_pb2r r1streamlit.runtime.metrics_utilr streamlit.type_utilrrrrstreamlit.delta_generatorrrrrBrrrKsN# *++ 7986o,o,r