How to use stop_check method in avocado

Best Python code snippet using avocado_python

workers.py

Source:workers.py Github

copy

Full Screen

...201 c.encode_pauses(pause_words,202 stop_check = stop_check,203 call_back = call_back)204 self.actionCompleted.emit('encoding pauses') 205 if stop_check():206 call_back('Resetting pauses...')207 call_back(0, 0)208 c.reset_pauses()209 return False210 return True211class UtteranceEncodingWorker(QueryWorker):212 def run_query(self):213 config = self.kwargs['config']214 min_pause_length = self.kwargs['min_pause_length']215 min_utterance_length = self.kwargs['min_utterance_length']216 stop_check = self.kwargs['stop_check']217 call_back = self.kwargs['call_back']218 with CorpusContext(config) as c:219 c.encode_utterances(min_pause_length, min_utterance_length,220 stop_check = stop_check,221 call_back = call_back)222 self.actionCompleted.emit('encoding utterances') 223 if stop_check():224 call_back('Resetting utterances...')225 call_back(0, 0)226 c.reset_utterances()227 return False228 return True229class SpeechRateWorker(QueryWorker):230 def run_query(self):231 config = self.kwargs['config']232 to_count = self.kwargs['to_count']233 stop_check = self.kwargs['stop_check']234 call_back = self.kwargs['call_back']235 with CorpusContext(config) as c:236 c.encode_speech_rate(to_count, stop_check = stop_check,237 call_back = call_back)238 self.actionCompleted.emit('encoding speech rate') 239 if stop_check():240 call_back('Resetting speech rate...')241 call_back(0, 0)242 c.reset_speech_rate()243 return False244 return True245class UtterancePositionWorker(QueryWorker):246 def run_query(self):247 config = self.kwargs['config']248 stop_check = self.kwargs['stop_check']249 call_back = self.kwargs['call_back']250 with CorpusContext(config) as c:251 c.encode_utterance_position(stop_check = stop_check,252 call_back = call_back)253 self.actionCompleted.emit('encoding utterance position') 254 if stop_check():255 call_back('Resetting utterance positions...')256 call_back(0, 0)257 c.reset_utterance_position()258 return False259 return True260class SyllabicEncodingWorker(QueryWorker):261 def run_query(self):262 config = self.kwargs['config']263 segments = self.kwargs['segments']264 stop_check = self.kwargs['stop_check']265 call_back = self.kwargs['call_back']266 call_back('Encoding syllabics...')267 call_back(0, 0)268 with CorpusContext(config) as c:269 c.reset_class('syllabic')270 c.encode_class(segments, 'syllabic')271 self.actionCompleted.emit('encoding syllabics')272 if stop_check():273 call_back('Resetting syllabics...')274 call_back(0, 0)275 c.reset_class('syllabic')276 return False277 return True278class SyllableEncodingWorker(QueryWorker):279 def run_query(self):280 config = self.kwargs['config']281 algorithm = self.kwargs['algorithm']282 stop_check = self.kwargs['stop_check']283 call_back = self.kwargs['call_back']284 call_back('Encoding syllables...')285 call_back(0, 0)286 with CorpusContext(config) as c:287 c.encode_syllables(algorithm = algorithm, call_back = call_back, stop_check = stop_check)288 self.actionCompleted.emit('encoding syllables')289 if stop_check():290 call_back('Resetting syllables...')291 call_back(0, 0)292 c.reset_syllables()293 return False294 return True295class PhoneSubsetEncodingWorker(QueryWorker):296 def run_query(self):297 config = self.kwargs['config']298 segments = self.kwargs['segments']299 label = self.kwargs['label']300 stop_check = self.kwargs['stop_check']301 call_back = self.kwargs['call_back']302 call_back('Resetting {}s...'.format(label))303 call_back(0, 0)304 with CorpusContext(config) as c:305 c.reset_class(label)306 c.encode_class(segments, label)307 self.actionCompleted.emit('encoding '+ self.kwargs['label'].replace('_',' '))308 if stop_check():309 call_back('Resetting {}s...'.format(label))310 call_back(0, 0)311 c.reset_class(label)312 return False313 return True314class LexiconEnrichmentWorker(QueryWorker):315 def run_query(self):316 print("in the lexical worker")317 config = self.kwargs['config']318 case_sensitive = self.kwargs['case_sensitive']319 path = self.kwargs['path']320 stop_check = self.kwargs['stop_check']321 call_back = self.kwargs['call_back']322 call_back('Enriching lexicon...')323 call_back(0, 0)324 with CorpusContext(config) as c:325 enrich_lexicon_from_csv(c, path)326 self.actionCompleted.emit('enriching lexicon')327 if stop_check():328 call_back('Resetting lexicon...')329 call_back(0, 0)330 c.reset_lexicon()331 332 return False333 return True334class FeatureEnrichmentWorker(QueryWorker):335 def run_query(self):336 config = self.kwargs['config']337 path = self.kwargs['path']338 stop_check = self.kwargs['stop_check']339 call_back = self.kwargs['call_back']340 call_back('Enriching phonological inventory...')341 call_back(0, 0)342 with CorpusContext(config) as c:343 enrich_features_from_csv(c, path)344 self.actionCompleted.emit('enriching phonological inventory')345 if stop_check():346 call_back('Resetting phonological inventory...')347 call_back(0, 0)348 c.reset_lexicon()349 return False350 return True351class SpeakerEnrichmentWorker(QueryWorker):352 def run_query(self):353 config = self.kwargs['config']354 path = self.kwargs['path']355 stop_check = self.kwargs['stop_check']356 call_back = self.kwargs['call_back']357 call_back('Enriching speakers...')358 call_back(0,0)359 with CorpusContext(config) as c:360 enrich_speakers_from_csv(c, path)361 self.actionCompleted.emit('enriching speakers')362 363 return True364class HierarchicalPropertiesWorker(QueryWorker):365 def run_query(self):366 config = self.kwargs['config']367 stop_check = self.kwargs['stop_check']368 call_back = self.kwargs['call_back']369 call_back('Encoding {}...'.format(self.kwargs['name']))370 call_back(0, 0)371 with CorpusContext(config) as c:372 if self.kwargs['type'] == 'count':373 c.encode_count(self.kwargs['higher'], self.kwargs['lower'],374 self.kwargs['name'], subset = self.kwargs['subset'])375 elif self.kwargs['type'] == 'position':376 c.encode_position(self.kwargs['higher'], self.kwargs['lower'],377 self.kwargs['name'], subset = self.kwargs['subset'])378 elif self.kwargs['type'] == 'rate':379 c.encode_rate(self.kwargs['higher'], self.kwargs['lower'],380 self.kwargs['name'], subset = self.kwargs['subset'])381 self.actionCompleted.emit('encoding '+ self.kwargs['name'].replace('_',' '))382 if stop_check():383 return False384 return True385class RelativizedMeasuresWorker(QueryWorker):386 def run_query(self):387 res = ""388 data_type = 'word'389 config = self.kwargs['config']390 stop_check = self.kwargs['stop_check']391 call_back = self.kwargs['call_back']392 call_back('Encoding {}...'.format(self.kwargs['measure']))393 call_back(0, 0)394 with CorpusContext(config) as c:395 string = "!"396 c.encode_measure(self.kwargs['measure'])397 self.actionCompleted.emit('encoding '+ self.kwargs['measure'].replace('_',' '))398 if stop_check():399 return False400 return True401class PrecedingCacheWorker(QueryWorker):402 def run_query(self):403 print('starting to cache preceding')404 config = self.kwargs['config']405 discourse = self.kwargs['discourse']406 begin = self.kwargs['begin']407 end = self.kwargs['end']408 with CorpusContext(config) as c:409 h_type = c.hierarchy.highest410 highest = getattr(c, h_type)411 q = c.query_graph(highest)412 q = q.filter(highest.discourse.name == discourse)...

Full Screen

Full Screen

main.py

Source:main.py Github

copy

Full Screen

...71 cur = 072 for d in directories:73 if not os.path.isdir(d):74 continue75 if stop_check is not None and stop_check():76 return77 if call_back is not None:78 cur += 179 if cur % 3 == 0:80 call_back(cur)81 files += [os.path.join(d, x) for x in os.listdir(d) if x.lower().endswith('.wav')]82 if len(files) == 0:83 raise (ConchError("The directories specified do not contain any wav files"))84 if call_back is not None:85 call_back('Mapping directories...')86 call_back(0, len(files) * len(files))87 cur = 088 path_mapping = list()89 for x in files:90 for y in files:91 if stop_check is not None and stop_check():92 return93 if call_back is not None:94 cur += 195 if cur % 20 == 0:96 call_back(cur)97 if not x.lower().endswith('.wav'):98 continue99 if not y.lower().endswith('.wav'):100 continue101 if x == y:102 continue103 path_mapping.append((x, y))104 result = acoustic_similarity_mapping(path_mapping, analysis_function, distance_function, stop_check, call_back, multiprocessing)105 return result106def acoustic_similarity_directory(directory, analysis_function, distance_function, stop_check=None, call_back=None, multiprocessing=True):107 all_files = list()108 wavs = list()109 directories = list()110 for f in os.listdir(directory):111 path = os.path.join(directory, f)112 all_files.append(path)113 if f.lower().endswith('.wav'):114 wavs.append(path)115 if os.path.isdir(path):116 directories.append(path)117 if not wavs:118 return acoustic_similarity_directories(directories, analysis_function, distance_function, stop_check,119 call_back, multiprocessing)120 if call_back is not None:121 call_back('Mapping files...')122 call_back(0, len(wavs) * len(wavs))123 cur = 0124 path_mapping = list()125 for x in wavs:126 for y in wavs:127 if stop_check is not None and stop_check():128 return129 if call_back is not None:130 cur += 1131 if cur % 20 == 0:132 call_back(cur)133 if x == y:134 continue135 path_mapping.append((x, y))136 result = acoustic_similarity_mapping(path_mapping, analysis_function, distance_function, stop_check, call_back, multiprocessing)137 return result138def analyze_long_file(path, segments, analysis_function,139 num_jobs=None, padding=0,140 call_back=None, stop_check=None, multiprocessing=True):141 segment_mapping = SegmentMapping()...

Full Screen

Full Screen

turn_algo.py

Source:turn_algo.py Github

copy

Full Screen

1Stop_condition = 02Mode = 0 # 0 for master3Stop_counter = 14Stop_0 = 0 #Own Stop_condition5Stop_1 = 0 #Other robot's Stop_condition6L_turn_condition = 07U_turn_condition = 08# Tek sıkıntı change direction9def Mode_check():10 if: # master11 Mode = 012 else: # slave13 Mode = 114def Stop_who(): # Checks who is stopped15 if : #durduk16 if : #engel varsa17 Stop_0 = 118 Stop_1 = 019 else: #engel yoksa bizim önümüzde20 Stop_0 = 021 Stop_1 = 122 elif : # açı -+ 90 ise23 Stop_0 = 124 Stop_1 = 125 else: #durmadık26 Stop_0 = 027 Stop_1 = 028def Turn_condition(): # mazeden gelecek turn type and nerde engel yoksa29 if : # sağ empty ise30 # sağdaki turn type seç31 else:32 # soldaki turn type seç33def Stop_check(): #Durduk mu durmadık mı34 Stop_who()35 if ( Stop_0 or Stop_1 ): # durduysak36 Stop_condition = 137 else: # durmadıysak38 Stop_condition = 039def No_turn():40 pass #No turn code41def Stop_release(): # stop release conditions42 Stop_condition = 043 Stop_0 = 044 Stop_1 = 045def Turn():46 if Stop_0 and Stop_1 : # bu +-90 derece iken oluyo ikisi de beklicek dedim47 pass48 #Wait 10 sec49 elif Stop_0: # biz durduysak dön50 pass #Turn51 else: # o durduysa bekle52 pass53 #Wait 10 sec54 Stop_release()55def Speed_in_turn(): # L dönüsü icin hız ayarı angle ile56 pass57def L_turn(): # L dönüsü58 Turn() # dön59 while True: # döndükten sonra hız ayarlı bi sekilde git bi dahki durmaya kadar60 Speed_in_turn() # bu belki üste alınabilir !değişim!61 Stop_check()62 if ( Stop_condition ):63 Turn()64 L_turn_condition = 065 break66def Change_direction(): # Yön degistir67 pass #Change_direction68def U_turn(): # U dönüsü69 while True:70 Stop_check()71 if ( Stop_counter == 1 ):72 L_turn()73 Stop_counter += 174 elif ( Stop_counter == 2 ) :75 if not Mode : # master bişi yapmıyo76 pass77 else: # slave yön değiştiriyo78 Change_direction()79 Stop_counter += 180 elif Stop_counter > 2 and Stop_condition:81 if ( ( not Mode and Stop_0 ) or ( Mode and not Stop_0 ) ):82 while True:83 Stop_check()84 if Stop_condition and Stop_counter == 3:85 if Mode:86 Change_direction()87 else:88 pass89 Turn()90 Stop_counter += 191#00492 elif Stop_condition and Stop_counter == 4:93 if not Mode:94 Change_direction()95 else:96 pass97 Turn() # eğer bekleme olursa bu conditionda bu kalkmaz98 #olmazsa kalkıcak, kalkarsa release ekle99 Stop_counter += 1100#005101 elif Stop_condition and Stop_counter == 5:102 Turn()103 Stop_counter += 1104#006105 elif Stop_condition and Stop_counter == 6:106 if not Mode:107 Change_direction()108 else:109 pass110 L_turn()111 Stop_counter = 1112 break113 else:114 while True:115 Stop_check()116 if Stop_condition and Stop_counter == 3:117 Turn()118 Stop_counter += 1119 pass120 elif Stop_condition and Stop_counter == 4:121 if Mode:122 Change_direction()123 else:124 pass125 Turn()126 Stop_counter += 1127 elif Stop_condition and Stop_counter == 5:128 if not Mode:129 Change_direction()130 else:131 pass132 Turn()133 Stop_counter += 1134 elif Stop_condition and Stop_counter == 6:135 if not Mode:136 Change_direction()137 else:138 pass139 L_turn()140 Stop_counter = 1141 break142 if ( Stop_counter == 1 ):143 U_turn_condition = 0144 break145while True:146 Mode_check() # Checks mode147 Stop_check() # Checks if any stop conditions occur148 Turn_condition() # Checks Turn conditions149 if Stop_condition : # if stop conditions occurs150 if( L_turn_condition ): # İf L turn conditions occurs151 L_turn()152 elif( U_turn_condition ): # İf U turn conditions occurs153 U_turn()154 else: # Yoksa Düz git...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful