本文整理匯總了Python中parsing.parser.Parser.split_combatlog_file方法的典型用法代碼示例。如果您正苦於以下問題:Python Parser.split_combatlog_file方法的具體用法?Python Parser.split_combatlog_file怎麽用?Python Parser.split_combatlog_file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類parsing.parser.Parser
的用法示例。
在下文中一共展示了Parser.split_combatlog_file方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _select_date
# 需要導入模塊: from parsing.parser import Parser [as 別名]
# 或者: from parsing.parser.Parser import split_combatlog_file [as 別名]
def _select_date(self, date: datetime):
"""Callback for Calendar widget selection command"""
self.clear_data_widgets()
self._tree.delete(*self._tree.get_children(""))
if date not in self._dates:
return
self._files: List[str] = self._dates[date]
for f, file in enumerate(sorted(self._files)):
name = Parser.get_player_name_raw(file)
cube, matches, spawns = Parser.split_combatlog_file(file)
for m, match in enumerate(sorted(matches[::2])):
match = datetime.strftime(match, "%H:%M, {}".format(name))
match_iid = "{},{}".format(f, m)
self._tree.insert("", tk.END, text=match, iid=match_iid)
for s, spawn in enumerate(sorted(spawns[m])):
spawn = datetime.strftime(spawn, "%H:%M:%S")
player_list: List[str] = Parser.get_player_id_list(cube[m][s])
abs_dict: Dict[str: int] = Parser.get_abilities_dict(cube[m][s], player_list)
ships: List[str] = Parser.get_ship_for_dict(abs_dict)
ship = self.format_ships_list(ships)
spawn = "{}{}".format(spawn, ship)
spawn_iid = "{},{},{}".format(f, m, s)
self._tree.insert(match_iid, tk.END, text=spawn, iid=spawn_iid)
示例2: insert_file
# 需要導入模塊: from parsing.parser import Parser [as 別名]
# 或者: from parsing.parser.Parser import split_combatlog_file [as 別名]
def insert_file(self, file_string):
"""
Insert a file into the Treeview list of files and links it to
an entry in self.file_string_dict
:param file_string: string representing the file in the list
"""
if file_string in self.file_string_dict:
file_name = self.file_string_dict[file_string]
elif file_string.endswith(".txt"):
file_name = file_string
else:
raise ValueError("Unsupported file_string received: {0}".format(file_string))
self.file_tree.insert("", tk.END, iid=file_name, text=file_string)
file_cube, match_timings, spawn_timings = Parser.split_combatlog_file(file_name)
if len(match_timings) / 2 != len(file_cube):
print("[FileFrame] Uneven results for file {}".format(file_name))
return
for match_index, match in enumerate(match_timings[::2]):
self.file_tree.insert(file_name, tk.END, iid=(file_name, match_index), text=match.strftime("%H:%M"))
for spawn_index, spawn in enumerate(spawn_timings[match_index]):
self.file_tree.insert(
(file_name, match_index), tk.END,
iid=(file_name, match_index, spawn_index),
text=spawn.strftime("%H:%M:%S"))