def change_sorting(self): sortables = list(self.data[0].__dict__.keys()) for not_sortable in ["IDs", "runs", "pbs"]: if not_sortable in sortables: sortables.remove(not_sortable) new_sorter = command_select(sortables, printer=True) if new_sorter != "end": self.data[0].__class__.sorter = new_sorter
def __call__(self): while True: liste = list(self.__dict__.keys()) liste.remove("username") clear() print(self) command = command_select(liste + ["end"], printer=True) if command == "end": break self.__dict__[command]()
def __call__(self): commands = {"end" : "end", "Pie chart : Frequency" : self.pie_frequency, "Pie chart : total time" : self.pie_time} while True: command_key = command_select(sorted(commands.keys()), printer=True) command = commands[command_key] if command != "end": command() else: break
def plot_histo(self): command = command_select(["PB%", "Improvements", "time"], printer=True) if command == "PB%": plot_histo(sorted([one.perc1st for one in self.data]), "Histogram of %PB", typ="%", max_data=100) elif command == "Improvements": tempo = sorted([one.save.time for one in self.data]) plot_histo(tempo, "Histogram of PBs-1st deltas", typ="time") elif command == "time": tempo = sorted([one.time.time for one in self.data]) plot_histo(tempo, "Histogram of PBs time", typ="time")
def plot_histo(self): command = command_select(["WR%", "delta_WR", "time"], printer=True) if command == "WR%": plot_histo(sorted([one.perc_WR for one in self.data]), "Histogram of %WR", typ="%", min_data=100) if command == "time": tempo = sorted([one.time.time for one in self.data]) plot_histo(tempo, "Histogram of PBs time", typ="time") elif command == "delta_WR": tempo = sorted([one.delta_WR.time for one in self.data]) plot_histo(tempo, "Histogram of PBs-WR deltas", typ="time")
def __call__(self): def methods_fetcher(): toreturn = [] method_list = [ func for func in dir(self) if callable(getattr(self, func)) ] for method in method_list: if "__" not in method: toreturn.append(method) return toreturn + ["end"] while True: clear() self.data.sort() print(self) command = command_select(methods_fetcher(), printer=True) if command == "end": break getattr(self.__class__, command)(self)
def plot_save(self): print("Select one run to plot") select = command_select(self.data) select.plot_improvement()
def open_a_leaderboard(self): command_select(self.data).leaderboard()