Add new features

This commit is contained in:
Andras Schmelczer 2022-05-28 15:15:34 +02:00
commit 2c3f19e67c

View file

@ -2,7 +2,11 @@ from functools import wraps
from typing import Any, Callable, Dict
from ..exceptions import ArgumentValidationError
from ..helper import get_args, get_function_metadata_store
from ..helper import (
assert_function_is_not_finalised,
get_arguments,
get_function_metadata_store,
)
from ..tracing import TracingContext
@ -14,12 +18,13 @@ def parameter(
) -> Callable[..., Any]:
def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
get_function_metadata_store(func).input_parameter_names.append(parameter_name)
assert_function_is_not_finalised(func)
actual_name = f"arg:{func.__name__}:{parameter_name}"
@wraps(func)
def wrapper(*args: Any, **kwargs: Dict[str, Any]) -> Any:
arguments = get_args(func, args, kwargs)
arguments = get_arguments(func, args, kwargs)
argument = arguments[parameter_name]
expected_type = func.__annotations__.get(parameter_name)