Skip to content

Commit 45d7460

Browse files
author
Gaetano Guerriero
committed
[DEV-5521] Avoid deprecated typing in metrics_controller module
1 parent 7f0fc4c commit 45d7460

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

server/athenian/api/controllers/metrics_controller.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections import defaultdict
22
from dataclasses import dataclass
33
from itertools import chain
4-
from typing import Any, Collection, Dict, List, Optional, Sequence, Set, Tuple
4+
from typing import Any, Collection, Optional, Sequence
55

66
from aiohttp import web
77

@@ -69,8 +69,8 @@ class FilterPRs:
6969
"""Compiled pull requests filter."""
7070

7171
service: str
72-
repogroups: List[Set[str]]
73-
participants: List[Dict[PRParticipationKind, Set[str]]]
72+
repogroups: list[set[str]]
73+
participants: list[dict[PRParticipationKind, set[str]]]
7474
labels: LabelFilter
7575
jira: JIRAFilter
7676
for_set_index: int
@@ -84,8 +84,8 @@ class FilterDevs:
8484
"""Compiled developers filter."""
8585

8686
service: str
87-
repogroups: List[Set[str]]
88-
developers: List[PRParticipants]
87+
repogroups: list[set[str]]
88+
developers: list[PRParticipants]
8989
labels: LabelFilter
9090
jira: JIRAFilter
9191
for_set: ForSetDevelopers
@@ -97,8 +97,8 @@ class FilterChecks:
9797
"""Compiled checks filter."""
9898

9999
service: str
100-
repogroups: List[Set[str]]
101-
pusher_groups: List[Sequence[str]]
100+
repogroups: list[set[str]]
101+
pusher_groups: list[Sequence[str]]
102102
labels: LabelFilter
103103
jira: JIRAFilter
104104
for_set: ForSetCodeChecks
@@ -110,11 +110,11 @@ class FilterDeployments:
110110
"""Compiled deployments filter."""
111111

112112
service: str
113-
repogroups: List[Set[str]]
114-
participant_groups: List[Dict[ReleaseParticipationKind, List[int]]]
115-
envgroups: List[List[str]]
116-
with_labels: Dict[str, Any]
117-
without_labels: Dict[str, Any]
113+
repogroups: list[set[str]]
114+
participant_groups: list[dict[ReleaseParticipationKind, list[int]]]
115+
envgroups: list[list[str]]
116+
with_labels: dict[str, Any]
117+
without_labels: dict[str, Any]
118118
pr_labels: LabelFilter
119119
jira: JIRAFilter
120120
for_set: ForSetDeployments
@@ -247,13 +247,13 @@ async def calculate_for_set_metrics(filter_prs: FilterPRs):
247247

248248

249249
async def compile_filters_prs(
250-
for_sets: List[ForSetPullRequests],
250+
for_sets: list[ForSetPullRequests],
251251
request: AthenianWebRequest,
252252
account: int,
253-
meta_ids: Tuple[int, ...],
253+
meta_ids: tuple[int, ...],
254254
prefixer: Prefixer,
255255
logical_settings: LogicalRepositorySettings,
256-
) -> Tuple[List[FilterPRs], Set[str]]:
256+
) -> tuple[list[FilterPRs], set[str]]:
257257
"""
258258
Build the list of filters for a given list of ForSetPullRequests-s.
259259
@@ -322,13 +322,13 @@ def check_environments(
322322

323323

324324
async def _compile_filters_devs(
325-
for_sets: List[ForSetDevelopers],
325+
for_sets: list[ForSetDevelopers],
326326
request: AthenianWebRequest,
327327
account: int,
328-
meta_ids: Tuple[int, ...],
328+
meta_ids: tuple[int, ...],
329329
prefixer: Prefixer,
330330
logical_settings: LogicalRepositorySettings,
331-
) -> Tuple[List[FilterDevs], Set[str]]:
331+
) -> tuple[list[FilterDevs], set[str]]:
332332
"""
333333
Build the list of filters for a given list of ForSetDevelopers'.
334334
@@ -370,13 +370,13 @@ async def _compile_filters_devs(
370370

371371

372372
async def compile_filters_checks(
373-
for_sets: List[ForSetCodeChecks],
373+
for_sets: list[ForSetCodeChecks],
374374
request: AthenianWebRequest,
375375
account: int,
376-
meta_ids: Tuple[int, ...],
376+
meta_ids: tuple[int, ...],
377377
prefixer: Prefixer,
378378
logical_settings: LogicalRepositorySettings,
379-
) -> List[FilterChecks]:
379+
) -> list[FilterChecks]:
380380
"""
381381
Build the list of filters for a given list of ForSetCodeChecks'.
382382
@@ -437,13 +437,13 @@ def ptr(j: int) -> str:
437437

438438

439439
async def _compile_filters_deployments(
440-
for_sets: List[ForSetDeployments],
440+
for_sets: list[ForSetDeployments],
441441
request: AthenianWebRequest,
442442
account: int,
443-
meta_ids: Tuple[int, ...],
443+
meta_ids: tuple[int, ...],
444444
prefixer: Prefixer,
445445
logical_settings: LogicalRepositorySettings,
446-
) -> List[FilterDeployments]:
446+
) -> list[FilterDeployments]:
447447
filters = []
448448
checkers = {}
449449
all_repos = set()
@@ -513,12 +513,12 @@ async def _compile_jira(for_set, account: int, request: AthenianWebRequest) -> J
513513
async def _extract_repos(
514514
request: AthenianWebRequest,
515515
account: int,
516-
meta_ids: Tuple[int, ...],
517-
for_set: List[str],
516+
meta_ids: tuple[int, ...],
517+
for_set: list[str],
518518
for_set_index: int,
519-
all_repos: Set[str],
520-
checkers: Dict[str, AccessChecker],
521-
) -> Tuple[List[Set[str]], str, str]:
519+
all_repos: set[str],
520+
checkers: dict[str, AccessChecker],
521+
) -> tuple[list[set[str]], str, str]:
522522
pointer = ".for[%d].repositories" % for_set_index
523523
resolved, prefix = await resolve_repos_with_request(
524524
for_set,
@@ -566,7 +566,7 @@ async def calc_code_bypassing_prs(request: AthenianWebRequest, body: dict) -> we
566566
with_committer,
567567
filt.only_default_branch,
568568
prefixer,
569-
) # type: List[CodeStats]
569+
) # type: list[CodeStats]
570570
model = [
571571
CodeBypassingPRsMeasurement(
572572
date=(d - tzoffset).date(),
@@ -685,16 +685,16 @@ async def calc_metrics_developers(request: AthenianWebRequest, body: dict) -> we
685685

686686
async def _compile_filters_releases(
687687
request: AthenianWebRequest,
688-
for_sets: List[List[str]],
689-
with_: Optional[List[ReleaseWith]],
688+
for_sets: list[list[str]],
689+
with_: Optional[list[ReleaseWith]],
690690
account: int,
691-
meta_ids: Tuple[int, ...],
692-
) -> Tuple[
693-
List[Tuple[str, str, Tuple[Set[str], List[str]]]],
694-
Set[str],
691+
meta_ids: tuple[int, ...],
692+
) -> tuple[
693+
list[tuple[str, str, tuple[set[str], list[str]]]],
694+
set[str],
695695
Prefixer,
696696
LogicalRepositorySettings,
697-
List[ReleaseParticipants],
697+
list[ReleaseParticipants],
698698
]:
699699
filters = []
700700
checkers = {}

0 commit comments

Comments
 (0)