def get_name(self, id_): try: for player in self.players: if player[0] == id_: return player[1] log.error("get_name: could not find [%s] on list" % id_) raise KeyError except KeyError as e: log.error(e) return "ERROR"
def add_bid(self, id_, bid): for player in self.players: if player[0] == id_: if player[2] < bid: player[2] = bid log.info("[%s][%s] changed bid from %s to %s" % (player[0], player[1], player[2], bid)) yield else: log.warning( "[%s][%s] tried to bid from %s to %s. Not cool, bro. Not cool." % (player[0], player[1], player[2], bid)) yield log.error("add_bid: could not find [%s] on list" % id_)
def medicines(self, args): log.info("Export medicines") # Get filename if not "filename" in args: log.error("No filename provided") exit() # log.info("Func medicines") template_filename = "gui/templates/medicines_report.html" html_string = inventory.medicines.utils.export_html(template_filename) if "html" in args and args["html"]: try: with open(args["filename"].name + ".html", "w") as fdesc: fdesc.write(html_string) except IOError as error: log.error("File not writable: %s", error) try: with open("gui/templates/report.css", "r") as fdesc: css_string = fdesc.read() except IOError as error: log.error("CSS file not readable: %s", error) exit() inventory.medicines.utils.export_pdf( pdf_filename=args["filename"].name, html_string=html_string, css_string=css_string)
def check_if_in(self, id_): for player in self.players: if player[0] == id_: return True log.error("check_if_in: could not find [%s] on list" % id_) return False
dyn_reg2 = args.dyn_reg2 net_activation = args.net_activation pre_process = args.pre_process LengthOfCurve = args.LengthOfCurve action_noise = args.action_noise exp_group_dir = args.exp_group_dir #TODO important USE_PROB_PREDICT = args.mode # 'random'#'prob' # param check if dyn_batch_size > max_timestep: assert log.error( 'Hyper param error: dyn_batch_size must not be more than max_timestep.' ) # Exp paramaters log_interval_policy = 100 exp_name = 'Train_policy' num_exp = args.exp_num log_name = 'train._{} _drop{}_nrd{}-EXP_{}'.format(exp_name, drop_p, n_rnd, num_exp) # Create log files log_dir = utils.configure_log_dir(env_name, txt=log_name, No_time=False, log_group=exp_group_dir) logger = utils.Logger(log_dir, csvname='log')