Update pre-commit repos and apply required changes (#3855)

This commit is contained in:
Suhaib Mujahid 2023-11-25 14:29:32 -05:00 коммит произвёл GitHub
Родитель fe11700f21
Коммит 4771f10ed6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 12 добавлений и 13 удалений

Просмотреть файл

@ -4,11 +4,11 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.9.1
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v3.1.0
hooks:
- id: prettier
exclude: ^tests/fixtures/
@ -62,7 +62,7 @@ repos:
hooks:
- id: yesqa
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.950
rev: v1.7.1
hooks:
- id: mypy
name: mypy-bugbug

Просмотреть файл

@ -434,7 +434,7 @@ def calculate_maintenance_effectiveness_indicator(
teams: list[str],
from_date: datetime,
to_date: datetime,
components: list[str] = None,
components: list[str] | None = None,
) -> dict[str, float]:
data: dict[str, dict[str, int]] = {
"open": {},

Просмотреть файл

@ -66,7 +66,7 @@ class Github:
return events_raw
def fetch_issues(
self, url: str, retrieve_events: bool, params: dict = None
self, url: str, retrieve_events: bool, params: dict | None = None
) -> tuple[list[IssueDict], dict]:
self.api_limit()
headers = {"Authorization": "token {}".format(self.get_token())}

Просмотреть файл

@ -335,11 +335,10 @@ class Model:
def evaluation(self):
"""Subclasses can implement their own additional evaluation."""
pass
def get_labels(self) -> tuple[dict[Any, Any], list[Any]]:
"""Subclasses implement their own function to gather labels."""
pass
raise NotImplementedError("The model must implement this method")
def train(self, importance_cutoff=0.15, limit=None):
classes, self.class_names = self.get_labels()

Просмотреть файл

@ -1336,8 +1336,8 @@ def get_first_pushdate(repo_dir):
def download_commits(
repo_dir: str,
rev_start: str = None,
revs: list[bytes] = None,
rev_start: str | None = None,
revs: list[bytes] | None = None,
branch: Optional[str] = "tip",
save: bool = True,
use_single_process: bool = False,

Просмотреть файл

@ -415,7 +415,7 @@ def generate_failing_together_probabilities(
granularity: str,
push_data: Iterator[PushResult],
push_data_count: int,
up_to: str = None,
up_to: str | None = None,
) -> None:
# TODO: we should consider the probabilities of `task1 failure -> task2 failure` and
# `task2 failure -> task1 failure` separately, as they could be different.

Просмотреть файл

@ -14,7 +14,7 @@ logger = getLogger(__name__)
class Retriever(object):
def retrieve_bugs(self, limit: int = None) -> None:
def retrieve_bugs(self, limit: int | None = None) -> None:
bugzilla.set_token(get_secret("BUGZILLA_TOKEN"))
last_modified = None

Просмотреть файл

@ -194,7 +194,7 @@ class LandingsRiskReportGenerator(object):
self,
past_bugs_by: dict,
commit: repository.CommitDict,
component: str = None,
component: str | None = None,
) -> list[dict]:
paths = [
path
@ -258,7 +258,7 @@ class LandingsRiskReportGenerator(object):
self,
commit_group: dict,
commit_list: list[repository.CommitDict],
component: str = None,
component: str | None = None,
) -> None:
# Find previous regressions occurred in the same files as those touched by these commits.
# And find previous bugs that were fixed by touching the same files as these commits.