Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. class Stat:
  2.     def __init__(self):
  3.         self.parser = Parser()
  4.         self.log_expl = LogExplorer()
  5.  
  6.     def add_line(self, line: str):
  7.         log = self.parser.parse_log(line)
  8.         if not log:
  9.             return
  10.         self.log_expl.add_log(log)
  11.  
  12.     def results(self) -> dict:
  13.         return {
  14.             'FastestPage': self.log_expl.get_fastest_page(),
  15.             'MostActiveClient': self.log_expl.get_most_active_client(),
  16.             'MostActiveClientByDay':
  17.                 self.log_expl.get_most_active_client_on_date(),
  18.             'MostPopularBrowser': self.log_expl.get_most_active_browser(),
  19.             'MostPopularPage': self.log_expl.get_most_popular_page(),
  20.             'SlowestAveragePage': self.log_expl.get_avg_slowest_page(),
  21.             'SlowestPage': self.log_expl.get_slowest_page()}
  22.  
  23.  
  24. def make_stat():
  25.     return Stat()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement