Best Python code snippet using localstack_python
brainstem.py
Source:brainstem.py  
...21        BestfriendBirthday_date,host_ip,tts_pico2wave_wav,tts_main_wav,tts_BestfriendBirthdayALERT_wav,\22        googleCalendarTTS_path,conversationTTS_path,date_timeTTS_path,greetingTTS_path,internetTTS_path,jokes_quoteTTS_path,noteManuallyTTS_path,notesTTS_path,rhythmbox_client_ControllerTTS_path,weatherTTS_path,youtubeTTS_path,FBloginTTS_path,Gcreate_accountTTS_path,GloginTTS_path,twitterloginTTS_path,AI_TTS_path,PrimaryCredentialsTTS_path,appManagerTTS_path,infoSenderTTS_path,systemTaskTTS_path,updateSystemTTS_path,volumeControllerTTS_path23        24        ):25    def check_message(check):26        """27         This function checks if the items in the list (specified in28        argument) are present in the user's input speech.29         """30        words_of_message = voice_text.split()31        if set(check).issubset(set(words_of_message)):32            return True33        else:34            return False35    if check_message(['what','do', 'have']) or check_message(['what','do', 'have','plans']) or check_message(['whats','schedule']) or check_message(['what\'s','schedule'])\36        or check_message(['do','have','anything']) or check_message(['what','day','look']) or check_message(['do','plans']) or check_message(['do','events']) or check_message(['do','event'])\37        or check_message(['any','plans']) or check_message(['any','plan']):38        googleCalender.main(voice_text, accept_path)39    elif check_message(['show','events','three','days']) or check_message(['show','event','three','days']) \40        or check_message(['show','events','three','day']) or check_message(['show','event','three','day'])\41        or check_message(['show','events','3','days']) or check_message(['show','event','3','days'])\42        or check_message(['show','events','3','day']) or check_message(['show','event','3','day']):43        gcal_threedays.threedays(accept_path)44    elif check_message(['show','events','five','days']) or check_message(['show','event','five','days']) \45        or check_message(['show','events','five','day']) or check_message(['show','event','five','day'])\46        or check_message(['show','events','5','days']) or check_message(['show','event','5','days'])\47        or check_message(['show','events','5','day']) or check_message(['show','event','5','day']):48        gcal_fivedays.fivedays(accept_path)49    elif check_message(['show','events','seven','days']) or check_message(['show','event','seven','days']) \50        or check_message(['show','events','seven','day']) or check_message(['show','event','seven','day'])\51        or check_message(['show','events','7','days']) or check_message(['show','event','7','days'])\52        or check_message(['show','events','7','day']) or check_message(['show','event','7','day'])\53        or check_message(['show','events','week']) or check_message(['show','event','week']):54        gcal_sevendays.sevendays(accept_path)55    elif check_message(['show','events','ten','days']) or check_message(['show','event','ten','days']) \56        or check_message(['show','events','ten','day']) or check_message(['show','event','ten','day'])\57        or check_message(['show','events','10','days']) or check_message(['show','event','10','days'])\58        or check_message(['show','events','10','day']) or check_message(['show','event','10','day']):59        gcal_tendays.tendays(accept_path)60    elif check_message(['show','events','fifteen','days']) or check_message(['show','event','fifteen', 'days']) \61        or check_message(['show','events','fifteen','day']) or check_message(['show','event','fifteen','day'])\62        or check_message(['show','events','15','days']) or check_message(['show','event','15','days'])\63        or check_message(['show','events','15','day']) or check_message(['show','event','15','day']):64        gcal_fifteendays.fifteendays(accept_path)65    elif check_message(['show','events','twenty', 'five','days']) or check_message(['show','event','twenty', 'five','days']) \66        or check_message(['show','events','twenty', 'five','day']) or check_message(['show','event','twenty', 'five','day'])\67        or check_message(['show','events','25','days']) or check_message(['show','event','25','days'])\68        or check_message(['show','events','25','day']) or check_message(['show','event','25','day']):69        gcal_twentyfivedays.twentyfivedays(accept_path)70    elif check_message(['show','events','twenty','days']) or check_message(['show','event','twenty','days']) \71        or check_message(['show','events','twenty','day']) or check_message(['show','event','twenty','day'])\72        or check_message(['show','events','20','days']) or check_message(['show','event','20','days'])\73        or check_message(['show','events','20','day']) or check_message(['show','event','20','day']):74        gcal_twentydays.twentydays(accept_path)75    elif check_message(['show','events','thirty','days']) or check_message(['show','event','thirty','days']) \76        or check_message(['show','events','thirty','day']) or check_message(['show','event','thirty','day'])\77        or check_message(['show','events','30','days']) or check_message(['show','event','30','days'])\78        or check_message(['show','events','30','day']) or check_message(['show','event','30','day'])\79        or check_message(['show','events','one','month']) or check_message(['show','event','one','month']):80        gcal_thirtydays.thirtydays(accept_path)81    elif check_message['show','upcoming','events'] or check_message['show','upcoming','event']:82        ten_gcalUpcomingEvents.get_upcomingEvents(accept_path)83    elif check_message(['what','date']) or check_message(['whats','date']) or check_message(['tell', 'date']): #error84        date_time.date(accept_path)85    elif check_message(['what', 'time']) or check_message(['whats', 'time']) or check_message(['tell', 'time']): #error86        date_time.currenttime(accept_path)87    elif check_message(['good','morning']) or check_message(['good','afternoon']) or check_message(['good','evening']) or\88        check_message(['good','night']):89        greeting.Greeting(accept_path)90    elif check_message(['i','going','out']) or check_message(['see','you','later']) or check_message(['see','you','soon']) \91        or check_message(['bye','see','you'])  or check_message(['see','you']):92        greeting.imgoingout(accept_path)93        94    elif check_message(['search', 'google']) or check_message(['on', 'google']):95        internet.google(voice_text, accept_path)96    elif check_message(['show', 'picture']) or check_message(['search', 'picture'])\97         or check_message(['show', 'pictures']) or check_message(['search', 'pictures']):98        internet.search_pics(voice_text, accept_path)99    elif check_message(['internet']):100        internet.askinternet(voice_text, accept_path)101    elif check_message(['open']):102        internet.open_website(voice_text, accept_path)103    elif check_message(['where','is']) or check_message(['show','me','location']) or check_message(['find', 'place', 'name']):104        internet.location(voice_text, accept_path)105    elif check_message(['what','net', 'speed']) or check_message(['whats', 'net', 'speed']):106        internet.netspeed(accept_path)107    elif check_message(['tell', 'joke']) or check_message(['jokes']):108        jokes_quote.tell_joke(accept_path)109    elif check_message(['tell','quote']) or check_message(['what','day','quote']) or check_message(['whats','day','quote']):110        jokes_quote.quote(accept_path)111    #elif check_message(['news']):112        #news.113    elif check_message(['write','something']):114        noteManually.note_manually(accept_path, noteManually_txt)115    elif check_message(['read','notes']) or check_message(['read','note']):116        noteManually.readNote_manually(accept_path, noteManually_txt)117    elif check_message(['note', 'something']) or check_message(['take', 'note']) or check_message(['note','down'])\118         or check_message(['write','something']):119        notes.note_something(voice_text, accept_path, memory_db)120    elif check_message(['show','note']) or check_message(['look', 'note']) or check_message(['show', 'notes']):121        notes.show_all_notes(accept_path, memory_db)122    elif check_message(['play', 'song']) or check_message(['pause']) or check_message(['toggle','song']):123        rhythmbox_client_Controller.toggle(accept_path)124    elif check_message(['stop']):125        rhythmbox_client_Controller.stop(accept_path)126    elif check_message(['next']):127        rhythmbox_client_Controller.next(accept_path)128    elif check_message(['previous']):129        rhythmbox_client_Controller.previous(accept_path)130    elif check_message(['what','playing']):131        rhythmbox_client_Controller.printplaying(accept_path)132    elif check_message(['repeat']):133        rhythmbox_client_Controller.repeat(accept_path)134    elif check_message(['stop','repeat']):135        rhythmbox_client_Controller.norepeat(accept_path)136    elif check_message(['shuffle']):137        rhythmbox_client_Controller.shuffle(accept_path)138    elif check_message(['stop','shuffle']):139        rhythmbox_client_Controller.noshuffle(accept_path)140    elif check_message(['tell', 'weather']) or check_message(['give','details','weather']) or\141        check_message(['whats','weather']) or check_message(['give','detail','weather']) :142        weather.weather_DefaultCity(default_CityLocation, openweatherAPI, accept_path)143    elif check_message(['how', 'weather','in']) or check_message(['whats','weather']):144        weather.weather(openweatherAPI, accept_path)145    elif check_message(['youtube','play']) or check_message(['make','youtube','play']) or \146        check_message(['tell','youtube','play']):147        youtube.playFirstVid(voice_text, accept_path)148    elif check_message(['youtube','search']) or check_message(['make','youtube','search']) or check_message(['tell','youtube','search']):149        youtube.searchVid(voice_text, accept_path)150        151    152    elif check_message(['login','facebook']) or check_message(['open','facebook']):153        FBlogin.login(accept_path, chromeDriver_linux)154    #elif check_message(['send','mail']) or check_message(['compose','mail']) or check_message(['create','gmail','enviroment']):155        #Gcompose.compose(accept_path)156    elif check_message(['create','gmail']) or check_message(['create', 'random','account']):157        Gcreate_account.createRandomAc(accept_path, chromeDriver_linux)158    elif check_message(['login','gmail']) or check_message(['open','personal','gmail']) or check_message(['show','my','mails']):159        Glogin.PersonalMail(accept_path, chromeDriver_linux) 160    elif check_message(['login','youtube','gmail']) or check_message(['open','youtube','gmail']) or check_message(['show','youtube','mails']):161        Glogin.YoutubeMail(accept_path, chromeDriver_linux) 162    elif check_message(['login','twitter']) or check_message(['open', 'twitter','account']):163        twitterlogin.login(accept_path, chromeDriver_linux)164   165    elif check_message(['send','details' ,'citizenship']) or check_message(['send','detail' ,'citizenship'])\166         or check_message(['give','details' ,'citizenship']) or check_message(['give','detail' ,'citizenship'])\167         or check_message(['provide','details' ,'citizenship']) or check_message(['provide','detail' ,'citizenship']):168        infoSender.citizenshipInfo(main_sender, main_passwd, receiver, accept_path)169    elif check_message(['send','folder','lock', 'password']) or check_message(['give','folder','lock', 'password'])\170         or check_message(['provide','folder','lock','password']):171        infoSender.folderlockpassInfo(main_sender, main_passwd, receiver, accept_path)172    elif check_message(['send','details','other', 'internet']) or check_message(['send','detail','other', 'internet'])\173         or check_message(['give','details','other', 'internet']) or check_message(['give','detail','other', 'internet'])\174         or check_message(['provide','details','other', 'internet']) or check_message(['provide','detail','other', 'internet']):175        infoSender.internetAccInfo(main_sender, main_passwd, receiver, accept_path)176    elif check_message(['send','others','gmail']) or check_message(['send','other','gmail'])\177         or check_message(['give','others','gmail']) or check_message(['give','other','gmail'])\178         or check_message(['provide','others','gmail']) or check_message(['provide','other','gmail']):179        infoSender.othersGmailInfo(main_sender, main_passwd, receiver, accept_path)180    elif check_message(['send', 'password','gmail']) or check_message(['send','code','gmail'])\181         or check_message(['give', 'password','gmail']) or check_message(['give','code','gmail'])\182         or check_message(['provide', 'password','gmail']) or check_message(['provide','code','gmail']):183        infoSender.PasswordGmailInfo(main_sender, main_passwd, receiver, accept_path)184    elif check_message(['send', 'details', 'payeer']) or check_message(['send', 'detail', 'payeer'])\185         or check_message(['give', 'details', 'payeer']) or check_message(['give', 'detail', 'payeer'])\186         or check_message(['provide', 'details', 'payeer']) or check_message(['provide', 'detail', 'payeer']):187        infoSender.payeerInfo(main_sender, main_passwd, receiver, accept_path)188    elif check_message(['send','details', 'payoneer', 'account']) or check_message(['send','detail', 'payoneer', 'account'])\189         or check_message(['give','details', 'payoneer', 'account']) or check_message(['give','detail', 'payoneer', 'account'])\190         or check_message(['provide','details', 'payoneer', 'account']) or check_message(['provide','detail', 'payoneer', 'account']):191        infoSender.payoneerInfo(main_sender, main_passwd, receiver, accept_path)192    elif check_message(['send','code','personal','gmail']) or check_message(['send','password','personal','gmail'])\193         or check_message(['send','codes','personal','gmail'])\194         or check_message(['give','code','personal','gmail']) or check_message(['give','password','personal','gmail'])\195         or check_message(['give','codes','personal','gmail'])\196         or check_message(['provide','code','personal','gmail']) or check_message(['provide','password','personal','gmail'])\197         or check_message(['provide','codes','personal','gmail']):198        infoSender.backupGmailCodeInfo(main_sender, main_passwd, receiver, accept_path)199    elif check_message(['send','details','personal','gmail']) or check_message(['send','detail','personal','gmail'])\200         or check_message(['give','details','personal','gmail']) or check_message(['give','detail','personal','gmail'])\201         or check_message(['provide','details','personal','gmail']) or check_message(['provide','detail','personal','gmail']):202        infoSender.personalGmailInfo(main_sender, main_passwd, receiver, accept_path)203    elif check_message(['send', 'details', 'twillio']) or check_message(['send', 'details', 'twillio'])\204         or check_message(['give', 'details', 'twillio']) or check_message(['give', 'details', 'twillio'])\205         or check_message(['provide', 'details', 'twillio']) or check_message(['provide', 'details', 'twillio']):206        infoSender.twillioinfo(main_sender, main_passwd, receiver, accept_path)207    elif check_message(['screen', 'off']):208        systemTask.screen_off__LINUX(accept_path)209    elif check_message(['display', 'information', 'operating','system']) or check_message(['details', 'system']):210        systemTask.Os__LINUX(accept_path)211    elif check_message(['shutdown','system']):212        systemTask.shutdown_LINUX(accept_path)213    elif check_message(['reboot','system']):214        systemTask.reboot_LINUX(accept_path)215    elif check_message(['hibernate','system']):216        systemTask.hibernate_LINUX(accept_path)217    elif check_message(['hybrid', 'sleep','system']):218        systemTask.hybridsleep_LINUX(accept_path)219    elif check_message(['suspend','system']):220        systemTask.suspend_LINUX(accept_path)221    elif check_message(['update','system']):222        updateSystem.update_system(accept_path)223    elif check_message(['close','chrome']) or check_message(['close','browser']) or check_message(['terminate','chrome'])\224        or check_message(['kill','browser']) or check_message(['kill','chrome']):225        appManager.chromeClose(accept_path)226    elif check_message(['launch','chrome']) or check_message(['launch','browser']):227        appManager.chromeOpen(accept_path)228    elif check_message(['close','code']) or check_message(['close','visual','studio']) or check_message(['terminate','visual','studio'])\229         or check_message(['kill','code']) or check_message(['kill','visual','studio']): 230        appManager.codeClose(accept_path)231    elif check_message(['launch','code']) or check_message(['launch','visual','studio']):232        appManager.codeOpen(accept_path)233    elif check_message(['close','files']) or check_message(['close','file']) or check_message(['terminate','files']) or check_message(['terminate','file'])\234         or check_message(['kill','files']) or check_message(['kill','file']):235        appManager.filesClose(accept_path)236    elif check_message(['launch','files']) or check_message(['launch','file']):237        appManager.filesOpen(accept_path)238    elif check_message(['close','firefox']) or check_message(['terminate','firefox']) or check_message(['kill','firefox']):239        appManager.firefoxClose(accept_path)240    elif check_message(['launch','firefox']):241        appManager.firefoxOpen(accept_path)242    elif check_message(['close','terminal']) or check_message(['terminate','terminal']) or check_message(['kill','terminal']):243        appManager.terminalClose(accept_path) 244    elif check_message(['launch','terminal']):245        appManager.terminalOpen(accept_path) 246    elif check_message(['volume', '100', 'percent']) or check_message(['volume', 'hundred', 'percent'])\247        or check_message(['volume', '100']) or check_message(['volume', 'hundred']) or check_message(['volume','100%']):248        volumeController.volume100__Linux(accept_path)249    elif check_message(['volume', '90', 'percent']) or check_message(['volume', 'ninety', 'percent'])\250        or check_message(['volume', '90']) or check_message(['volume', 'ninety']) or check_message(['volume','90%']):251        volumeController.volume90__Linux(accept_path)252    elif check_message(['volume', '80', 'percent']) or check_message(['volume', 'eighty', 'percent'])\253        or check_message(['volume', '80']) or check_message(['volume', 'eighty']) or check_message(['volume','80%']):254        volumeController.volume80__Linux(accept_path)255    elif check_message(['volume', '70', 'percent']) or check_message(['volume', 'seventy', 'percent'])\256        or check_message(['volume', '70']) or check_message(['volume', 'seventy']) or check_message(['volume','70%']):257        volumeController.volume70__Linux(accept_path)258    elif check_message(['volume', '60', 'percent']) or check_message(['volume', 'sixty', 'percent'])\259        or check_message(['volume', '60']) or check_message(['volume', 'sixty']) or check_message(['volume','60%']):260        volumeController.volume60__Linux(accept_path)261    elif check_message(['volume', '50', 'percent']) or check_message(['volume', 'fifty', 'percent'])\262        or check_message(['volume', '50']) or check_message(['volume', 'fifty']) or check_message(['volume','50%']):263        volumeController.volume50__Linux(accept_path)264    elif check_message(['volume', '40', 'percent']) or check_message(['volume', 'fourty', 'percent'])\265        or check_message(['volume', '40']) or check_message(['volume', 'fourty']) or check_message(['volume','40%']):266        volumeController.volume40__Linux(accept_path)267    elif check_message(['volume', '30', 'percent']) or check_message(['volume', 'thirty', 'percent'])\268        or check_message(['volume', '30']) or check_message(['volume', 'thirty']) or check_message(['volume','30%']):269        volumeController.volume30__Linux(accept_path)270    elif check_message(['volume', '20', 'percent']) or check_message(['volume', 'twenty', 'percent'])\271        or check_message(['volume', '20']) or check_message(['volume', 'twenty']) or check_message(['volume','20%']):272        volumeController.volume20__Linux(accept_path)273    elif check_message(['volume', '10', 'percent']) or check_message(['volume', 'ten', 'percent'])\274        or  check_message(['volume', '10']) or check_message(['volume', 'ten']) or check_message(['volume','10%']):275        volumeController.volume10__Linux(accept_path)276    elif check_message(['volume', 'mute']) or check_message(['volume', '0', 'percent'])\277        or check_message(['volume', 'zero', 'percent'])\278        or check_message(['volume', 'mute']) or check_message(['volume', '0'])\279        or check_message(['volume', 'zero']) or check_message(['volume','0%']):280        volumeController.volumeMute__Linux(accept_path)281    #elif check_message(['what','current','volume']): #not working282        #volumeController.getCurrentVol__linux(accept_path)283    284    elif check_message(['milestone']) or check_message(['What','milestone','life']):285        conversation.milestone(accept_path)286    elif check_message(['what', 'things','do']) or check_message(['what','can','do']):287        conversation.whatthingcando(slave_sender, slave_passwd, accept_path)288    elif check_message(['daddy\'s', 'home']) or check_message(['i', 'home']) or check_message(['daddys', 'home']):289        conversation.welcome(accept_path)290    elif check_message(['baby']) or check_message(['auntie']) or check_message(['aunty']) or check_message(['online']) or check_message(['buddy']):291        conversation.online(accept_path)292    elif check_message(['who', 'are', 'you']): 293        conversation.who_are_you(accept_path)294    elif check_message(['how', 'i', 'look']) or check_message(['how', 'am', 'i']):295        conversation.how_am_i(accept_path)296    elif check_message(['where', 'born']): #error297        conversation.where_born(accept_path)298    elif check_message(['why','exist']) or check_message(['why','here']): #error299        conversation.why_born(accept_path)300    elif check_message(['how', 'you']):301        conversation.how_are_you(accept_path)302    elif check_message(['what', 'age']) or check_message(['what\'s', 'age']):303        conversation.how_old_are_you(accept_path)304    elif check_message(['who', 'master']) or check_message(['who','coded','you']):305        conversation.who_made(accept_path)306    elif check_message(['what', 'doing']):307        conversation.what_doing(accept_path)308    elif check_message(['say', 'her']) or check_message(['greet','her']) or check_message(['welcome','her']):309        conversation.greet_her(accept_path)310    elif check_message(['say', 'him']) or check_message(['greet','him']) or check_message(['welcome','him']):311        conversation.greet_him(accept_path)312    elif check_message(['say', 'them']) or check_message(['greet','them']) or check_message(['welcome','them']):313        conversation.greet_them(accept_path)314    elif check_message(['wait']) or check_message(['waiting','for']):315        conversation.wait(accept_path)316    elif check_message(['thank','you']):317        conversation.thank_you(accept_path)318    elif check_message(['love', 'you']):319        conversation.love_you(accept_path)320    elif check_message(['are', 'tired']):321        conversation.tired(accept_path)322    elif check_message(['are', 'smart']):323        conversation.smart(accept_path)324    elif check_message(['are', 'tall']):325        conversation.tall(accept_path)326    elif check_message(['which', 'eye', 'color']) or check_message(['which', 'eyes', 'color']):327        conversation.coloreye(accept_path)328    elif check_message(['do','believe', 'ghost']):329        conversation.believeghost(accept_path)330    elif check_message(['be','ghost']) or check_message(['behave','ghost']) or check_message(['scare','me']) or check_message(['scare','them']):331        conversation.ghost(accept_path)332    elif check_message(['just','wanted','say', 'hi']):333        conversation.wantedtosayi(accept_path)334    elif check_message(['you', 'are', 'welcome']) or check_message(['you\'re','welcome']):335        conversation.urwelcome(accept_path)336    elif check_message(['you','are','beautiful']):337        conversation.urbeautiful(accept_path)338    elif check_message(['you','are','hot']):339        conversation.urhot(accept_path)340    elif check_message(['am','i', 'hot']): #error341        conversation.amihot(accept_path)342    elif check_message(['am','i', 'cool']): #error343        conversation.amicool(accept_path)344    elif check_message(['am','i', 'good','person']):345        conversation.amigoodperson(accept_path)346    elif check_message(['what','do','think','me']): 347        conversation.whatyouthinkme(accept_path)348    elif check_message(['do','you','love','me']):349        conversation.douloveme(accept_path)350    elif check_message(['you','are','best']):351        conversation.urbest(accept_path)352    elif check_message(['i','like','talking', 'you']):353        conversation.iliketalkingwithu(accept_path)354    elif check_message(['shall','we','best', 'friend']) or check_message(['will','you','best', 'friend']):355        conversation.shallbebestfriend(accept_path)356    elif check_message(['tell','secret']):357        conversation.tellsecret(accept_path)358    elif check_message(['first','crush']):359        conversation.firstcrush(accept_path)360    elif check_message(['i' ,'transferring', 'you']) or check_message(['i' ,'transferring', 'dismiss']): #error361        conversation.transferingDismis(accept_path)362    elif check_message(['laugh']) or check_message(['can','laugh']):363        conversation.dismisLaugh(accept_path, laughSound1, laughSound2)364    #elif check_message(['which', 'service','control', 'alert','1']) or check_message(['which', 'service','control', 'alert','one']):365    #    conversation.alert1(accept_path)366    #elif check_message(['which', 'service','control', 'alert','2']) or check_message(['which', 'service','control', 'alert','two']):367    #    conversation.alert2(accept_path)368    #elif check_message(['which', 'service','control', 'alert','3']) or check_message(['which', 'service','control', 'alert','three']):369    #    conversation.alert3(accept_path)370    #elif check_message(['which', 'service','control', 'alert','4']) or check_message(['which', 'service','control', 'alert','four']):371    #    conversation.alert4(accept_path)372    else:373        os.system('mpg123 ' + else_path)374        #""" Ping google.com """ 375        #from urllib.request import urlopen376        #try:377        #    response = urlopen('https://www.google.com/', timeout=10)378        #    print('--- ONLINE! ---')379        #    # run() returns a CompletedProcess object if it was successful380        #    # errors in the created process are raised here too381        #    process = subprocess.run('perl SystemService/currentVol_perl.pl 0', shell=True, check=True, stdout=subprocess.PIPE, universal_newlines=True)382        #    PrevVolLevel = process.stdout383        #    print("***\nThe Previous Volume Level is: " + PrevVolLevel + "***")384        #    print(' ')...test_amcatnlo.py
Source:test_amcatnlo.py  
...51        log.setLevel(logging.CRITICAL)52        for handler in log.handlers: 53            log.removeHandler(handler)54        log.addHandler(handler_stream)55        def check_message(line):56            """return False if not warning is raised, return True is a warning is raised"""57            58            stream.seek(0)59            stream.truncate(0)60            myprocdef = interface.extract_process(line)61            try: 62                interface.proc_validity(myprocdef,'aMCatNLO_all')63            except Exception as error:64                if '1804.10017' in str(error):65                    raise MGerror66            text = stream.getvalue()67            if '1804.10017' in text:68                return True69            else:70                return False71        # force the option to not by bypassed72        interface.options['acknowledged_v3.1_syntax'] = False73        # check case where the code crash74        self.assertRaises(MGerror, check_message, "p p > t t~ QED=1 [QED]")75        self.assertRaises(MGerror,check_message, "p p > t t~ QCD=1 [QED QCD]")76        # check case where the code write a warning (critical level)77        self.assertRaises(MGerror, check_message, "p p > t t~ QED=1 [QCD]")78        self.assertRaises(MGerror, check_message, "p p > t t~ QCD=1 QED=0 [QCD]")79        self.assertRaises(MGerror, check_message, "p p > t t~ QED=98 [QCD]")80        self.assertRaises(MGerror, check_message, "p p > t t~ QED=99 QCD=1 [QCD]")81        # check case where the code does not complain82        self.assertFalse(check_message("p p > t t~ QED=0 [QCD]"))83        self.assertFalse(check_message("p p > t t~ / z QCD=0 [QCD]"))84        self.assertFalse(check_message("p p > t t~ QCD=1 QED^2==2 [QCD]"))85        self.assertFalse(check_message("p p > w+ w- QED=99 [QCD]"))86        self.assertFalse(check_message("p p > w+ w- j j $ h QED<=99 [QCD]"))87        # force the option to not  be by bypassed88        interface.options['acknowledged_v3.1_syntax'] = True 89        # and check that no crash/warning is raised anymore90        self.assertFalse(check_message( "p p > t t~ QED=1 [QED]"))91        self.assertFalse(check_message( "p p > t t~ QCD=1 [QED QCD]"))92        self.assertFalse(check_message("p p > t t~ QED=1 [QCD]"))93        self.assertFalse(check_message("p p > t t~ QCD=1 QED=0 [QCD]"))94        self.assertFalse(check_message("p p > t t~ QED=98 [QCD]"))...brain.py
Source:brain.py  
...15    :param access_token:16    :param access_token_secret:17    :return:18    """19    def check_message(check):20        """21        This function checks if the items in the list (specified in22        argument) are present in the user's input speech.23        :param check:24        :return:25        """26        words_of_message = speech_text.split()27        # change all words to lower text for case insensitive matching28        words_of_message[:] = [word.lower() for word in words_of_message]29        if set(check).issubset(set(words_of_message)):30            return True31        else:32            return False33    # TODO Externalize properties to config file34    wake_up_word = 'ria'35    riaId = 136    if check_message([wake_up_word, 'who', 'are', 'you']) or check_message([wake_up_word, "what's", 'your', 'name']):37        general_conversations.who_are_you()38    elif check_message([wake_up_word, 'how', 'i', 'look']) or check_message([wake_up_word, 'how', 'am', 'i']):39        general_conversations.how_am_i()40    elif check_message([wake_up_word, 'tell', 'joke']):41        general_conversations.tell_joke()42    elif check_message([wake_up_word, 'who', 'am', 'i']):43        general_conversations.who_am_i(name)44    elif check_message([wake_up_word, 'where', 'born']):45        general_conversations.where_born()46    elif check_message([wake_up_word, 'how', 'are', 'you']):47        general_conversations.how_are_you()48    elif check_message([wake_up_word, 'time']):49        tell_time.what_is_time()50    elif check_message([wake_up_word, 'how', 'weather']) or \51            check_message([wake_up_word, 'how\'s', 'weather']) or \52            check_message([wake_up_word, 'what', 'weather']):53        weather.weather(city_name, city_zip)54    elif check_message([wake_up_word, 'define']):55        define_subject.define_subject(speech_text)56    elif check_message([wake_up_word, 'news']):57        news_reader.news_reader()58    elif check_message([wake_up_word, 'open', 'firefox']):59        open_firefox.open_firefox()60    elif check_message([wake_up_word, 'play', 'music']) or check_message(['music']):61        play_music.play_random(music_path)62    elif check_message([wake_up_word, 'play']):63        play_music.play_specific_music(speech_text, music_path)64    elif check_message([wake_up_word, 'party', 'time']) or check_message(['party', 'mix']):65        play_music.play_shuffle(music_path)66    elif check_message([wake_up_word, 'note']):67        notes.note_something(speech_text)68    elif check_message([wake_up_word, 'all', 'notes']) or check_message(['notes']):69        notes.show_all_notes()70    elif check_message([wake_up_word, 'tweet']):71        twitter_interaction.post_tweet(speech_text, consumer_key,72                                       consumer_secret, access_token, access_token_secret)73    elif check_message([wake_up_word, 'sleep']):74        sleep.go_to_sleep()75    elif check_message([wake_up_word, 'amigo']):76        amigo_bot_interaction.send_message(amigo_host_port, speech_text, riaId)77    else:...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
