Ejemplo n.º 1
0
def delete_var(var_name):
    """

    Deletes variable from profile's part of database, whether or not it is an array or not.
    Parameters
    ----------
    var_name: String
        name of variable

    Returns
    -------
    question
    """
    profile.delete_variable(name, var_name)
    profile.write_database()
    return question("Deleted. Anything else?")
Ejemplo n.º 2
0
def no():
    """
    NoIntent triggers to reset global variables, close skill or cancel other function.

    Returns
    -------
    question (if continuing)
    statement (if not)
    """
    global temp
    global state
    if state is not None:
        temp = None
        state = None
        return question("Okay. Is there anything else you want to do?")
    else:
        profile.write_database()
        return statement("Alright! See you some other time.")
Ejemplo n.º 3
0
def declare_property(prop, value):
    """
    Sets a property to a value directly.

    Parameters
    ----------
    prop: String
        name of property
    value: String
        the value that prop should be set to

    Returns
    -------
    question

    """
    profile.change_property(name, prop, value)
    profile.write_database()
    return question(prop + " has been set to " + value + ". Anything else?")
Ejemplo n.º 4
0
def define_property(value):
    """
    Responses to follow up on an asked question using an arbitrary string literal.

    Parameters
    ----------
    value: String
        the value/answer

    Returns
    -------
    question
    """
    global name
    global temp
    global state
    if state == "Choose profile":
        # If asked for a name when multiple faces are detected
        if value in temp:
            name = value
            return question("Welcome " + name + "! What would you like to do?")
        return question("Please pick one of the following names: " +
                        ", ".join(temp))
    if state == "Add profile":
        # If asked for a name when an image is being added to the Face_Rec database
        name = profile.add_person(value, temp)
        profile.write_database()
        state = None
        temp = None
        return question("Welcome " + name + "! What would you like to do?")
    if state == "Inactive":
        # If called prior to starting the skill
        start_skill()
    if state == "Add value":
        # Answering in response to a value found to be None.
        profile.change_property(name, temp, value)
        profile.write_database()
        p = temp
        state = None
        temp = None
        return question(p + " has been set to " + value + ". Anything else?")
    if state == "Add list":
        # When adding a list requests the next object.
        profile.add_to_list(name, temp, [value])
        profile.write_database()
        return question("Added " + value + ". Anything else?")
    if state == "Delete from list":
        # When removing from list requests the next object.
        profile.remove_from_list(name, temp, [value])
        profile.write_database()
        return question("Removed " + value + ". Anything else?")
    return question("I'm sorry, I don't understand. Please try again.")