<commit_before># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.


from typing import List, Set

from libmozdata.bugzilla import BugzillaComponent
from requests import HTTPError
from tenacity import (
    RetryError,
    retry,
    retry_if_exception_message,
    stop_after_attempt,
    wait_exponential,
)

from auto_nag import logger
from auto_nag.bzcleaner import BzCleaner
from auto_nag.component_triagers import ComponentName, ComponentTriagers, TriageOwner


class TriageOwnerRotations(BzCleaner):
    def __init__(
        self,
        excluded_teams: List[str] = [
            "DOM LWS",
            "Layout",
            "GFX",
        ],
    ) -> None:
        """Constructor

        Args:
            excluded_teams: teams to excluded all of their components when
                performing the triage owner rotation.
        """
        super().__init__()
        self.component_triagers = ComponentTriagers(excluded_teams=excluded_teams)
        self.query_url = None
        self.has_put_errors = False

    def description(self) -> str:
        return "Triage owners that got updated"

    def get_extra_for_template(self):
        return {"has_put_errors": self.has_put_errors}

    def _update_triage_owners(
        self, new_triage_owners: List[TriageOwner]
    ) -> Set[ComponentName]:
        failures = set()
        for new_triager in new_triage_owners:
            logger.info(
                "The triage owner for '%s' will be: '%s'",<commit_msg>[triage_owner_rotations] Include the DOM LWS team (#1607)<commit_after># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.


from typing import List, Set

from libmozdata.bugzilla import BugzillaComponent
from requests import HTTPError
from tenacity import (
    RetryError,
    retry,
    retry_if_exception_message,
    stop_after_attempt,
    wait_exponential,
)

from auto_nag import logger
from auto_nag.bzcleaner import BzCleaner
from auto_nag.component_triagers import ComponentName, ComponentTriagers, TriageOwner


class TriageOwnerRotations(BzCleaner):
    def __init__(
        self,
        excluded_teams: List[str] = [
            "Layout",
            "GFX",
        ],
    ) -> None:
        """Constructor

        Args:
            excluded_teams: teams to excluded all of their components when
                performing the triage owner rotation.
        """
        super().__init__()
        self.component_triagers = ComponentTriagers(excluded_teams=excluded_teams)
        self.query_url = None
        self.has_put_errors = False

    def description(self) -> str:
        return "Triage owners that got updated"

    def get_extra_for_template(self):
        return {"has_put_errors": self.has_put_errors}

    def _update_triage_owners(
        self, new_triage_owners: List[TriageOwner]
    ) -> Set[ComponentName]:
        failures = set()
        for new_triager in new_triage_owners:
            logger.info(
                "The triage owner for '%s' will be: '%s'",
{'fraction_non_alphanumeric': 0.07647598654022637, 'fraction_numerical': 0.0036708473539308656, 'mean_word_length': 2.694915254237288, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3005513', 'n_tokens_mistral': 980, 'n_tokens_neox': 959, 'n_words': 283}