sagemaker.core.tools.shapes_extractor#
Extracts the shapes to DAG structure.
Classes
|
Extracts the shapes to DAG structure. |
- class sagemaker.core.tools.shapes_extractor.ShapesExtractor(combined_shapes: dict | None = None)[source]#
Bases:
objectExtracts the shapes to DAG structure.
- generate_data_shape_members_and_string_body(shape, resource_plan: Any | None = None, required_override=())[source]#
- get_shapes_dag()[source]#
Parses the Service Json and generates the Shape DAG.
DAG is stored in a Dictionary data structure, and each key denotes a DAG Node. Nodes can be of composite types: structure, list, map. Basic types (Ex. str, int, etc) are omitted from compactness and can be inferred from composite type nodes.
The connections of Nodes are can be followed by using the shape.
Possible scenarios of nested associations:
StructA → StructB → basic_type_member.
StructA → list → basic_type_member
StructA → list → StructB → basic_type_member
StructA → map → basic_type_member
StructA → map → StructBMapValue → basic_type_member
StructA → map → map → basic_type_member
StructA → map → list → basic_type_member
Example
- “ContainerDefinition”: { # type: structure
“type”:”structure”, “members”:[
{“name”: “ModelName”, “shape”: “ModelName”, “type”: “string”}, {“name”: “ContainerDefinition”, “shape”: “ContainerDefinition”, “type”: “list”}, {“name”: “CustomerMetadata”, “shape”: “CustomerMetadataMap”, “type”: “map”},
],
}, “ContainerDefinitionList”: { # type: list
“type”:”list”, “member_shape”:”ContainerDefinition”, “member_type”:”ContainerDefinition”, # potential types: string, structure
}, “CustomerMetadataMap”: { # type: map
“type”:”map”, “key_shape”:”CustomerMetadataKey”, “key_type”:”string”, # allowed types: string “value_shape”:”CustomerMetadataValue”, “value_type”:”string”, # potential types: string, structure, list, map
},
- Returns:
The generated Shape DAG.
- Return type:
dict