Skip to content

Commit

Permalink
chore: improve register func typing
Browse files Browse the repository at this point in the history
  • Loading branch information
percevalw committed Nov 21, 2024
1 parent c87af06 commit 8286210
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions confit/registry.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import inspect
import warnings
from functools import wraps
from typing import Any, Callable, Dict, Optional, Sequence, TypeVar
from typing import Any, Callable, Dict, Optional, Sequence, TypeVar, Union

import catalogue
import pydantic
Expand Down Expand Up @@ -32,6 +32,7 @@
import importlib_metadata

PYDANTIC_V1 = pydantic.VERSION.split(".")[0] == "1"
Func = TypeVar("Func")


def _resolve_and_validate_call(
Expand Down Expand Up @@ -147,12 +148,12 @@ def _check_signature_for_save_params(func: Callable):


def validate_arguments(
func: Optional[Callable] = None,
func: Optional[Func] = None,
*,
config: Dict = None,
invoker: Optional[Callable[[Callable, Dict[str, Any]], Any]] = None,
registry: Any = None,
) -> Any:
) -> Union[Func, Callable[[Func], Func]]:
"""
Decorator to validate the arguments passed to a function and store the result
in a mapping from results to call parameters (allowing
Expand Down

0 comments on commit 8286210

Please sign in to comment.