L iVUdZddlmZddlZddlmZmZddlmZddl m Z m Z m Z m Z mZmZmZmZddlmZmZmZmZmZmZmZddlmZdd lmZmZdd lm Z dd l!m"Z"dd l#m$Z$dd l%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;mZ>ddl?m@Z@ddlAmBZBmCZCddlDmEZEmFZFddlGmHZHddlImJZJddlKmLZLdd lMmNZNdd!lOmPZPdd"lQmRZRdd#lSmTZTdd$lUmVZVdd%lWmXZXdd&lYmZZZdd'l[m\Z\dd(l]m^Z^dd)l_m`Z`dd*lambZbdd+lcmdZddd,lemfZfdd-lgmhZhdd.limjZjdd/lkmlZldd0lmmnZndd1lompZpdd2lqmrZrdd3lsmtZtdd4lumvZvdd5lwmxZxdd6lymzZzdd7l{m|Z|dd8l}m~Z~dd9lmZdd:lmZdd;lmZddlmZdd?lmZdd@lmZddAlmZe rddBlmZddClmZddDlmZddElmZddFlDmZdGZdHedI<edJZeZdKedL<eeZdKedM<dNadOedP<dVdQZdVdRZGdSdTge ebe$e&edefehejele(ene.e0ere2e4e6e,e8e:e<e@eJeHeLeNetevePeReTe*eVexe|eze~eXeZe>e\eee^ee"e`epeZdWdUZy)Xz@Allows us to create and absorb changes (aka Deltas) to elements.) annotationsN)CallableIterable)deepcopy) TYPE_CHECKINGAnyFinalLiteralNoReturn TypeAliasTypeVarcast)cli_utilconfigcursorenv_utilloggerruntimeutil)BidiComponentMixin)context_dg_stack"get_last_dg_added_to_context_stack) AlertMixin) ArrowMixin) BalloonsMixin) BokehMixin) CodeMixin) PydeckMixin) HelpMixin) EmptyMixin)ExceptionMixin) FormMixin) GraphvizMixin) HeadingMixin) HtmlMixin) IframeMixin) ImageMixin) JsonMixin) LayoutsMixin)FormDatacurrent_form_id)get_height_configget_width_config)MapMixin) MarkdownMixin) MediaMixin) MetricMixin)PdfMixin) PlotlyMixin) ProgressMixin) PyplotMixin) SnowMixin) SpaceMixin) TextMixin) ToastMixin)VegaChartsMixin)AudioInputMixin) ButtonMixin)ButtonGroupMixin)CameraInputMixin) ChatMixin) CheckboxMixin)ColorPickerMixin)DataEditorMixin)FileUploaderMixin)MultiSelectMixin)NumberInputMixin) RadioMixin)SelectSliderMixin)SelectboxMixin) SliderMixin)TextWidgetsMixin)TimeWidgetsMixin) WriteMixin)StreamlitAPIException) Block_pb2ForwardMsg_pb2) RootContainer)caching)enqueue_message)get_script_run_ctx) TracebackType)Message)Cursor)AddRowsMetadata) LayoutConfigiz Final[int]MAX_DELTA_BYTESValuer BlockTypeAncestorBlockTypesFbool_use_warning_has_been_displayedctsdatjddd}tjr)t j djd|dy tjsUtjdr?tjd }t j djd|d |d y y y y ) zPrint a warning if Streamlit is imported but not being run with `streamlit run`. The warning is printed only once, and is printed using the root logger. TWarning:yellowboldfgroot z to view a Streamlit app on a browser, use Streamlit in a file and run it with the following command: streamlit run [FILE_NAME] [ARGUMENTS]z#global.showWarningOnDirectExecutionrzb to view this Streamlit app on a browser, run it with the following command: streamlit run z [ARGUMENTS]N)r^r style_for_cliris_replr get_loggerwarningrexistsr get_optionsysargv)rj script_names _/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/delta_generator.py_maybe_print_use_warningrqs +*.'(($8L       f % - -wi **  !f&7&7 1' ((1+K   f % - -wi BBMO  ' ! +ct}|rOt|ddrAtjddd}t j dj d|d y y y ) zJPrint a warning if elements are being modified during a fragment callback.in_fragment_callbackFr`Trarbrerfa A fragment rerun was triggered with a callback that displays one or more elements. During a fragment rerun, within a callback, displaying elements is not officially supported because those elements will replace the existing elements at the top of your app.N)rSgetattrrrgrrirj)ctxrjs rp&_maybe_print_fragment_callback_warningrws`  C ws2E:(($8L&!))7)X X ;srrcNeZdZdZej dddf ddZddZddZ ddZ e ddZ e ddZ dd Z dd Ze dd Ze dd Z dd Ze ddZe ddZe ddZddZ d d!dZ d d"dZy)#DeltaGeneratoraGCreator of Delta protobuf messages. Parameters ---------- root_container: BlockPath_pb2.BlockPath.ContainerValue or None The root container for this DeltaGenerator. If None, this is a null DeltaGenerator which doesn't print to the app at all (useful for testing). cursor: cursor.Cursor or None This is either: - None: if this is the running DeltaGenerator for a top-level container (MAIN or SIDEBAR) - RunningCursor: if this is the running DeltaGenerator for a non-top-level container (created with dg.container()) - LockedCursor: if this is a locked DeltaGenerator returned by some other DeltaGenerator method. E.g. the dg returned in dg = st.text("foo"). parent: DeltaGenerator To support the `with dg` notation, DGs are arranged as a tree. Each DG remembers its own parent, and the root of the tree is the main DG. block_type: None or "vertical" or "horizontal" or "column" or "expandable" If this is a block DG, we track its type to prevent nested columns/expanders Nc4||||jk7r td||_||_||_||_d|_|jjD]>}|jjD]}t|s|j|_ !@y)amInserts or updates elements in Streamlit apps. As a user, you should never initialize this object by hand. Instead, DeltaGenerator objects are initialized for you in two places: 1) When you call `dg = st.foo()` for some method "foo", sometimes `dg` is a DeltaGenerator object. You can call methods on the `dg` object to update the element `foo` that appears in the Streamlit app. 2) This is an internal detail, but `st.sidebar` itself is a DeltaGenerator. That's why you can call `st.sidebar.foo()` to place an element `foo` inside the sidebar. NzHDeltaGenerator root_container and cursor.root_container must be the same) root_container RuntimeError_root_container_provided_cursor_parent _block_type _form_data __class__ __bases____dict__valuescallable __module__)selfr{rparent block_typemixinfuncs rp__init__zDeltaGenerator.__init__s0  &"&"7"77Z  .!' %,0^^-- 6E--/ 6D>&*ooDO 6 6rrc,tj|SN)rrepr_rs rp__repr__zDeltaGenerator.__repr__2szz$rrc\tjgtj|yrrsetgetrs rp __enter__zDeltaGenerator.__enter__5s%</335$>rrc ddl}t|Dcgc]}tt||s|c}dfd }|Scc}w)NrcvrEjtjk(rddd}t|ddd}t|dd}t|)NzMethod `z6()` does not exist for `st.sidebar`. Did you mean `st.z()`?zB()` does not exist for `DeltaGenerator` objects. Did you mean `st.`z%()` is not a valid Streamlit command.)r}rPSIDEBARrM)argskwargsmessagenamerstreamlit_methodss rpwrapperz+DeltaGenerator.__getattr__..wrappergs((''=+@+@@"4&)::>tE(0 0#4&)#fD*(0 0dV#HI'0 0rr)rrrrreturnr ) streamlitdirrru)rrst method_namerrs`` @rp __getattr__zDeltaGenerator.__getattr__`sA,/r7 'hwr;?W6XK  1$- s AAct|jt|jt|j|j }t|j |_|S)Nr{rrr)ryr}r_cursorrrr)r_memodgs rp __deepcopy__zDeltaGenerator.__deepcopy__{sM //DLL)DLL)''   !1  rrc#<K|}|||j}|yywr)r)r current_dgs rp _ancestorszDeltaGenerator._ancestorss*,0 $ #++J$sc#dK|jD]}|j|jyw)znIterate all the block types used by this DeltaGenerator and all its ancestor DeltaGenerators. N)rr)ras rp_ancestor_block_typesz$DeltaGenerator._ancestor_block_typess/  $A}}(mm# $s00c&td|DS)Nc3,K|] }|dk(s dyw)columnN).0ancestor_blocks rp z>DeltaGenerator._count_num_of_parent_columns..s  Nh|j>| j>|| S)aCreate NewElement delta, fill it, and enqueue it. Parameters ---------- delta_type : str The name of the streamlit method being called element_proto : proto The actual proto in the NewElement type e.g. Alert/Button/Slider add_rows_metadata : AddRowsMetadata or None Metadata for the add_rows method Returns ------- DeltaGenerator Return a DeltaGenerator that can be used to modify the newly-created element. zCalling `st.sidebar` in a function wrapped with `st.fragment` is not supported. To write elements to the sidebar with a fragment, call your fragment function inside a `with st.sidebar` context manager.NFT) delta_typeadd_rows_metadata)r{rr) invoked_dg_id used_dg_idreturned_dg_id layout_config) rrScurrent_fragment_id_writes_directly_to_sidebarrMrqrwrO ForwardMsgrudelta new_elementCopyFromheight height_configr,width width_configr-r}rrmetadata_enqueue_messageget_locked_cursorryr*r+rrQsave_element_messager) rr element_protorrrrvmsg msg_el_protomsg_was_enqueued new_cursor output_dgs rp_enqueuezDeltaGenerator._enqueues2__ " 3**/J2/N'P  !".0'')syy44jA m, ##/ %%33<<%m&:&:;"". %%22;;$]%8%89 !   )bjj.D)+)>)>CLL # #A & S !#  ::) ,,)=N- '!11!I$,OB,?#@I I $$  ''uu$<<'  rrc F|tj}|j}|jd}|j |j |St j}|j j|jjdd|jjj|tj|jg|j j|j j }|t"}t%d||j|||}t't)||_|j j-dt/|t1j2||j4|j4|j4|S)Ntype)r{ parent_pathryr)r)rrr)rNBlockr WhichOneofr}rrOrrrr add_blockrr RunningCursorrindexryrr*r+rrrrQsave_block_messager)r block_protodg_typerrr block_cursorblock_dgs rp_blockzDeltaGenerator._block s`  #//+K__!++F3   %);I'')%'ZZ%:%: " $$[1 ++--C"**00C"**2B2BC  ?$G  !11#%   'r':; $$t$<"" ''uu#;;  rr) r{z int | Noner Cursor | NonerzDeltaGenerator | Nonerz str | NonerNone)rrrr)rztype[BaseException] | NonerzBaseException | NonerzTracebackType | NonerzLiteral[False])rry)rrrzCallable[..., NoReturn])rrrry)rzIterable[DeltaGenerator])rr\)rr\rint)rr)rr])NN) rrrrUrzAddRowsMetadata | NonerzLayoutConfig | Nonerry)rzBlock_pb2.Block | Nonerz type | Nonerry)__name__r __qualname____doc__rPMAINrrrrpropertyrrrrrrrrrrrrrrrrrpryrysfB&3%7%7 $(,!% 36"3636& 36  36  36j >  ' "  !   "??6,, $$ $6  %%-- N$59-1 bbb2 b + b  bL/3#:+::  :rrryctd|jD}tt|j}|xr| S)Nc3VK|]!}|jtjk(#ywr)r}rPr)rrs rprz._writes_directly_to_sidebar..^s!WAQ&&-*?*??Ws'))anyrr]listr)r in_sidebar has_containers rprr]s9WWWJb6678M  +m++rrr)rryrr])r __future__rrmcollections.abcrrcopyrtypingrrr r r r r rrrrrrrrr&streamlit.components.v2.bidi_componentr$streamlit.delta_generator_singletonsrrstreamlit.elements.alertrstreamlit.elements.arrowrstreamlit.elements.balloonsrstreamlit.elements.bokeh_chartrstreamlit.elements.coder%streamlit.elements.deck_gl_json_chartrstreamlit.elements.doc_stringrstreamlit.elements.emptyr streamlit.elements.exceptionr!streamlit.elements.formr"!streamlit.elements.graphviz_chartr#streamlit.elements.headingr$streamlit.elements.htmlr%streamlit.elements.iframer&streamlit.elements.imager'streamlit.elements.jsonr(streamlit.elements.layoutsr)!streamlit.elements.lib.form_utilsr*r+#streamlit.elements.lib.layout_utilsr,r-streamlit.elements.mapr.streamlit.elements.markdownr/streamlit.elements.mediar0streamlit.elements.metricr1streamlit.elements.pdfr2streamlit.elements.plotly_chartr3streamlit.elements.progressr4streamlit.elements.pyplotr5streamlit.elements.snowr6streamlit.elements.spacer7streamlit.elements.textr8streamlit.elements.toastr9streamlit.elements.vega_chartsr:&streamlit.elements.widgets.audio_inputr;!streamlit.elements.widgets.buttonr<'streamlit.elements.widgets.button_groupr='streamlit.elements.widgets.camera_inputr>streamlit.elements.widgets.chatr?#streamlit.elements.widgets.checkboxr@'streamlit.elements.widgets.color_pickerrA&streamlit.elements.widgets.data_editorrB(streamlit.elements.widgets.file_uploaderrC&streamlit.elements.widgets.multiselectrD'streamlit.elements.widgets.number_inputrE streamlit.elements.widgets.radiorF(streamlit.elements.widgets.select_sliderrG$streamlit.elements.widgets.selectboxrH!streamlit.elements.widgets.sliderrI'streamlit.elements.widgets.text_widgetsrJ'streamlit.elements.widgets.time_widgetsrKstreamlit.elements.writerLstreamlit.errorsrMstreamlit.protorNrO!streamlit.proto.RootContainer_pb2rPstreamlit.runtimerQstreamlit.runtime.scriptrunnerrRrrStypesrTgoogle.protobuf.messagerUstreamlit.cursorrV+streamlit.elements.lib.built_in_chart_utilsrWrXrY__annotations__rZrr[r\r^rqrwryrrrrrprOsG" .   F0/55-=3/7-;3-1/-3G,5/1+751-/-/:B9DD5=DBFCD7F?9DD/25;%N=#/'K@.. 9 ( 3I3).-<  oooo o  o  oooooooooo !o"#o$%o&'o()o*+o,-o./o0 1o23o45o67o89o: ;o<=o>?o@AoBCoDEoFGoHIoJKoLMoNOoPQoRSoTUoVWoXYoZ[o\]o^_o`aobcod ,rr