sagemaker.core.jumpstart.hub.parser_utils

sagemaker.core.jumpstart.hub.parser_utils#

This module contains utilities related to SageMaker JumpStart Hub.

Functions

camel_to_snake(camel_case_string)

Converts camelCase to snake_case_string using a regex.

snake_to_upper_camel(snake_case_string)

Converts snake_case_string to UpperCamelCaseString.

walk_and_apply_json(json_obj, apply[, stop_keys])

Recursively walks a json object and applies a given function to the keys.

sagemaker.core.jumpstart.hub.parser_utils.camel_to_snake(camel_case_string: str) str[source]#

Converts camelCase to snake_case_string using a regex.

This regex cannot handle whitespace (“camelString TwoWords”)

sagemaker.core.jumpstart.hub.parser_utils.snake_to_upper_camel(snake_case_string: str) str[source]#

Converts snake_case_string to UpperCamelCaseString.

sagemaker.core.jumpstart.hub.parser_utils.walk_and_apply_json(json_obj: Dict[Any, Any], apply, stop_keys: List[str] | None = ['metrics']) Dict[Any, Any][source]#

Recursively walks a json object and applies a given function to the keys.

stop_keys (Optional[list[str]]): List of field keys that should stop the application function.

Any children of these keys will not have the application function applied to them.