def reporting(self): log.info("{} win favorite output start...".format(self.sex)) dirname = cfg_dir.stat_players_dir(self.sex) + "/win_favorite" fu.ensure_folder(dirname) for threshold in self.chance_thresholds: self.report_threshold(dirname, threshold) log.info("{} win favorite output finish".format(self.sex))
def key_wl_dict(sex, player): if not player: return {} filename = "{}/win_long_bo3/{}.txt".format( cfg_dir.stat_players_dir(sex), player.name) return dict_tools.load( filename, keyfun=str, createfun=lambda: defaultdict(lambda: None), valuefun=st.WinLoss.create_from_text, )
def reporting(self): def report_dict(dictionary, dirname, subname): filename = "{}/{}.txt".format(dirname, subname) dict_tools.dump(dictionary, filename, keyfun=str, valuefun=lambda v: v.ratio_size_str()) log.info("{} decided_set output start...".format(self.sex)) dirname = cfg_dir.stat_players_dir(self.sex) + "/decided_set" assert os.path.isdir(dirname), "dir not found: " + dirname fu.remove_files_in_folder(dirname) report_dict(self.dec_sets_from_player, dirname, "decided") log.info("{} decided_set output finish".format(self.sex))
def __initialize(self): for sex in ("atp", "wta"): dirname = os.path.join(cfg_dir.stat_players_dir(sex), "decided_set") for filename in fu.find_files_in_folder(dirname, filemask="*", recursive=False): subname = os.path.basename(filename).replace(".txt", "") # 'decided' dct = dict_tools.load( filename, createfun=lambda: defaultdict(rl.SizedValue), keyfun=int, valuefun=rl.SizedValue.create_from_text, ) for plrid, val in dct.items(): self.val_from_sexnameplr[(sex, subname, plrid)] = val
def players_dirname(sex, aspect): return "{}/{}_stat".format(cfg_dir.stat_players_dir(sex), aspect)