本文整理汇总了Python中parsing.parser.Parser.parse_folder方法的典型用法代码示例。如果您正苦于以下问题:Python Parser.parse_folder方法的具体用法?Python Parser.parse_folder怎么用?Python Parser.parse_folder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parsing.parser.Parser
的用法示例。
在下文中一共展示了Parser.parse_folder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: folder_statistics
# 需要导入模块: from parsing.parser import Parser [as 别名]
# 或者: from parsing.parser.Parser import parse_folder [as 别名]
def folder_statistics():
"""
Parses all files in the Current Working Directory by getting al .txt
files in the folder and then returns the results in formats that can be
used by the file_frame to set all the required strings to show the
results to the user.
"""
(abilities_dict, dmg_d, dmg_t, dmg_s, healing, hitcount, critcount,
crit_luck, enemies, enemy_dmg_d, enemy_dmg_t, ships, uncounted,
deaths, time) = \
Parser.parse_folder()
stat_string = "{name}\n{enemies} enemies\n{dmg_d}\n{dmg_t}\n{dmg_r:.1f} : 1.0\n" \
"{dmg_s}\n{healing}\n{hitcount}\n{critcount}\n{crit_luck:.2f}\n" \
"{deaths}\n{minutes}:{seconds:.0f}\n{dps:.1f}"
minutes, seconds = divmod(time, 60)
stat_string = stat_string.format(
name="-",
enemies=len([enemy for enemy in enemies if enemy in enemy_dmg_t and enemy_dmg_t[enemy] > 0]),
dmg_d=dmg_d,
dmg_t=dmg_t,
dmg_r=dmg_d / dmg_t if dmg_t != 0 else 0,
dmg_s=dmg_s,
healing=healing,
hitcount=hitcount,
critcount=critcount,
crit_luck=critcount / hitcount if hitcount != 0 else 0,
deaths=deaths,
minutes=minutes,
seconds=seconds,
dps=dmg_d / time,
)
return (abilities_dict, stat_string, ships, enemies, enemy_dmg_d,
enemy_dmg_t, uncounted)