Skip to content

Commit

Permalink
special: improved private error handling annotations in _ufunc
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenham committed Dec 23, 2024
1 parent 9c2f3f8 commit 824b5ea
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions scipy-stubs/special/_ufuncs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1617,11 +1617,40 @@ class _UFuncSphHarm(_UFunc41[L["sph_harm"], None]):

###

def geterr() -> dict[str, str]: ...
def seterr(**kwargs: str) -> dict[str, str]: ...
_ErrOption: TypeAlias = L["ignored", "warn", "raise"]

@type_check_only
class _ErrDict(TypedDict):
singular: _ErrOption
underflow: _ErrOption
overflow: _ErrOption
slow: _ErrOption
loss: _ErrOption
no_result: _ErrOption
domain: _ErrOption
arg: _ErrOption
other: _ErrOption

@type_check_only
class _ErrKwargs(TypedDict, total=False):
all: _ErrOption
singular: _ErrOption
underflow: _ErrOption
overflow: _ErrOption
slow: _ErrOption
loss: _ErrOption
no_result: _ErrOption
domain: _ErrOption
arg: _ErrOption
other: _ErrOption

def geterr() -> _ErrDict: ...
def seterr(**kwargs: Unpack[_ErrKwargs]) -> _ErrDict: ...

class errstate(EnterNoneMixin):
def __init__(self, /, **kwargs: str) -> None: ...
def __init__(self, /, **kwargs: Unpack[_ErrKwargs]) -> None: ...

###

# l->l
_sf_error_test_function: np.ufunc
Expand Down

0 comments on commit 824b5ea

Please sign in to comment.