
    N[i                          d dl Z  G d d      Zy)    Nc                        e Zd Z	 ddddefdZy)Restartselfzpyrogram.Clientblockc                     K    fd}|r |        d{     S  j                   j                   |               S 7 (w)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                  v   K    j                          d {     j                          d {    y 7 7 w)N)stopstart)r   s   U/var/www/files/kim/lib/python3.12/site-packages/pyrogram/methods/utilities/restart.pydo_itzRestart.restart.<locals>.do_it?   s.     ))+**, s   959799N)loopcreate_task)r   r   r   s   `  r   restartzRestart.restart   sB     P	 'MM  II!!%'*	 s   A >)A N)T)__name__
__module____qualname__boolr        r   r   r      s     111r   r   )pyrogramr   r   r   r   <module>r      s   & 2 2r   