in sync/notify/msg.py [0:0]
def detail_part(details_type: str | None,
iterator: Iterable[ResultsEntry],
include_bugs: tuple[str, ...] | None,
include_status: str,
include_other_browser: bool,
) -> str | None:
"""Generate a message for a specific class of notable results.
:param details_type: The name of the results class
:param iterator: An iterator over all results that belong to the class
:param include bugs: A list of bug systems' whose bug links should go in the status string
(currently can be "bugzilla" and/or "github"
:param include_status: "head" or "both" indicating whether only the status with changes or
both the statuses before and after changes should be included
:param include_other_browser: A boolean indicating whether to include statuses from
non-Firefox browsers
:returns: A text string containing the message
"""
bug_prefixes = {"bugzilla": env.bz.bz_url,
"github": "https://github.com/"}
item_data = []
results = list(iterator)
if not results:
return None
if details_type:
item_data.append("### %s" % details_type)
prev_test = None
for test, subtest, result in results:
msg_line = ""
if prev_test != test:
msg_line = (f"* [{test}](https://wpt.live{test}) " +
f"[[wpt.fyi](https://wpt.fyi/results{test})]")
prev_test = test
status = status_str(result,
include_status=include_status,
include_other_browser=include_other_browser)
if not subtest:
msg_line += ": %s" % status
else:
if msg_line:
msg_line += "\n"
msg_line += f" * {subtest}: {status}"
if include_bugs:
prefixes = [bug_prefixes[item] for item in include_bugs]
bug_links = [bug_link for bug_link in result.bug_links
if any(bug_link.url.startswith(prefix) for prefix in prefixes)]
if bug_links:
msg_line += " linked bug{}:{}".format("s" if len(bug_links) > 1 else "",
", ". join(bug_str(link.url)
for link in bug_links))
item_data.append(msg_line)
return "\n".join(item_data) + "\n"