
    i                     X    S SK r S SKrS SKJr  \ R                  " \5      r " S S5      rg)    N)rawc                   ,    \ rS rSr SSSS\4S jjrSrg)		Terminate   selfzpyrogram.Clientclear_handlersc                   #    U R                   (       d  [        S5      eU R                  (       a_  U R                  [        R
                  R                  R                  5       5      I Sh  vN   [        R                  SU R                  5        U R                  R                  5       I Sh  vN   U R                  R                  US9I Sh  vN   U R                  R                  5        H  nUR                  5       I Sh  vN   M     U R                  R!                  5         U R"                  R%                  5         U R&                  b  U R&                  I Sh  vN   U R"                  R!                  5         SU l         g GN N N N N/7f)a  Terminate the client by shutting down workers.

This method does the opposite of :meth:`~pyrogram.Client.initialize`.
It will stop the dispatcher and shut down updates and download workers.

Parameters:
    clear_handlers (``bool``, *optional*):
        Clear the already existing handlers on restart the client.
        Default to True.

Raises:
    ConnectionError: In case you try to terminate a client that is already terminated.
zClient is already terminatedNzTakeout session %s finished)r   F)is_initializedConnectionError
takeout_idinvoker   	functionsaccountFinishTakeoutSessionloginfostoragesave
dispatcherstopmedia_sessionsvaluesclearupdates_watchdog_eventsetupdates_watchdog_task)r   r   media_sessions      L/app/mltbenv/lib/python3.13/site-packages/pyrogram/methods/auth/terminate.py	terminateTerminate.terminate   s*    " ""!"@AA??++cmm33HHJKKKHH2DOODll!!!oo""."AAA!00779M$$&&& : 	!!###'')%%1,,,,##))+#% L 	"A ' -s\   A(F*F+AF,F- FF4FF	AFF'FFF	FF)r
   N)T)__name__
__module____qualname____firstlineno__boolr   __static_attributes__     r   r   r      s!      $'$'$'$ '$r(   r   )loggingpyrogramr   	getLoggerr!   r   r   r'   r(   r   <module>r,      s*   &   !($ ($r(   