L iWddlmZddlZddlmZmZmZddlmZerddl m Z ddl m Z m Z GddeZGd d eZGd d eZGd deZGddeeZGddeZGddeZGddeZGddeZGddeZGddeZGddeZGdd eZGd!d"eZGd#d$eZGd%d&eZGd'd(ee Z!Gd)d*e!Z"Gd+d,eZ#Gd-d.e#Z$Gd/d0e#Z%Gd1d2e#Z&Gd3d4e#Z'Gd5d6e#Z(Gd7d8e#Z)Gd9d:e#Z*Gd;de#Z,Gd?d@e#Z-GdAdBe#Z.GdCdDe#Z/GdEdFe#Z0GdGdHe#Z1GdIdJe#Z2GdKdLe#Z3GdMdNe#Z4GdOdPe#Z5GdQdRe#Z6GdSdTe#Z7GdUdVe#Z8GdWdXe#Z9GdYdZe#Z:Gd[d\e#Z;Gd]d^e#Z<Gd_d`e#Z=Gdadbe#e>Z?Gdcdde#Z@Gdedfe#ZAGdgdhe#ZBGdidje#ZCGdkdle#ZDGdmdne#ZEGdodpe#ZFy)q) annotationsN) TYPE_CHECKINGAnyLiteral)util) Collection)datetimeceZdZdZy)ErrorzThe base class for all exceptions thrown by Streamlit. Should be used for exceptions raised due to user errors (typically via StreamlitAPIException) as well as exceptions raised by Streamlit's internal code. N__name__ __module__ __qualname____doc__V/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/errors.pyr r   rr ceZdZdZy)CustomComponentErrorz5Exceptions thrown in the custom components code path.Nr rrrrr&s?rrceZdZdZy)StreamlitComponentRegistryErrorzExceptions raised while discovering or registering Streamlit components. These errors occur during Streamlit startup when scanning installed distributions for component metadata and registering them with the component registry. Nr rrrrr,rrrc eZdZy)DeprecationErrorNrrrrrrrr7rrceZdZdZy)FragmentStorageKeyErrorz]A KeyError raised when a KeyError is encountered during a FragmentStorage operation. Nr rrrrr;  rrceZdZdZy)FragmentHandledExceptionz^An exception that is raised by the fragment when it has handled the exception itself. Nr rrrr"r"Cr rr"c eZdZy) NoStaticFilesNrrrrr$r$Krrr$c eZdZy)NoSessionContextNrrrrr&r&Orrr&ceZdZdZy)MarkdownFormattedExceptionzExceptions with Markdown in their description. Instances of this class can use markdown in their messages, which will get nicely formatted on the frontend. Nr rrrr(r(Ss   rr(ceZdZdZy)StreamlitMaxRetriesErrorzTAn exception raised when a file or folder cannot be accessed after multiple retries.Nr rrrr*r*]s^rr*ceZdZdZddZy)StreamlitAPIExceptionaBase class for Streamlit API exceptions. An API exception should be thrown when user code interacts with the Streamlit API incorrectly. (That is, when we throw an exception as a result of a user's malformed `st.foo` call, it should be a StreamlitAPIException or subclass.) When displaying these exceptions on the frontend, we strip Streamlit entries from the stack trace so that the user doesn't see a bunch of noise related to Streamlit internals. c,tj|SNrrepr_selfs r__repr__zStreamlitAPIException.__repr__qzz$rNreturnstr)rrrrr3rrrr,r,cs   rr,c eZdZy)DuplicateWidgetIDNrrrrr9r9urrr9c eZdZy)StreamlitAuthErrorNrrrrr;r;yrrr;c$eZdZdZdfd ZxZS)StreamlitDuplicateElementIdzKAn exception raised when the auto-generated ID of an element is not unique.c2t|d|d|dy)NzThere are multiple `a&` elements with the same auto-generated ID. When this element is created, it is assigned an internal ID based on the element type and provided parameters. Multiple elements with the same type and parameters will cause this error. To fix this error, please pass a unique `key` argument to the `z ` element.super__init__)r2 element_type __class__s rrAz$StreamlitDuplicateElementId.__init__s* "<.1 ~Z  ) r)rBr7r6NonerrrrrA __classcell__rCs@rr=r=}sU  rr=c$eZdZdZdfd ZxZS)StreamlitDuplicateElementKeyz=An exception raised when the key of an element is not unique.c,t|d|dy)Nz0There are multiple elements with the same `key='z`'`. To fix this, please make sure that the `key` argument is unique for each element you create.r?)r2user_keyrCs rrAz%StreamlitDuplicateElementKey.__init__s" >xjI' ' r)rKr7r6rDrErGs@rrIrIsG  rrIc eZdZy)UnserializableSessionStateErrorNrrrrrMrMrrrMc,eZdZdZdfd ZddZxZS)StreamlitAPIWarningzsUsed to display a warning. Note that this should not be "raised", but passed to st.exception instead. czt||ddl}ddl}|j }|j ||_y)Nr)r@rAinspect traceback currentframe extract_stacktacked_on_stack)r2argsrQrRfrCs rrAzStreamlitAPIWarning.__init__s7 $  "(66q9rc,tj|Sr.r/r1s rr3zStreamlitAPIWarning.__repr__r4r)rVrr6rDr5)rrrrrAr3rFrGs@rrOrOs : rrOc$eZdZdZdfd ZxZS)StreamlitModuleNotFoundErrorzxPrint a pretty message when a Streamlit command requires a dependency that is not one of our core dependencies. c2d|d}t||g|y)Nz(This Streamlit command requires module "z" to be installed.r?)r2 module_namerVmessagerCs rrAz%StreamlitModuleNotFoundError.__init__s)6{mCU V  (4(r)r\r7rVrr6rDrErGs@rrZrZs))rrZc2eZdZdfd ZeddZxZS)LocalizableStreamlitExceptionc Rt||jdi|||_y)Nr)r@rAformat _exec_kwargs)r2r]kwargsrCs rrAz&LocalizableStreamlitException.__init__s) )'))3F34"rc|jSr.)rbr1s r exec_kwargsz)LocalizableStreamlitException.exec_kwargss   r)r]r7rcrr6rD)r6zdict[str, Any])rrrrApropertyrerFrGs@rr_r_s#!!rr_c$eZdZdZdfd ZxZS)StreamlitInvalidPageLayoutErrorz?Exception raised when an invalid value is specified for layout.c(t|d|y)Nz<`layout` must be `"centered"` or `"wide"` (got `"{layout}"`))layoutr?)r2rjrCs rrAz(StreamlitInvalidPageLayoutError.__init__s  J  r)rjr7r6rDrErGs@rrhrhsI  rrhc$eZdZdZdfd ZxZS)!StreamlitInvalidSidebarStateErrorzPException raised when an invalid value is specified for `initial_sidebar_state`.c(t|d|y)Nzk`initial_sidebar_state` must be `"auto"` or `"expanded"` or `"collapsed"` (got `"{initial_sidebar_state}"`))initial_sidebar_stater?)r2rnrCs rrAz*StreamlitInvalidSidebarStateError.__init__s  >"7  r)rnr7r6rDrErGs@rrlrlsZ  rrlc$eZdZdZdfd ZxZS) StreamlitInvalidMenuItemKeyErrorz2Exception raised when an invalid key is specified.c(t|d|y)NzfWe only accept the keys: `"Get help"`, `"Report a bug"`, and `"About"` (`"{key}"` is not a valid key.)keyr?r2rsrCs rrAz)StreamlitInvalidMenuItemKeyError.__init__s  t  rrsr7r6rDrErGs@rrprps<  rrpc$eZdZdZdfd ZxZS)StreamlitInvalidURLErrorucException raised when an invalid URL is specified for any of the menu items except for “About”.c(t|d|y)Nzw"{url}" is a not a valid URL. You must use a fully qualified domain beginning with "http://", "https://", or "mailto:".)urlr?)r2ryrCs rrAz!StreamlitInvalidURLError.__init__s  h  r)ryr7r6rDrErGs@rrwrwsm  rrwc$eZdZdZdfd ZxZS)StreamlitInvalidColumnSpecErrorzRException raised when no weights are specified, or a negative weight is specified.c$t|dy)NaThe `spec` argument to `st.columns` must be either a positive integer (number of columns) or a list of positive numbers (width ratios of the columns). See [documentation](https://docs.streamlit.io/develop/api-reference/layout/st.columns) for more information.r?r2rCs rrAz(StreamlitInvalidColumnSpecError.__init__s  $ rr6rDrErGs@rr{r{s\  rr{c$eZdZdZdfd ZxZS)&StreamlitInvalidVerticalAlignmentErrorzKException raised when an invalid value is specified for vertical_alignment.c*t|d||y)NzThe `vertical_alignment` argument to `{element_type}` must be `"top"`, `"center"`, `"bottom"`, or `"distribute"`. The argument passed was {vertical_alignment}.)vertical_alignmentrBr?)r2rrBrCs rrAz/StreamlitInvalidVerticalAlignmentError.__init__s"  < 2%  r)rr7rBr7r6rDrErGs@rrrsU  rrc$eZdZdZdfd ZxZS)StreamlitInvalidColumnGapErrorz"6%  r)rr7rBr7r6rDrErGs@rrrsW  rrc0eZdZdZ dfd ZxZS)&StreamlitSelectionCountExceedsMaxErrorzdException raised when there are more default selections specified than the max allowable selections.cVt|d||dk(rdnd||dk(rdydy)NaMultiselect has {current_selections_count} {current_selections_noun} selected but `max_selections` is set to {max_selections_count}. This happened because you either gave too many options to `default` or you manipulated the widget's state through `st.session_state`. Note that the latter can happen before the line indicated in the traceback. Please select at most {max_selections_count} {options_noun}.optionoptions)current_selections_countcurrent_selections_nounmax_selections_count options_nounr?)r2rrrCs rrAz/StreamlitSelectionCountExceedsMaxError.__init__$sP  K &>'1,%-!5%9Q%>  EN  r)rintrrr6rDrErGs@rrr!s(n (+ CF   rrc8eZdZdZ dfd ZxZS)StreamlitMixedNumericTypesErrorz;Exception raised mixing floats and ints in st.number_input.c"d}d}d}d}d} |rt|j}| dz } |rt|j}| dz } |rt|j}| dz } |rt|j}| dz } t | | ||||y)Nz1All numerical arguments must be of the same type.z `value` has {value_type} type.z' `min_value` has {min_value_type} type.z' `max_value` has {max_value_type} type.z `step` has {step_type} type.) value_typemin_value_typemax_value_type step_type)typerr@rA) r2value min_value max_valuesteprrrr error_messagerCs rrAz(StreamlitMixedNumericTypesError.__init__;s  K e--J ? ?M !)_55N G GM !)_55N G GM T ++I = =M  !))  r) rz#int | float | Literal['min'] | Nonerint | float | Nonerrrrr6rDrErGs@rrr8s@E$ 2$ &$ & $ ! $  $ $ rrc0eZdZdZ dfd ZxZS)StreamlitValueBelowMinErrorzBException raised when the `min_value` is greater than the `value`.c*t|d||y)Nz=The `value` {value} is less than the `min_value` {min_value}.)rrr?)r2rrrCs rrAz$StreamlitValueBelowMinError.__init__es  K  r)rint | float | date | timerrr6rDrErGs@rrrbs,L  (  -      rrc0eZdZdZ dfd ZxZS)StreamlitValueAboveMaxErrorz?Exception raised when the `max_value` is less than the `value`.c*t|d||y)Nz@The `value` {value} is greater than the `max_value` {max_value}.)rrr?)r2rrrCs rrAz$StreamlitValueAboveMaxError.__init__ts  N  r)rrrrr6rDrErGs@rrrqs,I  (  -      rrc$eZdZdZdfd ZxZS)StreamlitJSNumberBoundsErrorz=Exception raised when a number exceeds the Javascript limits.c$t||yr.r?r2r]rCs rrAz%StreamlitJSNumberBoundsError.__init__ !rr]r7r6rDrErGs@rrrsG""rrc$eZdZdZdfd ZxZS)!StreamlitInvalidNumberFormatErrorzcException raised when the format string for `st.number_input` contains invalid characters. c(t|d|y)NzIFormat string for `st.number_input` contains invalid characters: {format})rar?)r2rarCs rrAz*StreamlitInvalidNumberFormatError.__init__s  W  r)rar7r6rDrErGs@rrr  rrc$eZdZdZdfd ZxZS)StreamlitMissingPageLabelErrorz=Exception raised when a page_link is created without a label.c$t|dy)NzeThe `label` param is required for external links used with `st.page_link` - please provide a `label`.r?r}s rrAz'StreamlitMissingPageLabelError.__init__s  s rr~rErGs@rrrsG  rrc4eZdZdZ dfd ZxZS)StreamlitPageNotFoundErrorz2Exception raised the linked page can not be found.cttjj|}d}|rd}t||||y)NzCould not find page: `{page}`. You must provide a `StreamlitPage` object or file path relative to the entrypoint file. Only pages previously defined by `st.Page` and passed to `st.navigation` are allowed.zCould not find page: `{page}`. You must provide a file path relative to the entrypoint file (from the directory `{directory}`). Only the entrypoint file and files in the `pages/` directory are supported.)page directory)ospathbasenamer@rA)r2rmain_script_directoryuses_pages_directoryrr]rCs rrAz#StreamlitPageNotFoundError.__init__sQGG$$%:;    ^     r)rr7rr7rboolr6rDrErGs@rrrs0<  03 KO   rrc$eZdZdZdfd ZxZS)BidiComponentInvalidIdErrorz:Exception raised when an invalid ID component is provided.c*t|d||y)NzeThe `{part}` of a bidirectional component's ID must not contain the delimiter sequence `{delimiter}`.)part delimiterr?)r2rrrCs rrAz$BidiComponentInvalidIdError.__init__s   4  r)rr7rr7r6rDrErGs@rrrsD  rrc$eZdZdZdfd ZxZS) BidiComponentMissingContentErrorz>Exception raised when a component is missing required content.c(t|d|y)NzComponent `{component_name}` must have either JavaScript content (`js_content` or `js_url`) or HTML content (`html_content`), or both. Please ensure the component definition includes at least one of these.)component_namer?)r2rrCs rrAz)BidiComponentMissingContentError.__init__s   U*  r)rr7r6rDrErGs@rrrsH  rrc$eZdZdZdfd ZxZS)%BidiComponentInvalidCallbackNameErrorzBException raised when a callback with an invalid name is provided.c(t|d|y)NzThe callback name `'{callback_name}'` is not allowed. Callback names must follow the pattern `on_{{event_name}}_change` where `event_name` is not empty.) callback_namer?)r2rrCs rrAz.BidiComponentInvalidCallbackNameError.__init__s  /(  r)rr7r6rDrErGs@rrrsL  rrc$eZdZdZdfd ZxZS)#BidiComponentInvalidDefaultKeyErrorzEException raised when an invalid key is provided in the default dict.c2t|d||xsdy)NzKey `'{state_key}'` in `default` is not a valid state name. Valid state names are those with corresponding `on_{{state_name}}_change` callbacks. Available state names: `{available_keys}`none) state_keyavailable_keysr?)r2rrrCs rrAz,BidiComponentInvalidDefaultKeyError.__init__s(  C )3V  r)rr7r list[str]r6rDrErGs@rrrsO  rrc$eZdZdZdfd ZxZS)$BidiComponentUnserializableDataErrorzVException raised when data provided to a bidirectional component cannot be serialized.c$t|dy)NzThe `data` provided to the bidirectional component could not be serialized. Please ensure the data is JSON-serializable, or is a supported data structure like a pandas DataFrame.r?r}s rrAz-BidiComponentUnserializableDataError.__init__s  ' rr~rErGs@rrrs`  rrc$eZdZdZdfd ZxZS).StreamlitFragmentWidgetsNotAllowedOutsideErrorz\Exception raised when the fragment attempts to write to an element outside of its container.c$t|dy)Nz5Fragments cannot write widgets to outside containers.r?r}s rrAz7StreamlitFragmentWidgetsNotAllowedOutsideError.__init__s PQrr~rErGs@rrrsfRRrrc$eZdZdZdfd ZxZS)!StreamlitInvalidFormCallbackErrorzxException raised a `on_change` callback is set on any element in a form except for the `st.form_submit_button`. c$t|dy)NzWithin a form, callbacks can only be defined on `st.form_submit_button`. Defining callbacks on other widgets inside a form is not allowed.r?r}s rrAz*StreamlitInvalidFormCallbackError.__init__s  P rr~rErGs@rrrrrrc$eZdZdZdfd ZxZS)'StreamlitValueAssignmentNotAllowedErrorzHException raised when trying to set values where writes are not allowed.c(t|d|y)NzPValues for the widget with `key` '{key}' cannot be set using `st.session_state`.rrr?rts rrAz0StreamlitValueAssignmentNotAllowedError.__init__s  ^  rrurErGs@rrr sR  rrc(eZdZ dfd ZxZS)StreamlitInvalidColorErrorc:t|dt|y)NzThis does not look like a valid color: {color}. Colors must be in one of the following formats:* Hex string with 3, 4, 6, or 8 digits. Example: `'#00ff00'`* List or tuple with 3 or 4 components. Example: `[1.0, 0.5, 0, 0.2]`)colorr@rArepr)r2rrCs rrAz#StreamlitInvalidColorError.__init__s&  Tu+  r)rz1str | Collection[Any] | tuple[int, int, int, int]r6rD)rrrrArFrGs@rrrs  F     rrc$eZdZdZdfd ZxZS)StreamlitBadTimeStringErrorzMException Raised when a time string argument is passed that cannot be parsed.c(t|d|y)NzqTime string doesn't look right. It should be formatted as`'1d2h34m'` or `2 days`, for example. Got: {time_string}) time_stringr?)r2rrCs rrAz$StreamlitBadTimeStringError.__init__%s  G#  r)rr7r6rDrErGs@rrr"sW  rrc$eZdZdZdfd ZxZS)StreamlitSecretNotFoundErrorzRException raised when a secret cannot be found or parsed in the secrets.toml file.c$t||yr.r?rs rrAz%StreamlitSecretNotFoundError.__init__0rrrrErGs@rrr-s\""rrc&eZdZdZddfd ZxZS)StreamlitInvalidWidthErrorz9Exception raised when an invalid width value is provided.cHd}|rd}t|dt||y)N an integer (pixels) or 'stretch',an integer (pixels), 'stretch', or 'content'zBInvalid width value: {width}. Width must be either {valid_values}.)width valid_valuesr)r2r allow_contentrrCs rrAz#StreamlitInvalidWidthError.__init__7s/9 IL  Pu+%  rF)rrrrr6rDrErGs@rrr4sC   rrc&eZdZdZddfd ZxZS)StreamlitInvalidHeightErrorz:Exception raised when an invalid height value is provided.cHd}|rd}t|dt||y)NrrzEInvalid height value: {height}. Height must be either {valid_values}.)heightrr)r2rrrrCs rrAz$StreamlitInvalidHeightError.__init__Fs/9 IL  S<%  rr)rrrrr6rDrErGs@rrrCsD   rrc$eZdZdZdfd ZxZS)StreamlitInvalidSizeErrorz8Exception raised when an invalid size value is provided.c:t|dt|y)NznInvalid size value: {size}. Size must be either an integer (pixels), 'stretch', 'small', 'medium', or 'large'.)sizer)r2rrCs rrAz"StreamlitInvalidSizeError.__init__Us!  8d  r)rrr6rDrErGs@rrrRsB  rrc$eZdZdZdfd ZxZS)StreamlitValueErrorz;Exception raised when a value is not valid for a parameter.cHt|d|dj|y)Nz>Invalid `{parameter}` value. Supported values: {valid_values}.z, ) parameterr)r@rAjoin)r2rrrCs rrAzStreamlitValueError.__init__`s'  L<0  r)rr7rrr6rDrErGs@rrr]sE  rrc$eZdZdZdfd ZxZS)StreamlitInvalidThemeErrorz*Exception raised for general theme errors.c$t||yr.r?rs rrAz#StreamlitInvalidThemeError.__init__l   rrrErGs@rrris4  rrc$eZdZdZdfd ZxZS) StreamlitInvalidThemeOptionErrorzAException raised when an invalid theme config option is provided.c$t||yr.r?rs rrAz)StreamlitInvalidThemeOptionError.__init__ur rrrErGs@rr r rsK  rr c&eZdZdZddfd ZxZS)!StreamlitInvalidThemeSectionErrorz;Exception raised when an invalid theme section is provided.c*t|d||y)NzInvalid theme section: `{option_name}` found in {file_path_or_url}. Valid sections are: `theme`, `theme.light`, `theme.dark`, `theme.sidebar`, `theme.light.sidebar`, and `theme.dark.sidebar`.) option_namefile_path_or_urlr?)r2rrrCs rrAz*StreamlitInvalidThemeSectionError.__init__~s"  ($-  r)z config.toml)rr7rr7r6rDrErGs@rrr{sE  rr)G __future__rrtypingrrr streamlitrcollections.abcrdatetimer r Exceptionr rrrKeyErrorrr"r$r&r(r*r,r9r;r=rIrMWarningrOrZr_rhrlrprwr{rrrrrrrrrrrrrrrrrrrrrFileNotFoundErrorrrrrrrr rrrrrs# ..*# I  5  e  u  eX  y  E  u    u  6 $ -  .   "3   #4  &;  / & )#6 )!$9! &C  (E  'D  <   &C    -J    %B    /L   -J .' &C' T  "?    "?  "#@"  (E   %B  !> <  "?    'D    ,I    *G   +H R5RR  (E   .K   !>   "? "#@BS"  !>    "?   =  7  !>  'D   (E  r