Skip to content

Commit

Permalink
fix: 🏷️ fix incorrect decorator typing
Browse files Browse the repository at this point in the history
  • Loading branch information
qthequartermasterman committed May 9, 2024
1 parent 34ae9db commit 3e80d6a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions hypothesis_torch/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import transformers.activations
import inspect
from typing import TypeVar
from typing_extensions import Final
from typing import TypeVar, Callable
from typing_extensions import Final, ParamSpec

import hypothesis
import hypothesis.strategies as st
Expand All @@ -15,6 +15,7 @@

from hypothesis_torch import inspection_util

P = ParamSpec("P")
T = TypeVar("T")
TransformerType = TypeVar("TransformerType", bound=transformers.PreTrainedModel)

Expand Down Expand Up @@ -96,8 +97,8 @@
def ignore_errors(*errors_to_ignore: type[Exception]):
"""Decorator to ignore import errors."""

def decorator(func):
def wrapper(*args, **kwargs):
def decorator(func: Callable[P, T]) -> Callable[P, T]:
def wrapper(*args: P.args, **kwargs: P.kwargs) -> T:
try:
return func(*args, **kwargs)
except errors_to_ignore as e:
Expand Down

0 comments on commit 3e80d6a

Please sign in to comment.