本文整理汇总了Python中session.Session.add_run方法的典型用法代码示例。如果您正苦于以下问题:Python Session.add_run方法的具体用法?Python Session.add_run怎么用?Python Session.add_run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类session.Session
的用法示例。
在下文中一共展示了Session.add_run方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LogParser
# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import add_run [as 别名]
#.........这里部分代码省略.........
match = self.run_begin_re.match(line)
if match != None:
self.create_run(match)
return True
return False
def create_run(self, match):
self.run = Run()
map_name = match.group(4)
self.run.map_file = map_name
self.run.give_recommendation = (match.group(5) == 'True')
self.run.with_justification = (match.group(6) == 'True')
self.run.start_real_time = float(match.group(2))
def try_run_end(self, line):
match = self.run_end_re.match(line)
if match != None:
self.end_run(match)
return True
return False
def end_run(self, match):
self.run.money = float(match.group(3))
self.run.welfare = float(match.group(4))
self.run.dock_utilization = float(match.group(5))
self.run.end_real_time = float(match.group(1))
if self.run.map_file == 'houston_game_0':
self.run.is_tutorial = True
else:
self.session.add_run(self.run)
self.run = None
def try_key_stroke_action(self, line):
match = self.key_stroke_action_re.match(line)
if match != None:
self.create_key_stroke_action(match)
return True
return False
def create_key_stroke_action(self, match):
action = KeyStrokeAction()
action.real_time = float(match.group(1))
action.virtual_time = self.parse_time(match.group(2))
action.key = match.group(3)
action.mouse_x = float(match.group(4))
action.mouse_y = float(match.group(5))
self.run.add_action(action)
self.run.num_key_action += 1
def parse_time(self, time_string):
if 'M' in time_string:
return time.strptime(time_string, "%m/%d/%Y %I:%M:%S %p")
else:
return time.strptime(time_string, "%m/%d/%Y %H:%M:%S")
def try_recommendation_action(self, line):
match = self.recommendation_action_re.match(line)
if match != None: