Ë
    úmxi�}  ã                  óì  — U d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
mZ d dlmZmZmZmZmZ d dlmZ d dlmZmZmZ d d	lmZ d d
lmZ d dlmZ d dlm Z  d dl!m"Z"m#Z# d dl$m%Z% d dl&m'Z'm(Z( d dl)m*Z* d dl+m,Z,m-Z- d dl.m/Z/m0Z0m1Z1 d dl2m3Z3m4Z4m5Z5m6Z6 d dl7m8Z8m9Z9m:Z: d dl;m<Z< erd dl=m>Z>m?Z? d dl@mAZA d dl)m*Z* d dlBmCZC  eeD«      ZEdeFd<    G d„ de	«      ZG	 d"d„ZH G d„ d«      ZId#d „ZJd$d!„ZKy)%é    )ÚannotationsN)Úcontextmanager)ÚEnum)Údefault_timer)ÚTYPE_CHECKINGÚAnyÚFinalÚLiteralÚcast)ÚSignal)ÚconfigÚruntimeÚutil)ÚFragmentStorageKeyError)Ú
get_logger)ÚClientState)Ú
ForwardMsg)Úcreate_page_profile_messageÚto_microseconds)ÚPagesManager)Úexec_func_with_error_handlingÚmodified_sys_path)ÚScriptCache)ÚRerunExceptionÚStopException)Ú	RerunDataÚScriptRequestsÚScriptRequestType)ÚScriptRunContextÚUserInfoTypeÚadd_script_run_ctxÚget_script_run_ctx)ÚSCRIPT_RUN_WITHOUT_ERRORS_KEYÚSafeSessionStateÚSessionState)Úpage_sort_key)ÚCallableÚ	Generator)ÚFragmentStorage)ÚUploadedFileManagerr	   Ú_LOGGERc                  ó(   — e Zd ZdZdZdZdZdZdZdZ	y)	ÚScriptRunnerEventÚSCRIPT_STARTEDÚ!SCRIPT_STOPPED_WITH_COMPILE_ERRORÚSCRIPT_STOPPED_WITH_SUCCESSÚSCRIPT_STOPPED_FOR_RERUNÚFRAGMENT_STOPPED_WITH_SUCCESSÚSHUTDOWNÚENQUEUE_FORWARD_MSGN)
Ú__name__Ú
__module__Ú__qualname__r.   r/   r0   r1   r2   r3   r4   © ó    úc/home/htdocs/ttos/venv/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.pyr-   r-   K   s;   „ ð &€Nð )LÐ%ð #@Ðð  :Ðð %DÐ!ð €Hð 0Ñr9   r-   c                óR  — ddl m} ddlm}m} ddlm}  || «      j                  «       }|j                  dz  }t        |j                  d«      D �cg c]I  }|j                  j                  d«      r,|j                  j                  d«      s|j                  d	k7  r|‘ŒK c}t        ¬
«      } ||d¬«      }	|	g|D �cg c]  } |||j                  z  «      ‘Œ c}z   }
t        j                   d«      du rdnd} |t#        d|
«      |d¬«      }|j%                  «        y c c}w c c}w )Nr   )ÚPath)ÚPageTypeÚ_navigation)ÚStreamlitPageÚpagesz*.pyz.pyú.z__init__.py)ÚkeyT)Údefaultzclient.showSidebarNavigationFÚhiddenÚsidebarzlist[PageType])ÚpositionÚexpanded)Úpathlibr<   Ústreamlit.commands.navigationr=   r>   Ústreamlit.navigation.pager?   ÚresolveÚparentÚsortedÚglobÚnameÚendswithÚ
startswithr&   r   Ú
get_optionr   Úrun)Úmain_script_pathr<   r=   r>   r?   Úresolved_main_script_pathÚpages_folderÚpager@   Ú	main_pageÚ	all_pagesrF   s               r:   Ú_mpa_v1rZ      s'  € ÝçCÝ7ñ (,Ð,<Ó'=×'EÑ'EÓ'GÐØ3×:Ñ:¸WÑD€Lô ð %×)Ñ)¨&Ó1ö	
àØ�y‰y×!Ñ! %Ô(Ø—I‘I×(Ñ(¨Ô-Ø—	‘	˜]Ò*ò	 ò	
ô ô	€Eñ Ð7ÀÔF€IØ�Ø<AöØ48‰�l T§Y¡YÑ.Õ/òñ €Iô ×ÑÐ;Ó<ÀÑEñ 	àð ñ
 ÜÐ˜yÓ)ØØô€Dð 	‡H�H…Jùò7	
ùòs   ÁADÂ=D$c                  ó¾   — e Zd Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Z	dd„Z
dd	„Zdd
„Zedd„«       Zdd„Z	 	 	 	 	 	 	 	 dd„Zdd„Zy)ÚScriptRunnerc
                ó0  — || _         || _        t        || j                  ¬«      | _        || _        || _        || _        || _        |	| _	        t        «       | _        | j                  j                  |«       t        d¬«      | _        d| _        d| _        y)a1  Initialize the ScriptRunner.

        (The ScriptRunner won't start executing until start() is called.)

        Parameters
        ----------
        session_id
            The AppSession's id.

        main_script_path
            Path to our main app script.

        session_state
            The AppSession's SessionState instance.

        uploaded_file_mgr
            The File manager to store the data uploaded by the file_uploader widget.

        script_cache
            A ScriptCache instance.

        initial_rerun_data
            RerunData to initialize this ScriptRunner with.

        user_info
            A dict that contains information about the current user. For now,
            it only contains the user's email address.

            {
                "email": "example@example.com"
            }

            Information about the current user is optionally provided when a
            websocket connection is initialized via the "X-Streamlit-User" header.

        fragment_storage
            The AppSession's FragmentStorage instance.
        )Úyield_callbacka�  Emitted when a ScriptRunnerEvent occurs.

            This signal is generally emitted on the ScriptRunner's script
            thread (which is *not* the same thread that the ScriptRunner was
            created on).

            Parameters
            ----------
            sender: ScriptRunner
                The sender of the event (this ScriptRunner).

            event : ScriptRunnerEvent

            forward_msg : ForwardMsg | None
                The ForwardMsg to send to the frontend. Set only for the
                ENQUEUE_FORWARD_MSG event.

            exception : BaseException | None
                Our compile error. Set only for the
                SCRIPT_STOPPED_WITH_COMPILE_ERROR event.

            widget_states : streamlit.proto.WidgetStates_pb2.WidgetStates | None
                The ScriptRunner's final WidgetStates. Set only for the
                SHUTDOWN event.
            )ÚdocFN)Ú_session_idÚ_main_script_pathr$   Ú'_maybe_handle_execution_control_requestÚ_session_stateÚ_uploaded_file_mgrÚ_script_cacheÚ
_user_infoÚ_fragment_storageÚ_pages_managerr   Ú	_requestsÚrequest_rerunr   Úon_eventÚ_execingÚ_script_thread)
ÚselfÚ
session_idrT   Úsession_stateÚuploaded_file_mgrÚscript_cacheÚinitial_rerun_dataÚ	user_infoÚfragment_storageÚpages_managers
             r:   Ú__init__zScriptRunner.__init__ª   s—   € ðd &ˆÔØ!1ˆÔÜ.Ø¨$×*VÑ*Vô
ˆÔð #4ˆÔØ)ˆÔØ#ˆŒØ!1ˆÔà+ˆÔÜ'Ó)ˆŒØ�‰×$Ñ$Ð%7Ô8äðô
ˆŒð< ˆŒð 8<ˆÕr9   c                ó,   — t        j                  | «      S ©N)r   Úrepr_©rn   s    r:   Ú__repr__zScriptRunner.__repr__  s   € Ü�z‰z˜$ÓÐr9   c                ó8   — | j                   j                  «        y)zÒRequest that the ScriptRunner stop running its script and
        shut down. The ScriptRunner will handle this request when it reaches
        an interrupt point.

        Safe to call from any thread.
        N)ri   Úrequest_stopr{   s    r:   r~   zScriptRunner.request_stop  s   € ð 	�‰×#Ñ#Õ%r9   c                ó8   — | j                   j                  |«      S )a‰  Request that the ScriptRunner interrupt its currently-running
        script and restart it.

        If the ScriptRunner has been stopped, this request can't be honored:
        return False.

        Otherwise, record the request and return True. The ScriptRunner will
        handle the rerun request as soon as it reaches an interrupt point.

        Safe to call from any thread.
        )ri   rj   )rn   Ú
rerun_datas     r:   rj   zScriptRunner.request_rerun  s   € ð �~‰~×+Ñ+¨JÓ7Ð7r9   c                ó²   — | j                   �t        d«      ‚t        j                  | j                  d¬«      | _         | j                   j                  «        y)zeStart a new thread to process the ScriptEventQueue.

        This must be called only once.

        Nz ScriptRunner was already startedzScriptRunner.scriptThread)ÚtargetrO   )rm   ÚRuntimeErrorÚ	threadingÚThreadÚ_run_script_threadÚstartr{   s    r:   r‡   zScriptRunner.start'  sO   € ð ×ÑÐ*ÜÐAÓBÐBä'×.Ñ.Ø×*Ñ*Ø,ô
ˆÔð 	×Ñ×!Ñ!Õ#r9   c                ój   — | j                  «       st        d«      ‚t        «       }|€t        d«      ‚|S )at  Get the ScriptRunContext for the current thread.

        Returns
        -------
        ScriptRunContext
            The ScriptRunContext for the current thread.

        Raises
        ------
        AssertionError
            If called outside of a ScriptRunner thread.
        RuntimeError
            If there is no ScriptRunContext for the current thread.

        zGScriptRunner._get_script_run_ctx must be called from the script thread.zOScriptRunner thread has a null ScriptRunContext. Something has gone very wrong!)Ú_is_in_script_threadrƒ   r"   )rn   Úctxs     r:   Ú_get_script_run_ctxz ScriptRunner._get_script_run_ctx6  sH   € ð  ×(Ñ(Ô*ÜØYóð ô !Ó"ˆØˆ;äð1óð ð ˆ
r9   c                óL  — | j                  «       st        d«      ‚t        j                  d«       t	        | j
                  | j                  | j                  d| j                  | j                  | j                  | j                  t        t        j                  d«      «      | j                  | j                   d¬«      }t#        t%        j&                  «       |«       | j                  j)                  «       }|j*                  t,        j.                  k(  rS| j1                  |j2                  «       | j                  j)                  «       }|j*                  t,        j.                  k(  rŒS|j*                  t,        j4                  k7  rt        d|j*                  › d�«      ‚t7        «       }|j8                  |_        |j:                  |_        |j<                  r%|j<                  j?                  |j<                  «       | j@                  jC                  | tD        jF                  |¬	«       y)
aN  The entry point for the script thread.

        Processes the ScriptRequestQueue, which will at least contain the RERUN
        request that will trigger the first script-run.

        When the ScriptRequestQueue is empty, or when a SHUTDOWN request is
        dequeued, this function will exit and its thread will terminate.
        zFScriptRunner._run_script_thread must be called from the script thread.zBeginning script threadÚ zbrowser.gatherUsageStatsN)ro   Ú_enqueueÚscript_requestsÚquery_stringrp   rq   rT   rt   Úgather_usage_statsru   rv   Úcontext_infoú Unrecognized ScriptRequestType: ú. This should never happen.)ÚeventÚclient_state)$r‰   rƒ   r+   Údebugr   r`   Ú_enqueue_forward_msgri   rc   rd   ra   rf   Úboolr   rR   rg   rh   r!   r„   Úcurrent_threadÚon_scriptrunner_readyÚtyper   ÚRERUNÚ_run_scriptr€   ÚSTOPr   r�   Úpage_script_hashr’   ÚCopyFromrk   Úsendr-   r3   )rn   rŠ   Úrequestr–   s       r:   r†   zScriptRunner._run_script_threadT  s¹  € ð ×(Ñ(Ô*ÜØXóð ô 	�‰Ð/Ô0ô Ø×'Ñ'Ø×.Ñ.Ø ŸN™NØØ×-Ñ-Ø"×5Ñ5Ø!×3Ñ3Ø—o‘oÜ#¤F×$5Ñ$5Ð6PÓ$QÓRØ!×3Ñ3Ø×-Ñ-Øô
ˆô 	œ9×3Ñ3Ó5°sÔ;à—.‘.×6Ñ6Ó8ˆØ�l‰lÔ/×5Ñ5Ò5ð
 ×Ñ˜W×/Ñ/Ô0Ø—n‘n×:Ñ:Ó<ˆGð �l‰lÔ/×5Ñ5Ó5ð �<‰<Ô,×1Ñ1Ò1ÜØ2°7·<±<°.Ð@[Ð\óð ô #“}ˆØ$'×$4Ñ$4ˆÔ!Ø(+×(<Ñ(<ˆÔ%Ø×ÒØ×%Ñ%×.Ñ.¨s×/?Ñ/?Ô@Ø�‰×ÑØÔ)×2Ñ2Àð 	õ 	
r9   c                óD   — | j                   t        j                  «       k(  S )z=True if the calling function is running in the script thread.)rm   r„   rš   r{   s    r:   r‰   z!ScriptRunner._is_in_script_threadŽ  s   € à×"Ñ"¤i×&>Ñ&>Ó&@Ñ@Ð@r9   c                ó|   — | j                  «        | j                  j                  | t        j                  |¬«       y)zºEnqueue a ForwardMsg to our browser queue.
        This private function is called by ScriptRunContext only.

        It may be called from the script thread OR the main thread.
        )r•   Úforward_msgN)rb   rk   r¢   r-   r4   )rn   Úmsgs     r:   r˜   z!ScriptRunner._enqueue_forward_msg’  s7   € ð 	×4Ñ4Ô6ð 	�‰×ÑØÔ)×=Ñ=È3ð 	õ 	
r9   c                ó\  — | j                  «       sy| j                  sy| j                  j                  «       }|€y|j                  t
        j                  k(  rt        |j                  «      ‚|j                  t
        j                  k7  rt        d|j                  › d�«      ‚t        «       ‚)as  Check our current ScriptRequestState to see if we have a
        pending STOP or RERUN request.

        This function is called every time the app script enqueues a
        ForwardMsg, which means that most `st.foo` commands - which generally
        involve sending a ForwardMsg to the frontend - act as implicit
        yield points in the script's execution.
        Nr“   r”   )r‰   rl   ri   Úon_scriptrunner_yieldrœ   r   r�   r   r€   rŸ   rƒ   r   )rn   r£   s     r:   rb   z4ScriptRunner._maybe_handle_execution_control_request¢  sš   € ð ×(Ñ(Ô*ð
 à�}Š}ð
 à—.‘.×6Ñ6Ó8ˆØˆ?àà�<‰<Ô,×2Ñ2Ò2Ü  ×!3Ñ!3Ó4Ð4à�<‰<Ô,×1Ñ1Ò1ÜØ2°7·<±<°.Ð@[Ð\óð ô ‹oÐr9   c              #  óx   K  — | j                   rt        d«      ‚d| _         	 d–— d| _         y# d| _         w xY w­w)zÈA context for setting the ScriptRunner._execing flag.

        Used by _maybe_handle_execution_control_request to ensure that
        we only handle requests while we're inside an exec() call
        zNested set_execing_flag callTNF)rl   rƒ   r{   s    r:   Ú_set_execing_flagzScriptRunner._set_execing_flagÇ  s8   è ø€ ð �=Š=ÜÐ=Ó>Ð>ØˆŒð	"Ûà!ˆD�Mø˜EˆD�Müs   ‚:¢. ¦:®	7·:c           
     ó¶  ‡ — ‰ j                  «       st        d«      ‚	 t        j                  d|«       t	        «       }d}|j
                  s,t        j                  «       j                  j                  «        ‰ j                  j                  |j                  |j                  «       ‰ j                  j                  |j                  «      }‰ j                  j                  «       }|�|d   n|d   }‰ j!                  «       }|j                  }||k7  rtt#        «       }	|j$                  �C|j$                  j&                  �-|j$                  j&                  D �
ch c]  }
|
j(                  ’Œ }	}
‰ j*                  j-                  |	«       |j
                  xs d}|j/                  |j0                  |||j2                  |j4                  ¬«       ‰ j6                  j9                  ‰ t:        j<                  ||‰ j                  j?                  «       ¬«       	 |�|d   }n;|d   }tA        «       }|j                  |jB                  _        |jE                  |«       ‰ jF                  jI                  |«      }‰ jS                  d«      }|tT        jV                  d<   ||jX                  d<   ||||f	 	 	 	 	 	 	 	 	 dˆ fd„}t	        «       |z
  }t[        ||«      \  }}}}}|‰ j*                  tN        <   |rt:        j\                  }n-|j
                  rt:        j^                  }nt:        j`                  }|jb                  r]	 |jE                  te        |jf                  ti        t	        «       |z
  «      ti        |«      |rtk        |«      jl                  nd¬«      «       ‰ jo                  |||«       tq        tr        «       |�|}ny�ŒŸc c}
w # tJ        $ r`}t        jM                  d	|¬
«       d‰ j*                  tN        <   ‰ j6                  j9                  ‰ t:        jP                  |¬«       Y d}~yd}~ww xY w# tJ        $ r!}t        j                  d|¬
«       Y d}~ŒÀd}~ww xY w)z€Run our script.

        Parameters
        ----------
        rerun_data: RerunData
            The RerunData to use.

        z?ScriptRunner._run_script must be called from the script thread.zRunning script %sr   Nr    )r�   r    Úfragment_ids_this_runÚcached_message_hashesr’   )r•   r    r­   r@   Úscript_pathzScript compilation error)Úexc_infoF)r•   Ú	exceptionÚ__main__Ú__file__c                óV  •— t        ‰j                  «      5  ‰j                  «       5  |j                  �%‰j                  j                  |j                  «       |j                  «        |j                  r5|j                  D ]%  }	 ‰j                  j                  |«      } |«        Œ' nbt"        j$                  rt'        ‰j                  «       nt)        | |j*                  «       ‰j                  j-                  |j.                  ¬«       ‰j                  j1                  «        ‰j3                  «        d d d «       d d d «       y # t        $ r% |j                  st        j                  d|«       Y Œót        t        f$ r ‚ t         $ r Y �Œw xY w# 1 sw Y   Œ]xY w# 1 sw Y   y xY w)Na  Couldn't find fragment with id %s. This can happen if the fragment does not exist anymore when this request is processed, for example because a full app rerun happened that did not register the fragment. Usually this doesn't happen or no action is required, so its mainly for debugging.)Únew_fragment_ids)r   ra   r«   Úwidget_statesrc   Úon_script_will_rerunÚon_script_startÚfragment_id_queuerg   Úgetr   Úis_auto_rerunr+   Úwarningr   r   Ú	Exceptionr   Úuses_pages_directoryrZ   ÚexecÚ__dict__Úclearrµ   Úmaybe_check_serializablerb   )ÚcodeÚmodulerŠ   r€   Úfragment_idÚwrapped_fragmentrn   s         €r:   Úcode_to_execz.ScriptRunner._run_script.<locals>.code_to_execa  sŸ  ø€ ô & d×&<Ñ&<Ó=ñ@Cà×*Ñ*Ó,ñ@Cð
 "×/Ñ/Ð;Ø×+Ñ+×@Ñ@Ø&×4Ñ4ôð ×'Ñ'Ô)à!×3Ò3Ø+5×+GÑ+Gò &%˜Kð%%Ø37×3IÑ3I×3MÑ3MØ$/ó4"Ð 0ñ !1Õ 2ñ&%ôR (×<Ò<Ü# D×$:Ñ$:Õ;ä   v§¡Ô7Ø×.Ñ.×4Ñ4Ø-0×-AÑ-Að 5ô ð ×'Ñ'×@Ñ@ÔBà×@Ñ@ÔB÷A@C÷ @Cð @Cøô( $;ò &ð (2×'?Ò'?Ü$+§O¡Oð)Rð )4ô	%&ùô %3´MÐ#Bò &ð !&Ü#,ò %ò
 !%ð%ú÷]@Cð @Cú÷ @Cð @CúsT   —F¨AFÂ"EÂ(BFÄ7FÅ+F	Å3FÅ5F	ÆFÆF	ÆFÆF	ÆFÆF()ÚcommandsÚ	exec_timeÚ	prep_timeÚuncaught_exceptionzFailed to create page profile)
rÃ   ÚstrrÄ   útypes.ModuleTyperŠ   r   r€   r   ÚreturnÚNone):r‰   rƒ   r+   r—   Útimerr¹   r   Úget_instanceÚmedia_file_mgrÚclear_session_refsrh   Úset_script_intentr    Ú	page_nameÚget_initial_active_scriptÚget_main_pager‹   Úsetr¶   ÚwidgetsÚidrc   Úon_script_finishedÚresetr�   r®   r’   rk   r¢   r-   r.   Ú	get_pagesr   Úpage_not_foundÚenqueuere   Úget_bytecoder½   r±   r#   r/   Ú_new_moduleÚsysÚmodulesrÀ   r   r1   r2   r0   r‘   r   Útracked_commandsr   rœ   r5   Ú_on_script_finishedÚ_log_if_errorÚ_clean_problem_modules)rn   r€   Ú
start_timerÊ   Úactive_scriptÚmain_page_infor    rŠ   Úprevious_page_script_hashÚ
widget_idsÚwr­   r¯   r§   rÃ   ÚexrÄ   rÇ   Ú_Úrun_without_errorsÚrerun_exception_dataÚpremature_stoprË   Úfinished_events   `                       r:   rž   zScriptRunner._run_scriptÖ  sf  ø€ ð ×(Ñ(Ô*ÜØQóð ð
 Ü�M‰MÐ-¨zÔ:Ü %£ˆJØ ˆIà×/Ò/ô
 ×$Ñ$Ó&×5Ñ5×HÑHÔJà×Ñ×1Ñ1Ø×+Ñ+¨Z×-AÑ-Aôð !×/Ñ/×IÑIØ×+Ñ+óˆMð "×0Ñ0×>Ñ>Ó@ˆNð !Ð,ð Ð0Ò1à#Ð$6Ñ7ð ð ×*Ñ*Ó,ˆCð ),×(<Ñ(<Ð%Ø(Ð,<Ò<ô (+£u�
ð ×,Ñ,Ð8Ø"×0Ñ0×8Ñ8ÐDà0:×0HÑ0H×0PÑ0PÖ!Q¨1 !§$£$Ð!Q�JÐ!QØ×#Ñ#×6Ñ6°zÔBð ×,Ñ,Ò4°ð "ð �I‰IØ'×4Ñ4Ø!1Ø&;Ø&0×&FÑ&FØ'×4Ñ4ð ô ð �M‰M×ÑØÜ'×6Ñ6Ø!1Ø&;Ø×)Ñ)×3Ñ3Ó5ð ô ðØ Ð,Ø"/°Ñ">‘Kð #1°Ñ"?�Kô %›,�CØ3=×3GÑ3G�C×&Ñ&Ô0Ø—K‘K Ô$à×)Ñ)×6Ñ6°{ÓC�ð& ×%Ñ% jÓ1ˆFð '-ŒC�K‰K˜
Ñ#ð +6ˆF�O‰O˜JÑ'ð !Ø+1Ø(+Ø(2ð	FCØðFCà(ðFCð &ðFCð &ð	FCð
 õFCôP › *Ñ,ˆIô .¨l¸CÓ@ñØØ"Ø$ØØ"ð BTˆD×ÑÔ =Ñ>á#ô "3×!KÑ!K‘Ø×-Ò-Ü!2×!PÑ!P‘ä!2×!NÑ!N�à×%Ò%ðPà—K‘KÜ3Ø%(×%9Ñ%9Ü&5´e³gÀ
Ñ6JÓ&KÜ&5°iÓ&@ñ $6ô !%Ð%7Ó 8× AÒ Aà%)ô	ôð  ×$Ñ$ S¨.¸.ÔIô Ô0Ô1à#Ð/Ø1‘
àñi ùòX "Røô\ ò 	ä×!Ñ!Ð"<ÀrÐ!ÔJØEJ�×#Ñ#Ô$AÑBØ—‘×"Ñ"ØÜ+×MÑMØ ð #ô ô
 ûð	ûôZ !ò Pô —M‘MÐ"AÈB�M×OÑOûðPús9   ÅN=ÈAO Ì7AP. Ï	P+ÏAP&Ð&P+Ð.	QÐ7QÑQc                ó:  — |s%| j                   j                  |j                  «       | j                  j	                  | |¬«       t        j                  «       j                  j                  «        t        j                  d«      rt        j                  d«       yy)zŠCalled when our script finishes executing, even if it finished
        early with an exception. We perform post-run cleanup here.
        )r•   zrunner.postScriptGCé   N)rc   rÛ   Úwidget_ids_this_runrk   r¢   r   rÑ   rÒ   Úremove_orphaned_filesr   rR   ÚgcÚcollect)rn   rŠ   r•   rò   s       r:   rå   z ScriptRunner._on_script_finishedÜ  sx   € ñ Ø×Ñ×2Ñ2°3×3JÑ3JÔKð 	�‰×Ñ˜4 uÐÔ-ô 	×ÑÓ×-Ñ-×CÑCÔEô ×ÑÐ2Ô3Ü�J‰J�q�Mð 4r9   c                ó,   — t        j                  |«      S )z(Create a new module with the given name.)ÚtypesÚ
ModuleType)rn   rO   s     r:   rá   zScriptRunner._new_moduleõ  s   € ä×Ñ Ó%Ð%r9   N)ro   rÌ   rT   rÌ   rp   r%   rq   r*   rr   r   rs   r   rt   r    ru   r)   rv   r   rÎ   rÏ   )rÎ   rÌ   ©rÎ   rÏ   )r€   r   rÎ   r™   )rÎ   r   )rÎ   r™   )r§   r   rÎ   rÏ   )rÎ   zGenerator[None, None, None])r€   r   rÎ   rÏ   )rŠ   r   r•   r-   rò   r™   rÎ   rÏ   )rO   rÌ   rÎ   rÍ   )r5   r6   r7   rw   r|   r~   rj   r‡   r‹   r†   r‰   r˜   rb   r   r«   rž   rå   rá   r8   r9   r:   r\   r\   ©   sê   „ ða<àða<ð ða<ð $ð	a<ð
 /ða<ð "ða<ð &ða<ð  ða<ð *ða<ð $ða<ð 
óa<óF ó&ó8ó$óó<8
ótAó
ó #ðJ ò"ó ð"óDðLØ#ðØ,=ðØOSðà	óô2&r9   r\   c                 óX  — dt         j                  v r8	 t         j                  d   } t        d| «      j                  j	                  «        dt         j                  v r0	 t         j                  d   }t        d|«      j                  d«       yy# t
        $ r Y ŒNw xY w# t
        $ r Y yw xY w)z;Some modules are stateful, so we have to clear their state.Úkerasr   zmatplotlib.pyplotÚallN)râ   rã   r   ÚbackendÚclear_sessionr½   Úclose)rÿ   Úplts     r:   rç   rç   ú  sŸ   € ð ”#—+‘+Ñð	Ü—K‘K Ñ(ˆEÜ�˜Ó×&Ñ&×4Ñ4Ô6ð
 œcŸk™kÑ)ð	Ü—+‘+Ð1Ñ2ˆCÜ�˜Ó×"Ñ" 5Õ)ð *øô	 ò 	áð	ûô ò 	áð	ús#   ”7B Á.B Â	BÂBÂ	B)Â(B)c                ój   — 	  | «        y # t         $ r}t        j                  |«       Y d }~y d }~ww xY wry   )r½   r+   r¼   )ÚfnÚes     r:   ræ   ræ     s+   € ðÙ
�øÜò Ü�‰˜×Ñûðús   ‚
 Š	2“-­2)rT   rÌ   rÎ   rÏ   rý   )r  zCallable[[], None]rÎ   rÏ   )LÚ
__future__r   rø   râ   r„   rû   Ú
contextlibr   Úenumr   Útimeitr   rÐ   Útypingr   r   r	   r
   r   Úblinkerr   Ú	streamlitr   r   r   Ústreamlit.errorsr   Ústreamlit.loggerr   Ústreamlit.proto.ClientState_pb2r   Ústreamlit.proto.ForwardMsg_pb2r   Ústreamlit.runtime.metrics_utilr   r   Ústreamlit.runtime.pages_managerr   Ú(streamlit.runtime.scriptrunner.exec_coder   r   Ú+streamlit.runtime.scriptrunner.script_cacher   Ú/streamlit.runtime.scriptrunner_utils.exceptionsr   r   Ú4streamlit.runtime.scriptrunner_utils.script_requestsr   r   r   Ú7streamlit.runtime.scriptrunner_utils.script_run_contextr   r    r!   r"   Ústreamlit.runtime.stater#   r$   r%   Ústreamlit.source_utilr&   Úcollections.abcr'   r(   Ústreamlit.runtime.fragmentr)   Ú'streamlit.runtime.uploaded_file_managerr*   r5   r+   Ú__annotations__r-   rZ   r\   rç   ræ   r8   r9   r:   ú<module>r      sÃ   ðö #ã 	Û 
Û Û Ý %Ý Ý )ß ;Õ ;å ç +Ñ +Ý 4Ý 'Ý 7Ý 5÷õ 9÷õ D÷÷ñ ÷
ó ÷ñ õ
 0áß3å:ÝGÝKá˜HÓ%€ˆÓ %ô0˜ô 0ð>ó*'÷TN	&ñ N	&óbô,r9   