src/lsi/utils/stream.py
def stream_command_dicts(commands, parallel=False):
    """
    Takes a list of dictionaries with keys corresponding to ``stream_command``
    arguments, and runs all concurrently.

    :param commands: A list of dictionaries, the keys of which should line up
                     with the arguments to ``stream_command`` function.
    :type commands: ``list`` of ``dict``
    :param parallel: If true, commands will be run in parallel.
    :type parallel: ``bool``
    """
    if parallel is True:
        threads = []
        for command in commands:
            target = lambda: stream_command(**command)
            thread = Thread(target=target)
            thread.start()
            threads.append(thread)
        for t in threads:
            t.join()
    else:
        for command in commands:
            stream_command(**command)
def stream_command_dicts(commands, parallel=False):
    """
    Takes a list of dictionaries with keys corresponding to ``stream_command``
    arguments, and runs all concurrently.

    :param commands: A list of dictionaries, the keys of which should line up
                     with the arguments to ``stream_command`` function.
    :type commands: ``list`` of ``dict``
    :param parallel: If true, commands will be run in parallel.
    :type parallel: ``bool``
    """
    if parallel is True:
        threads = []
        for command in commands:
            target = lambda: stream_command(**command)
            thread = Thread(target=target)
            thread.start()
            threads.append(thread)
        for t in threads:
            t.join()
    else:
        for command in commands:
            stream_command(**command)
Takes a list of dictionaries with keys corresponding to ``stream_command``
    arguments, and runs all concurrently.

    :param commands: A list of dictionaries, the keys of which should line up
                     with the arguments to ``stream_command`` function.
    :type commands: ``list`` of ``dict``
    :param parallel: If true, commands will be run in parallel.
    :type parallel: ``bool``