#########################################################
# Copyright (C) 2021 SiMa Technologies, Inc.
#
# This material is SiMa proprietary and confidential.
#
# This material may not be copied or distributed without
# the express prior written permission of SiMa.
#
# All rights reserved.
#########################################################
# Code owner: Joey Chou
#########################################################
import json
from typing import Dict, Union
[docs]
def parse_custom_op_attrs_to_dict(custom_op_attrs: str) -> Dict[str, Union[str, bool]]:
"""
Convert a string custom op attributes to python dictionary
:param custom_op_attrs: str. Custom op attributes in str
:return: Dict[str, Union[str, bool]]
"""
return json.loads(custom_op_attrs)
[docs]
def dump_custom_op_attrs_dict_to_string(custom_op_attrs_dict: Dict[str, Union[str, bool]]) -> str:
"""
Convert a dictionary custom op attributes to str
:param custom_op_attrs_dict: Dict[str, Union[str, bool]]. Custom op attributes in dictionary
:return: str. Custom op attributes in str
"""
return json.dumps(custom_op_attrs_dict)