def guess_tool()

in bugbot/history.py [0:0]


    def guess_tool(self, data):
        res = []
        no_tool = []

        for bugid, info in data.items():
            for date, i in info.items():
                if "comment" in i:
                    c = i["comment"]
                    if c.startswith("Crash volume for signature"):
                        continue

                    tool = None
                    if c.startswith(
                        "The leave-open keyword is there and there is no activity for"
                    ):
                        tool = "leave_open_no_activity"
                    elif c.startswith("Closing because no crashes reported for"):
                        tool = "no_crashes"
                    elif c.startswith("Moving to p3 because no activity for at least"):
                        tool = "old_p2_bug"
                    elif c.startswith("Moving to p2 because no activity for at least"):
                        tool = "old_p1_bug"
                    elif c.startswith(
                        "There's a r+ patch which didn't land and no activity in this bug"
                    ) or c.startswith(
                        "There are some r+ patches which didn't land and no activity in this bug for"
                    ):
                        tool = "not_landed"
                    elif c.startswith(
                        "The meta keyword is there, the bug doesn't depend on other bugs and there is no activity for"
                    ):
                        tool = "meta_no_deps_no_activity"
                    elif (
                        "[mozregression](https://wiki.mozilla.org/Auto-tools/Projects/Mozregression)"
                        in c
                    ):
                        tool = "has_str_no_range"
                    elif (
                        "as the bug is tracked by a release manager for the current"
                        in c
                    ):
                        tool = "mismatch_priority_tracking"
                    elif c.startswith("The severity flag is not set for this bug.\n:"):
                        tool = "no_severity"
                    elif c.startswith(
                        "The priority flag is not set for this bug and there is no activity for"
                    ):
                        tool = "ni_triage_owner"

                    if tool is None:
                        no_tool.append((bugid, info))
                    else:
                        extra = self.get_ni(i.get("changes", []))
                        res.append(
                            {"tool": tool, "date": date, "bugid": bugid, "extra": extra}
                        )
                else:
                    changes = i["changes"]
                    N = len(res)
                    for change in changes:
                        if change.get("added") == "meta":
                            res.append(
                                {
                                    "tool": "summary_meta_missing",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break
                        elif change.get("field_name") in {"component", "product"}:
                            res.append(
                                {
                                    "tool": "component",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": self.get_pc(changes),
                                }
                            )
                            break
                        elif change.get("field_name") == "cf_has_str":
                            res.append(
                                {
                                    "tool": "has_str_no_hasstr",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break
                        elif change.get("removed") == "leave-open":
                            res.append(
                                {
                                    "tool": "leave_open",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break
                        elif change.get("field_name") == "assigned_to":
                            res.append(
                                {
                                    "tool": "no_assignee",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": change["added"],
                                }
                            )
                            break
                        elif (
                            change.get("field_name", "").startswith("cf_status_firefox")
                            and change.get("added") == "affected"
                        ):
                            res.append(
                                {
                                    "tool": "nighty_reopened",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break
                        elif (
                            change.get("field_name") == "status"
                            and change.get("added") == "ASSIGNED"
                        ):
                            res.append(
                                {
                                    "tool": "assignee_but_unconfirmed",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break
                        elif (
                            change.get("field_name") == "keywords"
                            and change.get("added") == "regression"
                        ):
                            res.append(
                                {
                                    "tool": "regression",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break
                        elif change.get("field_name") == "cf_crash_signature":
                            res.append(
                                {
                                    "tool": "copy_duplicate_info",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break
                        elif (
                            change.get("field_name") == "keywords"
                            and change.get("removed") == "stalled"
                        ):
                            res.append(
                                {
                                    "tool": "regression",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break
                        elif (
                            change.get("field_name") == "type"
                            and change.get("added") == "defect"
                        ):
                            res.append(
                                {
                                    "tool": "regression_but_type_enhancement_task",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break
                        elif (
                            change.get("field_name") == "keywords"
                            and change.get("removed") == "dupeme"
                        ):
                            res.append(
                                {
                                    "tool": "closed_dupeme",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break
                        elif (
                            change.get("field_name") == "keywords"
                            and change.get("added") == "dupeme"
                        ):
                            res.append(
                                {
                                    "tool": "dupeme_whiteboard_keyword",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break
                        elif change.get("field_name") == "summary" and change.get(
                            "added"
                        ).startswith("[meta]"):
                            res.append(
                                {
                                    "tool": "meta_summary_missing",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break
                        elif change.get("field_name", "").startswith(
                            "cf_status_firefox"
                        ) and change.get("added") in {
                            "?",
                            "fixed",
                            "verified",
                            "unaffected",
                        }:
                            res.append(
                                {
                                    "tool": "missing_beta_status",
                                    "date": date,
                                    "bugid": bugid,
                                    "extra": "",
                                }
                            )
                            break

                    if len(res) == N:
                        no_tool.append((bugid, info))

        if no_tool:
            pprint(no_tool)

        return res