Beispiel #1
0
 def get_scene(self):
     """
     Helper function which returns a random scene.
     :return: string
         Returns a random scene.
     """
     return libraries.get_one(self.scene)
 def get_character(self):
     """
     Get a character type from self.char_type.
     :return: string
         Returns a single character type.
     """
     return libraries.get_one(self.char_type)
Beispiel #3
0
def get_emotion(emotion_type='all'):
    """
    Get random emotion.
    :return: string
        A  random emotion.
    """
    emotion_list = []
    if emotion_type == 'all':
        emotion_type = [
            'love',
            'joy',
            'anger',
            'sad',
            'fear',
            'disgust',
            'surprise',
            'curious',
        ]

    try:
        emotion_list += emotions[emotion_type]

    except TypeError:
        for family in emotion_type:
            emotion_list += emotions[family]
    except KeyError:
        return get_emotion('all')

    return libraries.get_one(emotion_list)
Beispiel #4
0
def get_shade():
    """
    Picks a random shade modifier.
    :return: string
        Random shade modifier.
    """
    return libraries.get_one(shades)
def get_prompt():
    """
    Get a random prompt from the illustration list.
    :return: string
        An illustration prompt.
    """
    return libraries.get_one(illustration)
Beispiel #6
0
def get_place():
    """
    Get a random location.
    :return: string
        A random location from the places list.
    """
    return libraries.get_one(places)
Beispiel #7
0
def get_genre(category='all'):
    """
    Return a random genre.
    :param category: string
        Return a genre from this super-category.
    :return: string
        A  random genre.
    """
    if category is 'all':
        genre_list = []
        for cat in genres.keys():
            genre_list.append(get_genre(cat))
        return libraries.get_one(genre_list)

    else:
        return libraries.get_one(genres[category.lower()])
 def get_description(self):
     """
     Get a description from self.description.
     :return: string
         Returns a single description.
     """
     return libraries.get_one(self.description)
Beispiel #9
0
 def get_env(self):
     """
     Helper function which returns an environment.
     :return: string
         Returns a random entry from self.environment
     """
     return libraries.get_one(self.environment)
Beispiel #10
0
 def get_adjective(self):
     """
     Get a adjective from self.adjectives.
     :return: string
         Returns a single adjective.
     """
     adjective = self.adjectives
     return libraries.get_one(adjective)
 def get_adjective(self):
     """
     Get a adjective from self.adjectives.
     :return: string
         Returns a single adjective.
     """
     adjective = self.adjectives + [get_emotion()] * len(self.adjectives)
     return libraries.get_one(adjective)
Beispiel #12
0
def get_instrument():
    """
    Returns a list of musical instruments.
    :param num: int
        Number of instruments to return.
    :return instruments: List
        A list of musical instruments.
    """
    return libraries.get_one(instruments)
Beispiel #13
0
def get_size(size_type):
    """
    Generate a synonym for a given size.
    :param size_type: string
        Size required: small, medium or large.
    :return: string
        A  random synonym for the size given.
    """
    size = libraries.get_one(sizes[size_type.lower()])
    return size
Beispiel #14
0
def get_color(hue=None, shade=False):
    """
    Generates a random colour.
    :param hue: string
        The colour family to choose from.
    :param shade: bool
        Whether or not to tint the colour.
    :return: string
        A randomised colour.
    """
    if hue is None:
        color_range = colors.keys()
        color_range.remove('fictional')
        color = libraries.get_one(color_range)

    else:
        color = libraries.get_one(colors[hue.lower()])

    if shade is True:
        color = '{} {}'.format(get_shade(), color)
    return color
Beispiel #15
0
def get_prompt():
    """
    Get a sketchbook prompt from weekday.txt
    :return: string
        A random sketchbook prompt
    """
    fn = os.path.join(os.path.dirname(__file__), 'weekday.txt')
    with open(fn, 'r') as f:
        for line in f:
            if line.startswith('#') or len(line.strip()) == 0:
                pass
            else:
                sketchbook_prompts.append(line.strip())

        return libraries.get_one(sketchbook_prompts)
Beispiel #16
0
def get_animal(animal_type):
    """
    Returns a single animal of the required type.
    :param animal_type: List or string
        Which animals to include in the selection.
    :return animal_list: string
        A single animal of the required type.
    """
    try:

        family = animals[animal_type.lower()]

    except KeyError:
        family = [get_menagerie('all', num=1)]

    return libraries.get_one(family)
Beispiel #17
0
def get_menagerie(animal_type, num=3):
    """
    Returns a list of animals of the given type.
    :param animal_type: List or string
        Which animals to include in the selection.
    :param num: int
        Number of animals to return.
    :return animal_list: List
        A list of animals of the required type.
    """
    animal_list = ()

    if animal_type is 'all':
        animal_type = [
            'mammal',
            'bird',
            'fish',
            'reptile',
            'insect',
        ]

    try:

        animal_list += animals[animal_type]

    except TypeError:
        for family in animal_type:
            animal_list += animals[family]
    except KeyError:
        return get_menagerie('all', num=num)

    menagerie = set()

    while len(menagerie) < num:
        menagerie.add(libraries.get_one(animal_list))

    if num == 1:
        return list(menagerie)[0]
    else:
        return list(menagerie)
Beispiel #18
0
def get_feeling():
    """

    :return:
    """
    return libraries.get_one(feelings_of)