-#!/usr/bin/env python
+#!/usr/bin/env python3
# This is the open-adventure dungeon text coverage report generator. It
# consumes a YAML description of the dungeon and determines whether the
needle_san = re.escape(needle) \
.replace("\\n", "\n") \
.replace("\\t", "\t") \
- .replace("\%S", ".*") \
- .replace("\%s", ".*") \
- .replace("\%d", ".*") \
- .replace("\%V", ".*")
+ .replace("%S", ".*") \
+ .replace("%s", ".*") \
+ .replace("%d", ".*") \
+ .replace("%V", ".*")
return re.search(needle_san, haystack)
# load DB
try:
with open(YAML_PATH, "r") as f:
- db = yaml.load(f)
+ db = yaml.safe_load(f)
except IOError as e:
print('ERROR: could not load {} ({}})'.format(YAML_PATH, e.strerror))
exit(-1)
category["percent"] = (category["covered"] / float(category["total"])) * 100
# render section header
- cat_messages = sorted(category["messages"].items())
+ cat_messages = list(category["messages"].items())
cat_keys = cat_messages[0][1].keys()
headers_html = ""
colspan = 10 - len(cat_keys)