src/lsi/utils/stream.py
def stream_commands(commands, hash_colors=True, parallel=False):
    """
    Runs multiple commands, optionally in parallel. Each command should be
    a dictionary with a 'command' key and optionally 'description' and
    'write_stdin' keys.
    """
    def _get_color(string):
        if hash_colors is True:
            return get_color_hash(string)
        else:
            return DEFAULT_COLOR
    fixed_commands = []
    for command in commands:
        cmd_text = command['command']
        description = command.get('description')
        color = _get_color(description or '')
        write_stdin = command.get('write_stdin')
        description = color(description) if color is not None else description
        formatter = _format_with_description(description)
        fixed_commands.append({
            'command': cmd_text,
            'formatter': formatter,
            'write_stdin': write_stdin,
            'ignore_empty': True
        })
    stream_command_dicts(fixed_commands, parallel=parallel)
def stream_commands(commands, hash_colors=True, parallel=False):
    def _get_color(string):
        if hash_colors is True:
            return get_color_hash(string)
        else:
            return DEFAULT_COLOR
    fixed_commands = []
    for command in commands:
        cmd_text = command['command']
        description = command.get('description')
        color = _get_color(description or '')
        write_stdin = command.get('write_stdin')
        description = color(description) if color is not None else description
        formatter = _format_with_description(description)
        fixed_commands.append({
            'command': cmd_text,
            'formatter': formatter,
            'write_stdin': write_stdin,
            'ignore_empty': True
        })
    stream_command_dicts(fixed_commands, parallel=parallel)
def stream_commands ( commands , hash_colors = True , parallel = False ) : def _get_color ( string ) : if hash_colors is True : return get_color_hash ( string ) else : return DEFAULT_COLOR fixed_commands = [ ] for command in commands : cmd_text = command [ 'command' ] description = command . get ( 'description' ) color = _get_color ( description or '' ) write_stdin = command . get ( 'write_stdin' ) description = color ( description ) if color is not None else description formatter = _format_with_description ( description ) fixed_commands . append ( { 'command' : cmd_text , 'formatter' : formatter , 'write_stdin' : write_stdin , 'ignore_empty' : True } ) stream_command_dicts ( fixed_commands , parallel = parallel )
Runs multiple commands, optionally in parallel. Each command should be
    a dictionary with a 'command' key and optionally 'description' and
    'write_stdin' keys.
Runs multiple commands optionally in parallel . Each command should be a dictionary with a command key and optionally description and write_stdin keys .