
    h`	                     8    d dl mZ erd dlZ G d d          ZdS )    )TYPE_CHECKINGNc                        e Zd ZddddefdZdS )RestartTselfzhydrogram.Clientblockc                     K    fd}|r |             d{V  n" j                              |                        S )ai  Restart the Client.

        This method will first call :meth:`~hydrogram.Client.stop` and then :meth:`~hydrogram.Client.start` in a row in
        order to restart a client using a single method.

        Parameters:
            block (``bool``, *optional*):
                Blocks the code execution until the client has been restarted. It is useful with ``block=False`` in case
                you want to restart the own client within an handler in order not to cause a deadlock.
                Defaults to True.

        Returns:
            :obj:`~hydrogram.Client`: The restarted client itself.

        Raises:
            ConnectionError: In case you try to restart a stopped Client.

        Example:
            .. code-block:: python

                from hydrogram import Client

                app = Client("my_account")


                async def main():
                    await app.start()
                    ...  # Invoke API methods
                    await app.restart()
                    ...  # Invoke other API methods
                    await app.stop()


                app.run(main())
        c                  t   K                                      d {V                                    d {V  d S )N)stopstart)r   s   c/var/www/html/auto_sub_bot/venv/lib/python3.11/site-packages/hydrogram/methods/utilities/restart.pydo_itzRestart.restart.<locals>.do_it@   sM      ))++**,,    N)loopcreate_task)r   r   r   s   `  r   restartzRestart.restart   se      J	 	 	 	 	  	+%''MMMMMMMMI!!%%''***r   N)T)__name__
__module____qualname__boolr    r   r   r   r      s<        . .. .t . . . . . .r   r   )typingr   	hydrogramr   r   r   r   <module>r      s_   ( !           / / / / / / / / / /r   