gyoza.decorator#

Gyoza decorator for input/output model-driven function execution.

class gyoza.decorator.GyozaOp(input_model, output_model)[source]#

Bases: object

Bind a function to Pydantic input/output models.

The decorated function keeps its original call signature and gains a run method that accepts a plain dict and returns a plain dict, using the models for validation at both ends.

Parameters:
  • input_model (type[BaseModel]) – Pydantic model whose fields describe the function’s inputs.

  • output_model (type[BaseModel]) – Pydantic model whose fields describe the function’s outputs.

gyoza.decorator.gyoza_op(*, input_model, output_model)[source]#

Decorate a function with input/output model definitions.

The decorated function retains its original call signature and gains:

  • run(inputs: dict) -> dict — validates inputs via input_model, calls the function, and returns the result serialised via output_model.

  • input_model / output_model — the attached model classes.

Parameters:
  • input_model (type[BaseModel]) – Pydantic model whose fields describe the function’s inputs.

  • output_model (type[BaseModel]) – Pydantic model whose fields describe the function’s outputs.

Returns:

Decorator that wraps the target function.

Return type:

Callable[[F], F]

Simplified gyoza decorator for input/output model-driven function execution.

class gyoza.decorator.core.GyozaOp(input_model, output_model)[source]#

Bases: object

Bind a function to Pydantic input/output models.

The decorated function keeps its original call signature and gains a run method that accepts a plain dict and returns a plain dict, using the models for validation at both ends.

Parameters:
  • input_model (type[BaseModel]) – Pydantic model whose fields describe the function’s inputs.

  • output_model (type[BaseModel]) – Pydantic model whose fields describe the function’s outputs.

gyoza.decorator.core.gyoza_op(*, input_model, output_model)[source]#

Decorate a function with input/output model definitions.

The decorated function retains its original call signature and gains:

  • run(inputs: dict) -> dict — validates inputs via input_model, calls the function, and returns the result serialised via output_model.

  • input_model / output_model — the attached model classes.

Parameters:
  • input_model (type[BaseModel]) – Pydantic model whose fields describe the function’s inputs.

  • output_model (type[BaseModel]) – Pydantic model whose fields describe the function’s outputs.

Returns:

Decorator that wraps the target function.

Return type:

Callable[[F], F]