Skip to content

Commit

Permalink
Update pre-commit repos and apply required changes (#3855)
Browse files Browse the repository at this point in the history
  • Loading branch information
suhaibmujahid authored Nov 25, 2023
1 parent fe11700 commit 4771f10
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bugbug/bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down
2 changes: 1 addition & 1 deletion bugbug/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def fetch_events(self, events_url: str) -> list:
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())}
Expand Down
3 changes: 1 addition & 2 deletions bugbug/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,10 @@ def train_test_split(self, X, y):

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()
Expand Down
4 changes: 2 additions & 2 deletions bugbug/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion bugbug/test_scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion scripts/bug_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


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
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate_landings_risk_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def get_prev_bugs(
self,
past_bugs_by: dict,
commit: repository.CommitDict,
component: str = None,
component: str | None = None,
) -> list[dict]:
paths = [
path
Expand Down Expand Up @@ -258,7 +258,7 @@ def get_prev_bugs_stats(
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.
Expand Down

0 comments on commit 4771f10

Please sign in to comment.