Best Python code snippet using rester_python
report_actors.py
Source:report_actors.py
1from operator import attrgetter2from views import player_view3from controllers import management_tournament, home_menu_controller4class ReportActors(management_tournament.ManagementTournament):5 """ Display a list of all actors, by alphabetical or ranking. """6 def __init__(self, tournament=None, option=""):7 super().__init__()8 self.display_report = player_view.PlayerView()9 self.option = option10 if tournament:11 self.actors = tournament.players12 else:13 self.actors = []14 def __call__(self):15 if not self.option:16 if self.all_players:17 self.actors = self.all_players18 test_reponse = False19 while not test_reponse:20 response = self.display_report.ask_questions("Selectionnez 1 pour un affichage par ordre "21 "alphabétique ou 2 pour un affichage par rang: ")22 if response == "1":23 self.actors = self.list_actors("name")24 self.display_report.display_actors(self.actors)25 test_reponse = True26 return home_menu_controller.HomeMenuController()27 elif response == "2":28 self.actors = self.list_actors()29 self.display_report.display_actors(self.actors)30 test_reponse = True31 return home_menu_controller.HomeMenuController()32 else:33 self.display_report.display_informations("Vous devez choisir 1 ou 2")34 else:35 self.display_report.display_informations("\nAucun joeurs dans la base de connées")36 return home_menu_controller.HomeMenuController()37 else:38 test_reponse = False39 while not test_reponse:40 response = self.display_report.ask_questions("Selectionnez 1 pour un affichage par ordre "41 "alphabétique ou 2 pour un affichage par classement: ")42 if response == "1":43 self.actors = self.list_actors("name")44 self.display_report.display_actors(self.actors)45 test_reponse = True46 return home_menu_controller.HomeMenuController()47 elif response == "2":48 self.actors = self.list_actors()49 self.display_report.display_actors(self.actors)50 test_reponse = True51 return home_menu_controller.HomeMenuController()52 else:53 self.display_report.display_informations("Vous devez choisir 1 ou 2")54 def list_actors(self, sort_methode="classement"):55 """ display all the actors of all tournament56 You can sort by name or by score."""57 if sort_methode == "name":58 self.actors.sort(key=attrgetter("last_name"))59 return self.actors60 else:61 self.actors.sort(key=attrgetter("ranking"))...
report.py
Source:report.py
...15 print '' 16 17 if reporttype == 'lifetime':18 print 'Life time'19 display_report(reportlist_life)20 elif(reporttype == 'session'):21 print 'Current session'22 display_report(reportlist)23 else:24 print 'Current session'25 display_report(reportlist)26 print ''27 print 'Life time'28 display_report(reportlist_life)29def display_report(reportlist):30 31 sortedlist = sorted(reportlist,key=lambda x:x.percentage, reverse=True) 32 for item in sortedlist: 33 print item.name + ' - ' + str("%.2f" %item.percentage) + '% ' + '(' + str(item.days) + ' days, ' + str(item.hours) + ' hours, ' + str(item.minutes) + ' mins)'34def calculate_total(reportlist):35 totaldays = 0.036 totalhours = 0.037 totalminutes = 0.038 39 for item in reportlist:40 totaldays = totaldays + item.days41 totalhours = totalhours + item.hours42 totalminutes = totalminutes + item.minutes43 ...
classifier_results_component.py
Source:classifier_results_component.py
1from dash import html2def display_report(title, report, style=None):3 if style is None:4 style = {}5 return html.Div(children=[6 html.H5(title),7 html.Ul(children=[8 html.Li(f'Accuracy: {report["accuracy"]}'),9 html.Li(f'Negative F1-Score: {report["negative"]["f1-score"]}'),10 html.Li(f'Positive F1-Score: {report["positive"]["f1-score"]}')11 ])12 ], style=style)13def display_model_results(container_id, eval_report, test_report, style):14 return html.Div(id=container_id, children=[15 display_report(title='Performance on Validation Dataset', report=eval_report),16 display_report(title='Performance on Testing Dataset', report=test_report)...
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!!