From 8442816b42bd91c1e9c597719b3e137eb64e5b5d Mon Sep 17 00:00:00 2001 From: Ankit-cs Date: Thu, 15 Oct 2026 19:58:28 +0530 Subject: [PATCH] handler.py: Add docstring Related to #370 --- src/tirith/providers/json/handler.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tirith/providers/json/handler.py b/src/tirith/providers/json/handler.py index cf9ea8fb..c2f29aa3 100644 --- a/src/tirith/providers/json/handler.py +++ b/src/tirith/providers/json/handler.py @@ -3,6 +3,14 @@ def get_value(provider_args: Dict, input_data: Dict) -> List[dict]: + """ + Extract values from input JSON data based on the specified key path. + + :param provider_args: Provider arguments containing `key_path` to look up. + :param input_data: Target input JSON dictionary to extract values from. + :returns: List of result dictionaries with extracted values or an error dictionary. + :raises KeyError: If `key_path` is missing in `provider_args`. + """ # Must be validated first whether the provider args are valid for this op type key_path: str = provider_args["key_path"] @@ -26,6 +34,14 @@ def get_value(provider_args: Dict, input_data: Dict) -> List[dict]: def provide(provider_args: Dict, input_data: Dict) -> List[Dict]: + """ + Dispatch and execute the requested JSON provider operation. + + :param provider_args: Provider arguments containing `operation_type` and its parameters. + :param input_data: Input JSON data passed to the operation handler. + :returns: List of result dictionaries from the operation or an error dictionary if unsupported. + :raises KeyError: If `operation_type` is missing in `provider_args`. + """ operation_type = provider_args["operation_type"] op_handler = SUPPORTED_OPS.get(operation_type)