o
    -˜ŽjA	  ã                   @   s   d dl Z G dd„ dƒZdS )é    Nc                   @   s"   e Zd Z	ddddefdd„ZdS )	ÚRestartTÚselfzpyrogram.ClientÚblockc                 ƒ   s4   �‡ fdd„}|r|ƒ I dH  ˆ S ˆ j  |ƒ ¡ ˆ S )ae  Restart the Client.

        This method will first call :meth:`~pyrogram.Client.stop` and then :meth:`~pyrogram.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:`~pyrogram.Client`: The restarted client itself.

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

        Example:
            .. code-block:: python

                from pyrogram 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                   “   s"   �ˆ   ¡ I d H  ˆ  ¡ I d H  d S )N)ÚstopÚstart© ©r   r   ú_/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/utilities/restart.pyÚdo_it@   s   €zRestart.restart.<locals>.do_itN)ÚloopÚcreate_task)r   r   r
   r   r   r	   Úrestart   s   €(þzRestart.restartN)T)Ú__name__Ú
__module__Ú__qualname__Úboolr   r   r   r   r	   r      s    þÿþr   )Úpyrogramr   r   r   r   r	   Ú<module>   s   