def _get_rule_section()

in tools/generator.py [0:0]


    def _get_rule_section(self, tf_rule_section, ros_res_section):
        rule_section = {}
        for key, value in tf_rule_section.items():
            if value.get("Ignore"):
                continue
            schema_key = value.get("To")
            tf_deprecated_props = TF_ALI_DEPRECATED_PROPERTIES.get(self.to_resource.resource_type)
            if tf_deprecated_props and key in tf_deprecated_props:
                continue
            if not isinstance(schema_key, str):
                continue
            if not schema_key or schema_key not in ros_res_section:
                continue

            schema_value = {"To": key}
            if schema_key not in rule_section:
                rule_section[schema_key] = schema_value
            else:
                rule_section[f"{schema_key}$$0"] = schema_value

            handler = value.get("Handler")
            if handler:
                if handler == "tags_dict_to_list":
                    handler = "handle_tags"
                schema_value["Handler"] = handler

            schema = value.get("Schema")
            if not schema:
                continue
            schema_type = value.get("Type")
            if not schema_type:
                continue
            schema_value["Type"] = schema_type

            if schema_type == "Map":
                try:
                    ros_res_schema = ros_res_section[schema_key]["Schema"]
                except KeyError:
                    continue
            elif schema_type == "List":
                try:
                    ros_res_schema = ros_res_section[schema_key]["Schema"]["*"]["Schema"]
                except KeyError:
                    continue
            else:
                continue
            new_schema = self._get_rule_section(schema, ros_res_schema)
            schema_value["Schema"] = new_schema

        extra_keys = set(ros_res_section.keys()) - set(rule_section.keys())
        for ros_extra_key in extra_keys:
            rule_section[ros_extra_key] = {"Ignore": True}

        return rule_section