def test_teens(): assert spell(10) == 'ten' assert spell(11) == 'eleven' assert spell(12) == 'twelve' assert spell(13) == 'thirteen' assert spell(14) == 'fourteen' assert spell(15) == 'fifteen' assert spell(16) == 'sixteen' assert spell(17) == 'seventeen' assert spell(18) == 'eighteen' assert spell(19) == 'nineteen'
def test_single_digits(): assert spell(0) == 'zero' assert spell(1) == 'one' assert spell(2) == 'two' assert spell(3) == 'three' assert spell(4) == 'four' assert spell(5) == 'five' assert spell(6) == 'six' assert spell(7) == 'seven' assert spell(8) == 'eight' assert spell(9) == 'nine'
def execute_os_command(self, user_input_phrase=None, voice=False): if voice: user_input_phrase = voice_input() for i in self.command_keywords_pair: command = i[0] keywords_list = i[1] final_phrase = i[2] for keyword in keywords_list: if user_input_phrase and keyword in user_input_phrase: spell(final_phrase) os.system(command)
def test_thousands(): assert spell(1000) == 'one thousand' assert spell(1001) == 'one thousand and one' assert spell(1010) == 'one thousand and ten' assert spell(1500) == 'one thousand five hundred' assert spell(1520) == 'one thousand five hundred and twenty' assert spell(1525) == 'one thousand five hundred and twenty five' assert spell(10000) == 'ten thousand' assert spell(15432) == 'fifteen thousand four hundred and thirty two' assert spell(99999) == 'ninety nine thousand nine hundred and ninety nine'
def test_hundreds(): assert spell(100) == 'one hundred' assert spell(101) == 'one hundred and one' assert spell(117) == 'one hundred and seventeen' assert spell(500) == 'five hundred' assert spell(523) == 'five hundred and twenty three' assert spell(999) == 'nine hundred and ninety nine'
def get_annotation_for_key(key): grefexp = json.loads(conn.get(key)) anno_key = 'coco2014_anno_{}'.format(grefexp['annotation_id']) anno = json.loads(conn.get(anno_key)) img_key = 'coco2014_img_{}'.format(anno['image_id']) img_meta = json.loads(conn.get(img_key)) jpg_data = open(os.path.join(DATA_DIR, img_meta['filename'])).read() x0, y0, width, height = anno['bbox'] box = (x0, x0 + width, y0, y0 + height) texts = [g['raw'] for g in grefexp['refexps']] texts = [spell(strip(t, strip_end=False)) for t in texts] category = categories[anno['category_id']] return jpg_data, box, texts
def __init__(self, comic_name, start_chap, end_chap): #check if the spelling of manga is right s = spell.spell(comic_name.replace('_', ' ')) self.comic_name = s.correct() self.start_chap = start_chap self.end_chap = end_chap self.current_chap = start_chap self.base_url = 'http://www.mangapanda.com/' #create a new directory if not os.path.exists('download/'+self.comic_name): os.makedirs('download/'+self.comic_name) #change cwd to path os.chdir('download/'+self.comic_name) self.comic_path = self.comic_name.replace(' ', '-')
def __init__(self, comic_name, start_chap, end_chap): #check if the spelling of manga is right s = spell.spell(comic_name.replace('_', ' ')) self.comic_name = s.correct() self.start_chap = start_chap self.end_chap = end_chap self.current_chap = start_chap self.base_url = 'http://www.mangapanda.com/' #create a new directory if not os.path.exists('download/' + self.comic_name): os.makedirs('download/' + self.comic_name) #change cwd to path os.chdir('download/' + self.comic_name) self.comic_path = self.comic_name.replace(' ', '-')
def prepare_spell(caster, spell=None): """Makes a new spell ready to be used""" sacrifice = spell._sacrifice if caster.sacrifice(sacrifice): caster.library.add(spell(owner=caster))
def test_millions(): assert spell(1000000) == 'one million' assert spell(1000001) == 'one million and one' assert spell( 9876543 ) == 'nine million eight hundred and seventy six thousand five hundred and forty three'
def test_tens(): assert spell(20) == 'twenty' assert spell(21) == 'twenty one' assert spell(30) == 'thirty' assert spell(55) == 'fifty five' assert spell(99) == 'ninety nine'
def ajax_req(): print("spell called") username = request.form['username'] username = spell.spell(username) return jsonify(username=username)
keywords_list = i[1] print(command + '=' + str(keywords_list)) def execute_os_command(self, user_input_phrase=None, voice=False): if voice: user_input_phrase = voice_input() for i in self.command_keywords_pair: command = i[0] keywords_list = i[1] final_phrase = i[2] for keyword in keywords_list: if user_input_phrase and keyword in user_input_phrase: spell(final_phrase) os.system(command) ob = CommandAndKeywords() ob.add_new_command('taskmgr.exe', ['task manager', 'system monitor'], final_phrase='Opening Task Manager') ob.add_new_command('explorer.exe', ['explorer', 'file manager', 'my files'], final_phrase='Starting File Explorer') if __name__ == '__main__': ob1 = CommandAndKeywords() ob1.show_all_commands() spell("I am ready for the command") while 1: ob1.execute_os_command(voice=True)