Skip to content

Commit

Permalink
remove dependency on Optional
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengp0 committed Jul 24, 2023
1 parent 676bb30 commit 3aecc29
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/xspline/xfunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from functools import partial
from math import factorial
from operator import attrgetter
from typing import Optional

import numpy as np

Expand Down Expand Up @@ -226,15 +225,15 @@ class BasisXFunction(XFunction):
coefs = property(attrgetter("_coefs"))

def __init__(
self, basis_funs: tuple[XFunction, ...], coefs: Optional[NDArray] = None
self, basis_funs: tuple[XFunction, ...], coefs: NDArray | None = None
) -> None:
if not all(isinstance(fun, XFunction) for fun in basis_funs):
raise TypeError("basis functions must all be instances of " "`XFunction`")
self.basis_funs = tuple(basis_funs)
self.coefs = coefs

@coefs.setter
def coefs(self, coefs: Optional[NDArray]) -> None:
def coefs(self, coefs: NDArray | None) -> None:
if coefs is not None:
coefs = np.asarray(coefs, dtype=float).ravel()
if coefs.size != len(self):
Expand Down

0 comments on commit 3aecc29

Please sign in to comment.