Best Python code snippet using avocado_python
senteval.py
Source: senteval.py
...114 print('KeyError', evaluation, r)115 results_for_tf[evaluation] = result_value116 results_for_out[evaluation] = result_value117 if evaluation == 'STS12':118 self._fill_results(results_for_out, r, 'STS12', ['MSRpar', 'MSRvid', 'SMTeuroparl', 'surprise.OnWN', 'surprise.SMTnews'])119 if evaluation == 'STS13':120 self._fill_results(results_for_out, r, 'STS13', ['FNWN', 'OnWN', 'headlines'])121 if evaluation == 'STS14':122 self._fill_results(results_for_out, r, 'STS14', ['deft-forum', 'deft-news', 'headlines', 'images', 'OnWN', 'tweet-news'])123 if evaluation == 'STS15':124 self._fill_results(results_for_out, r, 'STS15', ['answers-forums', 'answers-students', 'belief', 'headlines', 'images'])125 if evaluation == 'STS16':126 self._fill_results(results_for_out, r, 'STS16', ['answer-answer', 'headlines', 'plagiarism', 'postediting', 'question-question'])127 return results_for_tf, results_for_out128 @staticmethod129 def _fill_results(results, raw, e, ses):130 for se in ses:131 results['%s/%s/pearson/r' % (e, se)] = raw[se]['pearson'][0]132 results['%s/%s/pearson/p' % (e, se)] = raw[se]['pearson'][1]133 results['%s/%s/spearman/r' % (e, se)] = raw[se]['spearman'][0]134 results['%s/%s/spearman/p' % (e, se)] = raw[se]['spearman'][1]135 results['%s/%s/n' % (e, se)] = raw[se]['nsamples']136 @staticmethod137 def create_vocabulary(sentences):138 """139 Creates vocabulary dictionary from samples140 """141 vocab_ns = defaultdict(int)142 for s in sentences:143 for t in s:...
job_queue.py
Source: job_queue.py
...135 self._finished = True136 # Each loop pass, try pulling results off the queue to keep its137 # size down. At this point, we don't actually care if any results138 # have arrived yet; they will be picked up after the main loop.139 self._fill_results(results)140 time.sleep(ssh.io_sleep)141 # Consume anything left in the results queue. Note that there is no142 # need to block here, as the main loop ensures that all workers will143 # already have finished.144 self._fill_results(results)145 # Attach exit codes now that we're all done & have joined all jobs146 for job in self._completed:147 if isinstance(job, Process):148 results[job.name]['exit_code'] = job.exitcode149 return results150 def _fill_results(self, results):151 """152 Attempt to pull data off self._comms_queue and add to 'results' dict.153 If no data is available (i.e. the queue is empty), bail immediately.154 """155 while True:156 try:157 datum = self._comms_queue.get_nowait()158 results[datum['name']]['results'] = datum['result']159 except Queue.Empty:160 break161#### Sample162def try_using(parallel_type):163 """164 This will run the queue through it's paces, and show a simple way of using...
parallel.py
Source: parallel.py
...84 job.join()85 self._finished = True86 # Each loop pass, try pulling results off the queue to keep its87 # size down.88 self._fill_results(results)89 self._status()90 time.sleep(ssh.io_sleep)91 self._status()92 # Consume anything left in the results queue93 self._fill_results(results)94 self._errors = 095 # Attach exit codes now that we're all done & have joined all jobs96 for job in self._completed:97 results[job.name]['exit_code'] = job.exitcode98 if (99 job.exitcode != 0100 or isinstance(results[job.name]['results'], Exception)101 ):102 self._errors += 1103 self._status(results, final=True)104 return results105def _status(self, results=None, final=False):106 if not final:107 new = (108 green(len(self._completed)),109 white(len(self._running)),110 yellow(len(self._queued)),111 green('finished'),112 white('running'),113 yellow('queued'),114 )115 if hasattr(self, 'last_status') and new == self.last_status:116 return117 self.last_status = (118 green(len(self._completed)),119 white(len(self._running)),120 yellow(len(self._queued)),121 green('finished'),122 white('running'),123 yellow('queued'),124 )125 print(WIPE, "[%s/%s/%s] %s, %s, %s" % new)126 else:127 print("\n[ %s OK / %s ERROR ] in %s seconds" % (128 green(self._num_of_jobs - self._errors, True),129 red(self._errors),130 time.time() - self._time_start,131 ))132 if self._errors:133 print(red("Failures:", True))134 for job in self._completed:135 if (136 job.exitcode != 0137 or isinstance(results[job.name]['results'], Exception)138 ):139 print(red(job.name))140 sys.stdout.flush()141def _fill_results(self, results):142 """143 Attempt to pull data off self._comms_queue and add to 'results' dict.144 """145 while True:146 try:147 datum = self._comms_queue.get(timeout=1)148 results[datum['name']]['results'] = datum['result']149 except Queue.Empty:150 break151def monkey_patch(mod):152 mod.job_queue.JobQueue.run = run153 mod.job_queue.JobQueue._status = _status...
Check out the latest blogs from LambdaTest on this topic:
Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.
In addition to the four values, the Agile Manifesto contains twelve principles that are used as guides for all methodologies included under the Agile movement, such as XP, Scrum, and Kanban.
JavaScript is one of the most widely used programming languages. This popularity invites a lot of JavaScript development and testing frameworks to ease the process of working with it. As a result, numerous JavaScript testing frameworks can be used to perform unit testing.
When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.
The rapid shift in the use of technology has impacted testing and quality assurance significantly, especially around the cloud adoption of agile development methodologies. With this, the increasing importance of quality and automation testing has risen enough to deliver quality work.
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!!