本文整理汇总了Python中parsing.parser.Parser.count_matches方法的典型用法代码示例。如果您正苦于以下问题:Python Parser.count_matches方法的具体用法?Python Parser.count_matches怎么用?Python Parser.count_matches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parsing.parser.Parser
的用法示例。
在下文中一共展示了Parser.count_matches方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_files
# 需要导入模块: from parsing.parser import Parser [as 别名]
# 或者: from parsing.parser.Parser import count_matches [as 别名]
def update_files(self):
"""Update the Calendar with the new files"""
self.clear_data_widgets()
self._dates.clear()
folder = variables.settings["parsing"]["path"]
if not os.path.exists(folder):
messagebox.showerror("Error",
"The specified CombatLogs folder does not exist. Please "
"choose a different folder.")
folder = filedialog.askdirectory()
variables.settings.write_settings({"parsing": {"path": folder}})
return self.update_files()
files = [f for f in os.listdir(folder) if Parser.get_gsf_in_file(f)]
self.create_splash(len(files))
match_count: Dict[datetime: int] = DateKeyDict()
for file in files:
date = Parser.parse_filename(file)
if date is None: # Failed to parse
continue
if date not in match_count:
match_count[date] = 0
match_count[date] += Parser.count_matches(file)
if date not in self._dates:
self._dates[date] = list()
self._dates[date].append(file)
self._splash.increment()
self._calendar.update_heatmap(match_count)
self.destroy_splash()