B
    f’»d¸  ã               @   sB   d dl Z d dlmZ d dlZddlmZ d
ed edœdd	„ZdS )é    N)ÚListé   )ÚidleFzpyrogram.Client)ÚclientsÚ
sequentialc             Ã   sˆ   |r"x6| D ]}|  ¡ I dH  q
W ntjdd„ | D ƒŽ I dH  tƒ I dH  |rjx6| D ]}| ¡ I dH  qRW ntjdd„ | D ƒŽ I dH  dS )a¡  Run multiple clients at once.

    This method can be used to run multiple clients at once and can be found directly in the ``pyrogram`` package.

    If you want to run a single client, you can use Client's bound method :meth:`~pyrogram.Client.run`.

    Parameters:
        clients (List of :obj:`~pyrogram.Client`):
            A list of client objects to run.

        sequential (``bool``, *optional*):
            Pass True to run clients sequentially.
            Defaults to False (run clients concurrently)

    Example:
        .. code-block:: python

            import asyncio
            from pyrogram import Client, compose


            async def main():
                apps = [
                    Client("account1"),
                    Client("account2"),
                    Client("account3")
                ]

                ...

                await compose(apps)


            asyncio.run(main())

    Nc             S   s   g | ]}|  ¡ ‘qS © )Ústart)Ú.0Úcr   r   úF/tmp/pip-unpacked-wheel-rcokkf2l/pyrogram/methods/utilities/compose.pyú
<listcomp>F   s    zcompose.<locals>.<listcomp>c             S   s   g | ]}|  ¡ ‘qS r   )Ústop)r	   r
   r   r   r   r   N   s    )r   ÚasyncioZgatherr   r   )r   r   r
   r   r   r   Úcompose   s    (

r   )F)r   Útypingr   Zpyrogramr   Úboolr   r   r   r   r   Ú<module>   s   