Skip to content

botocore utils

cleanhtml(raw_html)

Removes the HTML tags from given raw_html

Parameters:

Name Type Description Default
raw_html str

HTML string to clean the tags off of

required

Returns:

Name Type Description
str str

HTML with tags removed

find_key_in_dict_keys(key, dict_keys)

Case insensitive search for a key in a list or dict.keys(). Returns the existing key.

Parameters:

Name Type Description Default
key str

Search case insensively for

required
dict_keys Union[list, dict]

In a list or keys of dictionary

required

Returns:

Name Type Description
str str

Found key that case insensively matches the given key.

flatten_shape_to_its_non_collection_shape_and_target_paths(shape)

Return a flat list of shapes all member shapes w/ their JMESPath selector target_path

Parameters:

Name Type Description Default
shape Shape

botocore shape to list its members

required

Returns:

Type Description
List[ShapeAndTargetPath]

List[ShapeAndTargetPath]: (shape, target_path) custom namedtuple

generate_rich_tree_from_shape(shape, remove_documentation=False)

Genereate a rich Tree containing shape and it's members.

get_input_shape(operation_model)

Get the input shape of the operation model

Parameters:

Name Type Description Default
operation_model OperationModel

botocore OperationModel

required

Returns:

Name Type Description
Shape Shape

Input Shape of the OperationModel

get_max_results_value_from_shape(input_shape)

Finds the MaxResults highest value for an input shape.

Parameters:

Name Type Description Default
input_shape Shape

Input shape of an operation. Generally postfixed with Request.

required

Returns:

Name Type Description
int int

MaxResults highest value if found in the Shape definition

get_members_shapes(shape, _recursion_count=0)

Get the member shapes of and input or output Shape.

Parameters:

Name Type Description Default
shape Shape

Shape to get members from

required

Returns:

Type Description
List[Shape]

List[Shape]: Member Shapes, added key_name and parent_name values to objects.

get_required_parameter_shapes_from_operation_model(operation_model)

Finds required parameter shapes of the operation models input_shape.

Parameters:

Name Type Description Default
operation_model OperationModel

botocore OperationModel obj of the Operation

required

Returns:

Type Description
List[Shape]

List[Shape]: Required parameter shapes.

get_shape_name(shape)

Returns the shapes name, using custom set 'key_name' attr

Parameters:

Name Type Description Default
shape Shape

botocore Shape obj

required

Returns:

Name Type Description
str str

Name of the shape.

ifind_key_in_dict_keys(key, dict_keys)

Case insensitive search for a key in a list or dict.keys().

Parameters:

Name Type Description Default
key str

Search case insensively for

required
dict_keys Union[list, dict]

In a list or keys of dictionary

required

Returns:

Name Type Description
str str

Found key that case insensively matches the given key.

is_shape_non_collection_type(shape_and_target_path)

Boolean function to check ShapeAndTargetPath Named Tuple

Parameters:

Name Type Description Default
shape_and_target_path ShapeAndTargetPath

Named Tuple

required

Returns:

Name Type Description
bool bool

description

rich_str_shape(shape, remove_documentation=False)

Transforms a Shape to rich supported string.

Parameters:

Name Type Description Default
shape Shape

botocore.model.Shape object.

required

Returns:

Name Type Description
str str

Rich string for shape.