How to use reset_report method in tox

Best Python code snippet using tox_python

report.py

Source:report.py Github

copy

Full Screen

...17 else:18 self.user = family['*']19 self.interval_s = report_interval_s20 self.tz = tz21 self.reset_report()22 def reset_report(self):23 self.start = datetime.now(self.tz)24 self.end = None25 self.revert_success = 026 self.revert_fail = 027 self.patrol_success = 028 self.patrol_fail = 029 self.near_revert = 030 self.all_changes = 031 def report_successful_revert(self):32 self.revert_success += 133 self.all_changes += 134 self.maybe_publish_report()35 def report_failed_revert(self):36 self.revert_fail += 137 self.all_changes += 138 self.maybe_publish_report()39 def report_successful_patrol(self):40 self.patrol_success += 141 self.all_changes += 142 self.maybe_publish_report()43 def report_failed_patrol(self):44 self.patrol_fail += 145 self.all_changes += 146 self.maybe_publish_report()47 def report_near_revert(self):48 self.near_revert += 149 self.all_changes += 150 self.maybe_publish_report()51 def report_no_revert(self):52 self.all_changes += 153 # This is by far the most common case, so no report publishing here; wait for an error instead54 def build_report(self):55 txt = "\n== Raport din {{subst:LOCALYEAR}}-{{subst:LOCALMONTH}}-{{subst:LOCALDAY2}} {{subst:LOCALTIME}} ==\n"56 txt += f"*''Interval'': {self.start} - {self.end}\n"57 txt += f"*''Editări anulate'': {self.revert_success} ({{{{dim|{self.revert_success * 100 / self.all_changes}|%}}}})\n"58 txt += f"*''Editări cu probleme neanulate'': {self.near_revert} ({{{{dim|{self.near_revert * 100 / self.all_changes}|%}}}})\n"59 txt += f"*''Anulări eșuate'': {self.revert_fail} ({{{{dim|{self.revert_fail * 100 / self.all_changes}|%}}}})\n"60 txt += f"*''Editări patrulate'': {self.patrol_success} ({{{{dim|{self.patrol_success * 100 / self.all_changes}|%}}}})\n"61 txt += f"*''Patrulări eșuate'': {self.patrol_fail} ({{{{dim|{self.patrol_fail * 100 / self.all_changes}|%}}}})\n"62 txt += f"*''Schimbări verificate'': {self.all_changes} ({{{{dim|100|%}}}})\n"63 txt += "~~~~\n"64 65 return txt66 def maybe_publish_report(self):67 self.end = datetime.now(self.tz)68 tdelta = self.end - self.start69 if tdelta.total_seconds() < self.interval_s:70 return71 try:72 page = pywikibot.Page(pywikibot.Site(), f"Utilizator:{self.user}/Rapoarte")73 txt = page.get()74 txt += self.build_report()75 page.put(txt, "Adaug un raport de rulare")76 self.reset_report()77 except Exception as e:78 print("Exception while saving report", e)79 return80 @property81 def interval(self):82 return self.interval_s83 @interval.setter84 def interval(self, report_interval_s):85 self.interval_s = report_interval_s86reporter = BotReporter(7 * 24 * 3600, timezone.utc)87def get_reporter(timezone=None):88 if timezone:89 reporter.tz = timezone90 reporter.reset_report()...

Full Screen

Full Screen

day1.py

Source:day1.py Github

copy

Full Screen

1import sys2import argparse3reset_report = None4def print_usage(name, input_file):5 print(f"Usage: python3 {name} {input_file}")6def load_inputs(input_file):7 global reset_report8 report = []9 if reset_report is not None:10 report = reset_report.copy()11 else:12 report = list(input_file)13 if reset_report is None:14 reset_report = report.copy()15 return report16def count_depths(input_file):17 depths = load_inputs(input_file)18 count = 019 prev_depth = 020 for depth in depths:21 if 0 != prev_depth and int(depth) > prev_depth:22 count += 123 prev_depth = int(depth)24 print(f"Count = {count}")25 26def count_depths_2(input_file):27 depths = load_inputs(input_file)28 count = 029 for index in range(len(depths)):30 if index < len(depths)-3:31 A = int(depths[index]) + int(depths[index+1]) + int(depths[index+2])32 B = int(depths[index+1]) + int(depths[index+2]) + int(depths[index+3])33# print(f"A = {A} < B = {B}")34 if A < B:35 count += 136# print(f"count = {count}")37 print(f"Count = {count}")38def main():39 parser = argparse.ArgumentParser(description="Count depth increases.")40 parser.add_argument('file', type=argparse.FileType('r'))41 parser.add_argument('--part', type=int, required=True, help='Part 1 or Part 2')42 args = parser.parse_args()43 if (len(sys.argv) > 1):44 with args.file as input_file:45 if args.part == 1:46 count_depths(input_file)47 elif args.part == 2:48 count_depths_2(input_file)49 else:50 print_usage(sys.argv[0], args.file)51if __name__ == "__main__":...

Full Screen

Full Screen

urls.py

Source:urls.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2from django.urls import path, re_path3from . import views4app_name = 'work_report'5urlpatterns = [6 path('work_report/', views.show_work_report, name='work_report'),7 path('time_stamp/', views.show_time_stamp, name='time_stamp'),8 path('settings/', views.show_settings, name='settings'),9 path('export_excel/', views.export_excel, name='export_excel'),10 path('reset_report/', views.reset_report, name='reset_report'),11 re_path(r'^.*/*exec/$', views.exec_ajax, name='exec'),...

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 tox 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