garmentiq.landmark.derivation.process
1from .derive_keypoint_coord import derive_keypoint_coord 2 3 4def process(**args): 5 """ 6 Dispatches to the appropriate derivation function based on the 'function' name 7 provided in the arguments. 8 9 This function acts as a router, taking a dictionary of arguments which 10 includes the name of the derivation function to call (under a key 11 that matches a function name in its internal dispatch table). 12 13 Args: 14 **args: Keyword arguments where one key's value is a dictionary 15 containing the arguments for a specific derivation function, 16 and that key's name corresponds to the derivation function. 17 Example: `{'derive_keypoint_coord': {'p1_id': 1, ...}}` 18 19 Raises: 20 ValueError: If the function name specified in `args` is unknown. 21 22 Returns: 23 Any: The result returned by the dispatched derivation function. 24 """ 25 dispatch = { 26 "derive_keypoint_coord": derive_keypoint_coord, 27 } 28 for func_name, func_args in args.items(): 29 if func_name not in dispatch: 30 raise ValueError(f"Unknown function: {func_name}") 31 return dispatch[func_name](**func_args)
def
process(**args):
5def process(**args): 6 """ 7 Dispatches to the appropriate derivation function based on the 'function' name 8 provided in the arguments. 9 10 This function acts as a router, taking a dictionary of arguments which 11 includes the name of the derivation function to call (under a key 12 that matches a function name in its internal dispatch table). 13 14 Args: 15 **args: Keyword arguments where one key's value is a dictionary 16 containing the arguments for a specific derivation function, 17 and that key's name corresponds to the derivation function. 18 Example: `{'derive_keypoint_coord': {'p1_id': 1, ...}}` 19 20 Raises: 21 ValueError: If the function name specified in `args` is unknown. 22 23 Returns: 24 Any: The result returned by the dispatched derivation function. 25 """ 26 dispatch = { 27 "derive_keypoint_coord": derive_keypoint_coord, 28 } 29 for func_name, func_args in args.items(): 30 if func_name not in dispatch: 31 raise ValueError(f"Unknown function: {func_name}") 32 return dispatch[func_name](**func_args)
Dispatches to the appropriate derivation function based on the 'function' name provided in the arguments.
This function acts as a router, taking a dictionary of arguments which includes the name of the derivation function to call (under a key that matches a function name in its internal dispatch table).
Arguments:
- **args: Keyword arguments where one key's value is a dictionary
containing the arguments for a specific derivation function,
and that key's name corresponds to the derivation function.
Example:
{'derive_keypoint_coord': {'p1_id': 1, ...}}
Raises:
- ValueError: If the function name specified in
args
is unknown.
Returns:
Any: The result returned by the dispatched derivation function.