Skip to content

Commit

Permalink
fix(typing): use typing.Union rather than | to be python 3.9 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
Tveten committed Nov 20, 2024
1 parent 5f74554 commit 70d9aa5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions skchange/costs/l2_cost.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""L2 cost."""

import numbers
from typing import Optional
from typing import Union

import numpy as np
from numpy.typing import ArrayLike
Expand Down Expand Up @@ -85,10 +85,12 @@ class L2Cost(BaseCost):
Fixed mean for the cost calculation. If None, the optimal mean is calculated.
"""

def __init__(self, param: Optional[float | ArrayLike] = None):
def __init__(self, param: Union[float, ArrayLike, None] = None):
super().__init__(param)

def _check_fixed_param(self, param: float | ArrayLike, X: np.ndarray) -> np.ndarray:
def _check_fixed_param(
self, param: Union[float, ArrayLike], X: np.ndarray
) -> np.ndarray:
"""Check if the fixed mean parameter is valid.
Parameters
Expand Down

0 comments on commit 70d9aa5

Please sign in to comment.