Skip to content

Commit b897611

Browse files
Copilotvfdev-5
andcommitted
Modernize type hints: replace Optional and Union with | syntax
Co-authored-by: vfdev-5 <[email protected]>
1 parent fb26586 commit b897611

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ignite/metrics/cohen_kappa.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Callable, Literal, Optional, Union
1+
from typing import Callable, Literal
22

33
import torch
44

@@ -56,9 +56,9 @@ class CohenKappa(EpochMetric):
5656
def __init__(
5757
self,
5858
output_transform: Callable = lambda x: x,
59-
weights: Optional[Literal["linear", "quadratic"]] = None,
59+
weights: Literal["linear", "quadratic"] | None = None,
6060
check_compute_fn: bool = False,
61-
device: Union[str, torch.device] = torch.device("cpu"),
61+
device: str | torch.device = torch.device("cpu"),
6262
skip_unrolling: bool = False,
6363
):
6464
try:

0 commit comments

Comments
 (0)