L i& UddlmZddlZddlmZmZmZmZddlmZm Z m Z m Z m Z m Z ddlmZddlmZddlmZddlmZmZdd lmZdd lmZdd lmZmZdd lmZm Z m!Z!erdd l"m#Z#ddl$m%Z%ddl&m'Z'e(e)zZ*de+d<e dZ,de+d<e-e)ze.ze(ze/zZ0de+d<e eeeeddee0fZ1de+d< d dZ2 d!dZ3e d"dZ4e d#dZ4d$dZ4 d%dZ5 d& d'dZ6 d(dZ7d)dZ8y)*) annotationsN)datedatetimetime timedelta) TYPE_CHECKINGAnyLiteral TypeAliasUnionoverload)Message)config)current_form_id)StreamlitDuplicateElementIdStreamlitDuplicateElementKey) ChatInput)LabelVisibilityMessage)ScriptRunContextget_script_run_ctx)GENERATED_ELEMENT_ID_PREFIX TESTING_KEYuser_key_from_element_id)ellipsis)Iterable)DeltaGeneratorr Key)visiblehidden collapsedLabelVisibilityPROTO_SCALAR_VALUEr SAFE_VALUESc|dk(rtjjS|dk(rtjjS|dk(rtjjSt d|)zNReturns one of LabelVisibilityMessage enum constants.py based on string value.rrr z Unknown label visibility value: )rLabelVisibilityOptionsVISIBLEHIDDEN COLLAPSED ValueError)label_visibility_strings b/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/elements/lib/utils.py get_label_visibility_proto_valuer,Esg )+%<<DDD(*%<<CCC+-%<<FFF 78O7PQ RRc|durtjjS|durtjjS|dk(rtjjS|dk(rtjj St d|)zEReturns one of ChatInput.AcceptFile enum value based on string value.FTmultiple directoryzUnknown accept file value: )r AcceptFileNONESINGLEMULTIPLE DIRECTORYr))accept_file_values r+&get_chat_input_accept_file_proto_valuer7Ts E!##(((D ##***J&##,,,K'##--- 23D2EF GGr-cyNkeys r+to_keyr=es"r-cyr9r:r;s r+r=r=is r-c |dSt|Sr9)strr;s r+r=r=ms;4,CH,r-c|syt|x}r5||jvr|jj|n t|||jvr|jj|yt |)aRegister the element ID and key for the given element. If the element ID or key is not unique, an error is raised. Parameters ---------- element_type : str The type of the element to register. element_id : str The ID of the element to register. Raises ------ StreamlitDuplicateElementKey If the element key is not unique. StreamlitDuplicateElementID If the element ID is not unique. N)rwidget_user_keys_this_runaddrwidget_ids_this_runr)ctx element_type element_iduser_keys r+_register_element_idrIqst2 +J77x7 388 8  ) ) - -h 7.x8 8000 ##J/),77r-c tjdd}|j|jd|r |j|jd|j D]W\}}|jt |jd|jt |jdYt d|jd|S)aKCompute the ID for the given element. This ID is stable: a given set of inputs to this function will always produce the same ID output. Only stable, deterministic values should be used to compute element IDs. Using nondeterministic values as inputs can cause the resulting element ID to change between runs. The element ID includes the user_key so elements with identical arguments can use it to be distinct. The element ID includes an easily identified prefix, and the user_key as a suffix, to make it easy to identify it and know if a key maps to it. md5F)usedforsecurityzutf-8-)hashlibnewupdateencodeitemsr@r hexdigest)rFrHkwargshkvs r+_compute_element_idrXs  E51AHH\  )* )* )1 Qw'( Qw'()* *!AKKM?!H: FFr-c t}|duxr|duxst|t}t|tr+|r)|jDcic] \}}||vs ||} }}n|rini|} |r|j| d<|r)|s't || d<|j j| d<t||fi| } |r t||| | Scc}}w)aDCompute and register the ID for the given element. This ID is stable: a given set of inputs to this function will always produce the same ID output. Only stable, deterministic values should be used to compute element IDs. Using nondeterministic values as inputs can cause the resulting element ID to change between runs. The element ID includes the user_key so elements with identical arguments can use it to be distinct. The element ID includes an easily identified prefix, and the user_key as a suffix, to make it easy to identify it and know if a key maps to it. The element ID gets registered to make sure that only one ID and user-specified key exists at the same time. If there are duplicated IDs or keys, an error is raised. Parameters ---------- element_type : str The type (command name) of the element to register. user_key : str | None The user-specified key for the element. `None` if no key is provided or if the element doesn't support a specifying a key. dg : DeltaGenerator | None The DeltaGenerator of each element. `None` if the element is not a widget. kwargs : SAFE_VALUES | Iterable[SAFE_VALUES] The arguments to use to compute the element ID. The arguments must be stable, deterministic values. Some common parameters like key, disabled, format_func, label_visibility, args, kwargs, on_change, and the active_script_hash are not supposed to be added here key_as_main_identity : bool | set[str] If True and a key is provided by the user, we don't include command kwargs in the element ID computation. If a set of kwarg names is provided and a key is provided, only the kwargs with names in this set will be included in the element ID computation. NTactive_script_hashform_idactive_dg_root_container) r isinstancesetrRrZr _active_dg_root_containerrXrI) rFrHdgkey_as_main_identityrTrEignore_command_kwargsrVrW kwargs_to_userGs r+compute_and_register_element_idresb  C %D0  %O*5I3*O&,*0,,.V$!QAAUrs#44,=V3M !(8sY$%EFF % d 2S 85 @I@     Y  S, S< SH>H#H" " "  -%8 %8),%8:=%8 %8T GGG2G G@QQQ  Q * Q 2 Q Qh4r-