Пример #1
0
def delete_success():
    """Builds a 'success'-response message when a task item
    is deleted.

    :returns: str -- The response message.
    """
    return '{} it\'s gone!'.format(conversation.random_ok('coma'))
Пример #2
0
def delete_regret():
    """Builds a response message for when the user aborts the
    deletion of an item.

    :returns: str -- The response message.
    """
    return '{} then I won\'t.'.format(conversation.random_ok('coma'))
Пример #3
0
def update_success(item):
    """Builds a 'success'-response message when a task item
    is updated.

    :param item: The updated item.
    :type item: dict.
    :returns: str -- The response message.
    """
    return '{} here  is the task I updated for you:\n{}'.format(
        conversation.random_ok('coma'), utils.format_item(**item))
Пример #4
0
def list_items(item_list):
    """Lists and formats all tasks items given by item_list along
    with a semi-randomized 'ok'-response in a single message.

    If the list is empty, a fixed error response is returned.

    :param item_list: The list of items.
    :type item_list: list of dicts.
    :returns: str -- The response message.
    """
    if len(item_list) < 1:
        return 'Sorry, it seems like there are no items to show!'
    dynamic_resp = conversation.random_ok('coma')
    static_resp = 'here is a list of your items'
    message = '{} {}:\n'.format(dynamic_resp, static_resp)

    for item in item_list:
        message += utils.format_item(**item)
    return message