def is_conjugation_correct(temp, mode, verb): # User input inflections = [] items = sorted(request.form.items()) for item in items: if 'conjugation' in item[0]: inflections.append(item[1]) is_correct, corrections = Verbs.is_conjugation_correct(temp, mode, verb, inflections) session['conjugation_result'] = {'is_correct': is_correct, 'corrections':corrections, 'inflections': inflections } return redirect(url_for('conjugation_result', temp = temp, verb = verb, mode = mode))
def conjugation_result(temp, mode, verb): is_correct = False result = None if session.has_key('conjugation_result'): result = session.get('conjugation_result') if result and result['is_correct']: return render_template('conjugation_result_right.html', temp = temp, mode = mode, verb = verb) pronouns = Verbs.get_verb_pronouns(verb) return render_template('conjugation_result_wrong.html', result = result, pronouns = pronouns, temp = temp, mode = mode, verb = verb, count = range(len(pronouns)))
def conjugate(temp, mode): verb = Verbs.get_random_verb(temp, mode) pronouns = Verbs.get_verb_pronouns(verb['_id']) return render_template('conjugate.html', temp = temp, mode = mode, verb = verb['_id'], pronouns = pronouns)
PROMPT = '> ' ## First, set up the world map world_map = world.World() world_map.load_rooms(data.map_rooms) world_map.load_connections(data.map_connections) world_map.set_current_room('stockton-home') ## Set up the world state world_state = state.State() world_state.set_funds(100) world_state.set_world_map(world_map) ## set up the parsing engine verbs = Verbs() def tokenize_command(command): # Take a command and turn it into a list of tokens. As an # example, it will turn "go south " into ['go', 'south'] command = ' '.join(command.split()) return command.split(' ') def read_input(tokenize): # Read in a set of commands from the prompt. There can be # multiple commands per line separated by ';'. This is the only # place that will read input for the user. If tokenize is True, # it will return a list of lowercase tokens that can be parsed # individually. As an example, it could return: [['take',
import spotipy.util as util from localSecret import CLIENT_ID,CLIENT_SECRET client_id = CLIENT_ID client_secret = CLIENT_SECRET redirect_uri= "https://localhost/fake2718:8080" username = USERNAME scopesList = ['user-read-currently-playing' ,'user-modify-playback-state' ,'user-read-playback-state'] scopes = ' '.join(scopesList) token = util.prompt_for_user_token(username,scopes,client_id,client_secret,redirect_uri,show_dialog=True) #Blessed initalization term = Terminal() reqVerbs = Verbs(token) tui = TUI(term,reqVerbs) def getCurrSongNameArtist(json): song = json['item']['name'] artists = [elem['name'] for elem in json['item']['artists']] artists = '/'.join(artists) songInfo = "{} - {}".format(song,artists) return songInfo while(True):