L ih UddlmZddlmZddlmZddlmZmZmZm Z m Z m Z ddl m Z mZddlmZddlmZmZmZmZmZmZmZmZddlmZdd lmZmZdd lm Z m!Z!dd l"m#Z#m$Z$dd l%m&Z&m'Z'm(Z(m)Z)m*Z*dd l+m,Z,m-Z-m.Z.ddl/m0Z1ddl2m3Z3ddl4m5Z5m6Z6ddl7m8Z8m9Z9m:Z:m;Z;mZ>ddlm?Z?ede@eAZBedeeeZCeDeBeEdzeEeBzeEeBeBfzZFdeGd<eDeCeEdzeEeCzeEeCeCfzZHdeGd<eBZIdeGd<e ZJdeGd<e@eAze zZKdeGd<e@eAzezezezZLdeGd<ede@eAeeeZMeMeeMzZNdeGd<eNe@eNeAzeNezeNezeNezZOdeGd <eMeEeMzeEeMeMfzZPdeGd!<ePe@ePeAzePezePezePezZQdeGd"<d#ZRd$eGd%<d&eRzZSd$eGd'<ed(d)d)e j*ZUd$eGd+<e e1jee1jee1jee1jee1jiZ[d$eGd,<e1je1je1jfZ\d$eGd-<d:d.Z]d;d/Z^dd2ZaGd3d4eZbeGd5d6ZcGd7d8Zdy9)?) annotations)Sequence) dataclass)datedatetimetime timedeltatimezonetzinfo)IntegralReal)dedent) TYPE_CHECKINGAnyFinal TypeAlias TypedDictTypeVarcastoverload)current_form_id)JSNumberJSNumberBoundsException) LayoutConfigvalidate_width)check_widget_policiesmaybe_raise_label_warnings)KeyLabelVisibilitycompute_and_register_element_id get_label_visibility_proto_valueto_key)StreamlitAPIExceptionStreamlitValueAboveMaxErrorStreamlitValueBelowMinError)Slider)gather_metrics)ScriptRunContextget_script_run_ctx) WidgetArgsWidgetCallback WidgetKwargsget_session_stateregister_widget)DeltaGenerator)WidthWithoutContentSliderNumericTSliderDatelikeTrSliderNumericSpanTSliderDatelikeSpanT StepNumericT StepDatelikeT SliderStep SliderScalar SliderValueTSliderValueGeneric SliderValueSliderReturnGeneric SliderReturni@BrSECONDS_TO_MICROSiQDAYS_TO_MICROSir UTC_EPOCHSUPPORTED_TYPESTIMELIKE_TYPEScDtjtddd|S)NirA)rcombiner)time_s g/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/elements/widgets/slider.py_time_to_datetimerJ{s    Dq!,e 44c>tj|tSN)rrGr)date_s rI_date_to_datetimerOs   E46 **rKcj|j|jtzz|jtzzSrM) microsecondssecondsr?daysr@)deltas rI_delta_to_microsrUs3  --+ + , **~ % &rKcf|jtj}t|tz SNrB)replacer utcrUrC)dtutc_dts rI_datetime_to_microsr\s( ZZx||Z ,F FY. //rKcLtt|z}|j|S)zFRestore times/datetimes to original timezone (dates are always naive).)rQrB)rCr rX)microsorig_tzr[s rI_micros_to_datetimer`s$ 7 7F >>> ))rKc6eZdZUded<ded<ded<ded<y) SliderDefaultValuesr9 min_value max_valuer8stepstrformatN)__name__ __module__ __qualname____annotations__r3rKrIrbrbs  KrKrbcNeZdZUded<ded<ded<ded<d d Zdd Zdd Zy ) SliderSerde list[float]valueint data_typebool single_value tzinfo | Noner_c*|jtjk(r t|S|jtjk(rt t||j S|jtjk(r-t t||j jS|jtjk(rGt t||j jj|j S|SrW) rq SliderProtoINTrpDATETIMEr`r_DATErTIMErrX)selfros rIdeserialize_single_valuez$SliderSerde.deserialize_single_values >>[__ ,u:  >>[11 1&s5z4<<@ @ >>[-- -&s5z4<<@EEG G >>[-- -#CJ = -   rKc||}n |j}|Dcgc]}|j|}}|jr|dSt|Scc}w)Nr)ror|rstuple)r{ui_valuevalvdeserialized_valuess rI deserializezSliderSerde.deserializese  C**CJMMAt<>[-- -GV@C#$5c$:;  >>[-- -GV@C#$5c$:;  >>[11 18GH',H H&56sc 66I6sC4C9C>DN)rorreturnr9)rzlist[float] | Nonerr)rrrz list[Any])rhrirjrkr|rrr3rKrIrmrms( N    7rKrmceZdZe ddddd ddZe ddddd ddZe dddddddddddd dd Ze ddddd dd Ze ddddd dd Ze ddddddddddddd d d Ze dddddddddddd d!dZe dddddddddddd d"dZe ddddd d#dZed ddddd d$dZ dddddd d%dZed&dZy)' SliderMixinNFvisiblestretch)disabledlabel_visibilitywidthc yrMr3r{labelrcrdrorergkeyhelp on_changeargskwargsrrrs rIsliderzSliderMixin.sliders$rKc yrMr3rs rIrzSliderMixin.sliders$rK) rergrrrrrrrrc yrMr3rs rIrzSliderMixin.slider $14rKc yrMr3rs rIrzSliderMixin.slider"rrKc yrMr3rs rIrzSliderMixin.slider8$rK) rorergrrrrrrrrc yrMr3rs rIrzSliderMixin.sliderNrrKc yrMr3rs rIrzSliderMixin.slidercrrKc yrMr3rs rIrzSliderMixin.sliderys(36rKc yrMr3rs rIrzSliderMixin.sliders&36rKrc Vt}|j||||||||| | | | | ||S)a$Display a slider widget. This supports int, float, date, time, and datetime types. This also allows you to render a range slider by passing a two-element tuple or list as the ``value``. The difference between ``st.slider`` and ``st.select_slider`` is that ``slider`` only accepts numerical or date/time data and takes a range as input, while ``select_slider`` accepts any datatype and takes an iterable set of options. .. note:: Integer values exceeding +/- ``(1<<53) - 1`` cannot be accurately stored or returned by the widget due to serialization constraints between the Python server and JavaScript client. You must handle such numbers as floats, leading to a loss in precision. Parameters ---------- label : str A short label explaining to the user what this slider is for. The label can optionally contain GitHub-flavored Markdown of the following types: Bold, Italics, Strikethroughs, Inline Code, Links, and Images. Images display like icons, with a max height equal to the font height. Unsupported Markdown elements are unwrapped so only their children (text contents) render. Display unsupported elements as literal characters by backslash-escaping them. E.g., ``"1\. Not an ordered list"``. See the ``body`` parameter of |st.markdown|_ for additional, supported Markdown directives. For accessibility reasons, you should never set an empty label, but you can hide it with ``label_visibility`` if needed. In the future, we may disallow empty labels by raising an exception. .. |st.markdown| replace:: ``st.markdown`` .. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown min_value : a supported type or None The minimum permitted value. If this is ``None`` (default), the minimum value depends on the type as follows: - integer: ``0`` - float: ``0.0`` - date or datetime: ``value - timedelta(days=14)`` - time: ``time.min`` max_value : a supported type or None The maximum permitted value. If this is ``None`` (default), the maximum value depends on the type as follows: - integer: ``100`` - float: ``1.0`` - date or datetime: ``value + timedelta(days=14)`` - time: ``time.max`` value : a supported type or a tuple/list of supported types or None The value of the slider when it first renders. If a tuple/list of two values is passed here, then a range slider with those lower and upper bounds is rendered. For example, if set to `(1, 10)` the slider will have a selectable range between 1 and 10. This defaults to ``min_value``. If the type is not otherwise specified in any of the numeric parameters, the widget will have an integer value. step : int, float, timedelta, or None The stepping interval. Defaults to 1 if the value is an int, 0.01 if a float, timedelta(days=1) if a date/datetime, timedelta(minutes=15) if a time (or if max_value - min_value < 1 day) format : str or None A printf-style format string controlling how the interface should display numbers. This does not impact the return value. For information about formatting integers and floats, see `sprintf.js `_. For example, ``format="%0.1f"`` adjusts the displayed decimal precision to only show one digit after the decimal. For information about formatting datetimes, dates, and times, see `momentJS `_. For example, ``format="ddd ha"`` adjusts the displayed datetime to show the day of the week and the hour ("Tue 8pm"). key : str or int An optional string or integer to use as the unique key for the widget. If this is omitted, a key will be generated for the widget based on its content. No two widgets may have the same key. help : str or None A tooltip that gets displayed next to the widget label. Streamlit only displays the tooltip when ``label_visibility="visible"``. If this is ``None`` (default), no tooltip is displayed. The tooltip can optionally contain GitHub-flavored Markdown, including the Markdown directives described in the ``body`` parameter of ``st.markdown``. on_change : callable An optional callback invoked when this slider's value changes. args : list or tuple An optional list or tuple of args to pass to the callback. kwargs : dict An optional dict of kwargs to pass to the callback. disabled : bool An optional boolean that disables the slider if set to ``True``. The default is ``False``. label_visibility : "visible", "hidden", or "collapsed" The visibility of the label. The default is ``"visible"``. If this is ``"hidden"``, Streamlit displays an empty spacer instead of the label, which can help keep the widget aligned with other widgets. If this is ``"collapsed"``, Streamlit displays no label or spacer. width : "stretch" or int The width of the slider widget. This can be one of the following: - ``"stretch"`` (default): The width of the widget matches the width of the parent container. - An integer specifying the width in pixels: The widget has a fixed width. If the specified width is greater than the width of the parent container, the width of the widget matches the width of the parent container. Returns ------- int/float/date/time/datetime or tuple of int/float/date/time/datetime The current value of the slider widget. The return type will match the data type of the value parameter. Examples -------- >>> import streamlit as st >>> >>> age = st.slider("How old are you?", 0, 130, 25) >>> st.write("I'm ", age, "years old") And here's an example of a range slider: >>> import streamlit as st >>> >>> values = st.slider("Select a range of values", 0.0, 100.0, (25.0, 75.0)) >>> st.write("Values:", values) This is a range time slider: >>> import streamlit as st >>> from datetime import time >>> >>> appointment = st.slider( ... "Schedule your appointment:", value=(time(11, 30), time(12, 45)) ... ) >>> st.write("You're scheduled for:", appointment) Finally, a datetime slider: >>> import streamlit as st >>> from datetime import datetime >>> >>> start_time = st.slider( ... "When do you start?", ... value=datetime(2020, 1, 1, 9, 30), ... format="MM/DD/YY - hh:mm", ... ) >>> st.write("Start time:", start_time) .. output:: https://doc-slider.streamlit.app/ height: 300px )rrcrdrorergrrrrrrrrctx)r)_slider)r{rrcrdrorergrrrrrrrrrs rIrzSliderMixin.slidersPT!"||-  rK)rrrrc 0t|}t|j|| |t|| t d|hd|j|||||||| }|ad}t j }|0||vr,||}t|ttj}|r||nd}n||nd}||nd}||g}t|ttj}t|ttfxr t|dv}|s |s td |r|gn|}d?d 0d@0fd }||s%td ttt|t|dk(rt j"n 0|d}t$j&}t$j(}|t j*k(rft-d |}t$j&j/|dj0}t$j(j/|dj0}|t j2t j4fvr0t-d|}|dt7dz }|dt7dz}t j"dddddt j8dddddt j2||t7dddt j4||t7dddt j*||t7dddi}|||d}|||d}|H||d}|t j2t j4fvr||z t7dkr t7d}|t-d ||d!}|dk(r td"|||g}t;d#|D}t;d$|D}|t<vxr(t|t6xrt|t|u} |sT|sR| sPd%t|j>d&t|j>d't|j>d(}!t|!|t j"k(xr|}"|t j8k(xr|}#|t<vxr| }$|"sT|#sR|$sPd)t|j>d*t|j>d&t|j>d(}!t|!t'||}t)||}t|dk(rt'|d|}t)|d|}n=t|d+k(r+|\}%}&|%|&kDr|&|%}&}%|%|&f}t'|%|}t)|&|}n||g} |"r-tAjB|d,tAjB|d-n2|#r-tAjD|d,tAjD|d-n|$r d}(|t j*k(rSt-d |}t-d.|}t-d.|}tttJ|}tK|}tK|}|t j4k(rSt-d/|}t-d0|}t-d0|}tttL|}tM|}tM|}||k(rtd1|d2|d3|t<vrt-d|}t-d4|}t-d4|}t-d5|}|t j*t j2fvr|dj0nd}(tttN|}tO|}tO|}tQ|}t-d6|}t!})t jRjT|)_||)_+||)_,||)_-||)j\dd||)_||)_t-d7||)_/||)_0g|)jbddte|j|)_3| |)_4tk| |)jl_7|tq||)_9tu||||(}*tw|)jV| | | |*jx|*jz|d89}+|+j|r|*j{|+jn},|,D]}}-|*j|-}.|-|)j&kr&t|.|*j|)j&:|-|)j(kDsYt|.|*j|)j(;|,|)jnddd|)_Bt|t|<}/|jjd|)|/=t-d>|+jnS#tF$r}'ttI|'d}'~'wwxYw)AN) default_valuer>rerdrc) user_keykey_as_main_identitydgrrcrdrorergrrTrd)rrAzcSlider value should either be an int/float/datetime or a list/tuple of 0 to 2 ints/floats/datetimesct|tr ttSt|tr ttStt |SrM)rr rDr type)rs rIvalue_to_generic_typez2SliderMixin._slider..value_to_generic_types;!X&&x00!T"&t,,"47+ +rKcFttt|dkS)Nr)lensetmap)itemsrs rI all_same_typez*SliderMixin._slider..all_same_types s34e<=>B BrKzASlider tuple/list components must be of the same type. But were: zSequence[time]rBzSequence[datetime])rSrAz%d)rcrdrerggg?g{Gz?z%0.2fz YYYY-MM-DD)minuteszHH:mmrcrdrerfrgz1Slider components cannot be passed a `step` of 0.c3<K|]}t|tywrM)rr .0as rI z&SliderMixin._slider..-sD1z!X.Dsc3bK|]'}t|txrt|t )ywrM)rr r rs rIrz&SliderMixin._slider...s. DEJq$  ? 1h(?$? ? s-/zBSlider value arguments must be of matching types. `min_value` has z type. `max_value` has z type. `step` has z type.z?Both value and arguments must be of the same type. `value` has z type. `min_value` has rz `min_value`z `max_value`rzSequence[date]rzFSlider `min_value` must be less than the `max_value`. The values were z and .rr rnrdouble_array_value)on_change_handlerrr deserializer serializerr value_type)rorc)rord)r) layout_configr>)rrrzSliderProto.DataType.ValueType)rrrrr)Fr"rrrr r-filtered_staterr~rDkeysrrr#rrrvrwrminmaxrzrrXr rxryr FLOATallrErhrvalidate_int_boundsvalidate_float_boundsrrfrJrOr\rUTypeSLIDERidrrgdefaultrerqoptionsrform_idrr!rrorrrmr.rr value_changedr|r%r$ set_valuerr_enqueue)1r{rrcrdrorergrrrrrrrrr element_idrs session_state state_valuemnmxrprepared_valuerrq datetime_min datetime_maxdefaults slider_argsint_args float_args timelike_argsmsgall_ints all_floats all_timelikesstartender_ slider_protoserde widget_stateserialized_valuesserialized_valuedeserialized_valuerrs1 @rIrzSliderMixin._sliders &Sk GG    #5*:;4 "Dww $ =  L-/>>M3-#7+C0 )+u_=Q=Q=S7TU %.%: "+"7YQ"+"7YSR"%/C/C/E)FG  u 6R3u:;R K'/  =I%e , C^,'!#dN";<=? >"a' OO&~a'89  )- (,  (( (!"2NCN88++>!3D3K3K+LL88++>!3D3K3K+LL --{/?/?@ @!"6GN)!,yb/AAL)!,yb/AAL OO       !    ))!q)& #   ))!q)&    ))!"-! 3Q B   +K8I   +K8I <I&v.D$$  i')*;; , >%)!4X!>?F 19'C  !)T2 D DD IT   ' 34+ 3Y4 ?2   =%%))_%=%=$>?%%))_%=%=$>? $T 3 34F<  (, , /?%%))_%=%=$>fF  (, , 9-  9- ~ ! #N1-y9IN1-y9I  A %'JE3s{ %s!&E9-IC+I(3N 0,,Y F,,Y F..y-H..y-H  (( (!"2NCNVY/IVY/I!#&7"HIN))4I))4I  (( (!"2NCNVY/IVY/I!#&7"HIN))4I))4I  !'%%.KuYKqB   &!"6GNZ3IZ3I T*D !1!1;3G3G HHq!((  "#&9>"JKN+I6I+I6I#D)Dm^<#} ',,33 $ " $ "0 Q$ $  $/ !* "$ Q.tww7  ( .N / %%+   &t L       ' OO'**+    % % % 0B0B C $5  %*%C%CDT%U"#l&6&6650"'"@"@AQAQ"R$l&6&6650"'"@"@AQAQ"R %6L  q !%)L "u$51  <}MNL$6$677s' 0'A/ / 0s4A!e e% e  e%ctd|S)zGet our DeltaGenerator.r/)r)r{s rIrzSliderMixin.dgs$d++rK) NNNNNNNNNN)rrfrcNonerdrrorrez int | Nonerg str | Noner Key | NonerrrWidgetCallback | NonerWidgetArgs | NonerWidgetKwargs | Nonerrrrrrr0rrp)rrfrcSliderNumericT | Nonerdrrorre#StepNumericT[SliderNumericT] | Nonergrrrrrrrrrrrrrrrrrr0rr1)NN)rrfrcrrdrro"SliderNumericSpanT[SliderNumericT]rerrgrrrrrrrrrrrrrrrrrr0r%tuple[SliderNumericT, SliderNumericT])NNNNNNN)rrfrcr1rdr1rorrerrgrrrrrrrrrrrrrrrrrr0rr) NNNNNNNNN)rrfrcr2rdSliderDatelikeT | NonerorreStepDatelikeT | Nonergrrrrrrrrrrrrrrrrrr0rr2rM)rrfrcrrdr2rorrerrgrrrrrrrrrrrrrrrrrr0rr2)rrfrcrrdrror2rerrgrrrrrrrrrrrrrrrrrr0rr2)rrfrcrrdrrozXlist[SliderDatelikeT] | tuple[SliderDatelikeT] | tuple[SliderDatelikeT, SliderDatelikeT]rerrgrrrrrrrrrrrrrrrrrr0r'tuple[SliderDatelikeT, SliderDatelikeT])rerrgrrrrrrrrrrrrrfrcr2rdr2roz$SliderDatelikeSpanT[SliderDatelikeT]rrrrrrr0rr)rrfrcSliderScalar | NonerdrrozSliderValue | NonerezSliderStep | Nonergrrrrrrrrrrrrrrrrrr0rr) rrfrcrrdrrorrerrgrrrrrrrrrrrrrrrrrr0rzScriptRunContext | Nonerr>)rr/) rhrirjrrr'rpropertyrr3rKrIrrsf !+/"&&*,5%.!     ) $* #!" #*,0+/'+48!+/"&&*,5%.!))  %  2 ) $* #!" #*,0+/ 459!+/"&&*,5%.!44)4) 4 2 424444)4 4$44*4 #!4" /#44*59!+/"&&*4,5%.!44"4" 4 2 4 2 4444)4 4$44*4 #!4" /#44* -1(,%)!+/"&&*,5%.!#*  &  # ) $* #!" #* )-%)!+/"&&*,5%.! #  & #) $* #!" #( &*!+/"&&*,5%.!   #) $* #!" #*-1,0 6&*!+/"&&*,5%.%66*6* 6 2 6#6666)6 6$6 !6"*#6$#%6& 1'66.&*!+/"&&*6,5%.#6#6666)6 6$66#6# 6 4 66 *!6"##6$ 1%66*H*.)-$("&!+/"&&*Z ,5%.!Z Z 'Z ' Z " Z  Z Z Z Z )Z  Z $Z Z *Z #!Z " #Z Z ~!+/"&&*d8,5%.'+#d8d8d8 d8  d8  d8d8d8d8)d8 d8$d8d8*d8 #!d8"%#d8$ %d8L ,,rKrN)rHrrr)rNrrr)rTr rrp)rZrrrp)r^rpr_rtrr)e __future__rcollections.abcr dataclassesrrrrr r r numbersr r textwraprtypingrrrrrrrr!streamlit.elements.lib.form_utilsr streamlit.elements.lib.js_numberrr#streamlit.elements.lib.layout_utilsrrstreamlit.elements.lib.policiesrrstreamlit.elements.lib.utilsrrr r!r"streamlit.errorsr#r$r%streamlit.proto.Slider_pb2r&rvstreamlit.runtime.metrics_utilr'streamlit.runtime.scriptrunnerr(r)streamlit.runtime.stater*r+r,r-r.streamlit.delta_generatorr/r0rprr1r2rr~r4rkr5r6r7r8r9r:r;r<r=r>r?r@rYrCrwrrxryrzrDrErJrOrUr\r`rbrmrr3rKrIrs3#$!FF"   >NL =9O8G)36+T4B  Bi N NN *+,I  Bi O O_ ,-.Y) i($ y$e i/ I/+,t3h> i>~sE4xH ,x /E EIEs " # Y5&&|\/I)JJY% !$ $ (# $ i'5&$'888D!Qx||< 5< koo+   k""+  +   %--{/?/?AQAQRR5+0*) 2727 27jP ,P ,rK