Esempio n. 1
0
    def _create_class_info(self):
        info = ClassInfo()
        info.set_name("ClassA")
        info.set_module("module_1")
        info.set_description("ClassA description")

        data_type_1 = BuiltinDataType("str")
        data_type_2 = CustomDataType("custom_data_type", modifier="set")
        mixin_data_type = MixinDataType([data_type_1, data_type_2])
        attr_info_1 = VariableInfo("attribute")
        attr_info_1.set_name("attr_1")
        attr_info_1.set_description("attr_1 description")
        attr_info_1.set_data_type(mixin_data_type)
        attr_info_1.set_class("ClassA")
        attr_info_1.set_module("module_1")

        info.set_attributes([attr_info_1])

        method_info_1 = FunctionInfo("method")
        method_info_1.set_name("method_1")
        method_info_1.set_parameters(["param_1"])
        method_info_1.set_description("method_1 description")
        method_info_1.set_module("module_1")
        method_info_1.set_class("ClassA")

        param_data_type_1 = BuiltinDataType("int")
        param_info_1 = ParameterDetailInfo()
        param_info_1.set_name("param_1")
        param_info_1.set_description("param_1 description")
        param_info_1.set_data_type(param_data_type_1)
        method_info_1.add_parameter_detail(param_info_1)

        info.set_methods([method_info_1])

        base_class_1 = CustomDataType("BaseClassA")
        base_class_2 = CustomDataType("BaseClassB")

        info.add_base_classes([base_class_1, base_class_2])

        return info
Esempio n. 2
0
    def _create_function_info(self):
        info = FunctionInfo("function")
        info.set_name("function_1")
        info.set_parameters(["param_1=10", "param_2"])
        info.set_description("function_1 description")
        info.set_module("module_1")

        param_data_type_1 = BuiltinDataType("int")
        param_info_1 = ParameterDetailInfo()
        param_info_1.set_name("param_1")
        param_info_1.set_description("param_1 description")
        param_info_1.set_data_type(param_data_type_1)

        param_data_type_2 = CustomDataType("ClassA", modifier="list")
        param_info_2 = ParameterDetailInfo()
        param_info_2.set_name("param_2")
        param_info_2.set_description("param_2 description")
        param_info_2.set_data_type(param_data_type_2)

        info.set_parameter_details([param_info_1, param_info_2])

        return_data_type = BuiltinDataType("bool")
        return_info = ReturnInfo()
        return_info.set_description("return description")
        return_info.set_data_type(return_data_type)

        info.set_return(return_info)

        return info