def run(): '''主运行程序''' while not Object.END_EVENT.isSet(): try: _DATA_EVENT_.wait(INTERVAL) _data = OM.get_all_match() _store(_data) _DATA_EVENT_.clear() except: logging.error('error in StoreMatch.run: %s', traceback.format_exc())
def init_all_match(data): '''初始化所有赛事''' all_ins = OM.get_all_match() for mid, mins in data.items(): ins = OM.Match() info = dir(ins) for i in info: #是方法跳过 if inspect.ismethod(getattr(ins, i)): continue #设置属性 if hasattr(mins, i): setattr(ins, i, getattr(mins, i)) all_ins[mid] = ins