def find_regressor_or_needinfo_target()

in bugbot/rules/bisection_without_regressed_by.py [0:0]


    def find_regressor_or_needinfo_target(self, bugs: dict) -> dict:
        # Needinfo assignee when there is one.
        for bug in bugs.values():
            if not utils.is_no_assignee(bug["assigned_to"]):
                bug["needinfo_targets"] = [bug["assigned_to"]]

        Bugzilla(
            bugids=self.get_list_bugs(bugs),
            commenthandler=self.comment_handler,
            commentdata=bugs,
            comment_include_fields=["text", "creation_time", "count"],
        ).get_data().wait()

        bzemails = list(
            {
                bzemail
                for bug in bugs.values()
                if "needinfo_targets" in bug
                for bzemail in bug["needinfo_targets"]
            }
        )

        if bzemails:
            users = UserActivity(include_fields=["nick"]).get_bz_users_with_status(
                bzemails, keep_active=True
            )

            for bug in bugs.values():
                if "needinfo_targets" in bug:
                    needinfo_targets = []
                    for bzemail in bug["needinfo_targets"]:
                        user = users[bzemail]
                        if user["status"] == UserStatus.ACTIVE:
                            needinfo_targets.append(
                                {
                                    "mail": bzemail,
                                    "nickname": user["nick"],
                                }
                            )

                    if needinfo_targets:
                        bug["needinfo_targets"] = needinfo_targets
                    else:
                        del bug["needinfo_targets"]

        # Exclude all bugs where we couldn't find a definite regressor bug ID or an applicable needinfo target.
        bugs = {
            bug_id: bug
            for bug_id, bug in bugs.items()
            if "regressor_bug_id" in bug or "needinfo_targets" in bug
        }

        return bugs