Method Decorator Validation#

ValidMethodDecorator#

type fitrequest.method_decorator.ValidMethodDecorator = Callable | str#

Annotated type used for validation, coercion, and serialization of decorators.

Globale variable for decorators#

fitrequest.method_decorator.environment_decorators = {'paginated': <function paginated>, 'retry': <function retry>}#

Global dictionnary used to map json/yaml declared decorators to actual python decorators.

Hint

Don’t forget to update this dictionnary with custom decorators when using them in yaml/json files.

ValidMethodDecorator validation#

fitrequest.method_decorator.eval_decorator_signature(signature: str, environment: dict) Callable | None[source]#

Evaluate the decorator signature and return the associated method from the environment. Return None if the decorator is not found.

fitrequest.method_decorator.validate_init_value(value: Any) Callable[source]#

Validates the provided decorator value. If a string is given, attempts to retrieve the corresponding decorator from the global environment. Raises an InvalidMethodDecoratorError if the value is invalid.