Beispiel #1
0
    def _run(self):
        mgd_api_function_names, unstring_names = _unpack_mgd_api_functions(
            self.MGD_API_FUNCTIONS)
        all_mgd_functions = get_funcspecs(
            self.STUBMAIN.free_functions(in_set(mgd_api_function_names)),
            self.STUBMAIN.free_functions(prefixed('IC_')),
            self.STUBMAIN.variables(prefixed('IC_')))
        all_mgd_functions = _unstring_mgd_api_functions(
            all_mgd_functions, unstring_names)

        method_infos = []
        not_implemented = self.EXPORTED_FUNCTIONS - self.PURE_C_SYMBOLS
        for (name, spec) in sorted(all_mgd_functions):
            if name in not_implemented:
                not_implemented.remove(name)
            method_infos.append(self._generate_method_info(name, spec))
        not_implemented_method_infos = _symbol_dicts(not_implemented)

        api_methods_code = glom_templates(
            '\n\n',
            (METHOD_TEMPLATE, method_infos),
            (METHOD_NOT_IMPL_TEMPLATE, not_implemented_method_infos),
        )
        getaddress_cases_code = glom_templates(
            '\n',
            (GETADDRESS_CASE_TEMPLATE, method_infos),
            (GETADDRESS_CASE_NOT_IMPL_TEMPLATE, not_implemented_method_infos),
        )

        mgd_data_infos = _symbol_dicts(self.MGD_API_DATA)
        data_properties_code = glom_templates(
            "\n\n", (DATA_PROPERTY_TEMPLATE, mgd_data_infos))
        setdata_cases_code = glom_templates(
            "\n", (SETDATA_CASE_TEMPLATE, mgd_data_infos))

        return PYTHONAPI_FILE_TEMPLATE % {
            'api_methods': api_methods_code,
            'getaddress_cases': getaddress_cases_code,
            'data_properties': data_properties_code,
            'setdata_cases': setdata_cases_code
        }
Beispiel #2
0
    def _run(self):
        mgd_api_function_names, unstring_names = _unpack_mgd_api_functions(self.MGD_API_FUNCTIONS)
        all_mgd_functions = get_funcspecs(
            self.STUBMAIN.free_functions(in_set(mgd_api_function_names)),
            self.STUBMAIN.free_functions(prefixed('IC_')),
            self.STUBMAIN.variables(prefixed('IC_')))
        all_mgd_functions = _unstring_mgd_api_functions(all_mgd_functions, unstring_names)
    
        method_infos = []
        not_implemented = self.EXPORTED_FUNCTIONS - self.PURE_C_SYMBOLS
        for (name, spec) in sorted(all_mgd_functions):
            if name in not_implemented:
                not_implemented.remove(name)
            method_infos.append(self._generate_method_info(name, spec))
        not_implemented_method_infos = _symbol_dicts(not_implemented)
        
        api_methods_code = glom_templates('\n\n',
            (METHOD_TEMPLATE, method_infos), 
            (METHOD_NOT_IMPL_TEMPLATE, not_implemented_method_infos),
        )
        getaddress_cases_code = glom_templates('\n',
            (GETADDRESS_CASE_TEMPLATE, method_infos),
            (GETADDRESS_CASE_NOT_IMPL_TEMPLATE, not_implemented_method_infos),
        )

        mgd_data_infos = _symbol_dicts(self.MGD_API_DATA)
        data_properties_code = glom_templates("\n\n",
            (DATA_PROPERTY_TEMPLATE, mgd_data_infos))
        setdata_cases_code = glom_templates("\n",
            (SETDATA_CASE_TEMPLATE, mgd_data_infos))

        return PYTHONAPI_FILE_TEMPLATE % {
            'api_methods': api_methods_code, 
            'getaddress_cases': getaddress_cases_code, 
            'data_properties': data_properties_code, 
            'setdata_cases': setdata_cases_code
        }
Beispiel #3
0
 def _get_spec(self, name):
     _, spec = get_funcspecs(self.STUBMAIN.typedefs(equal(name))).pop()
     return spec
Beispiel #4
0
 def _get_spec(self, name):
     _, spec = get_funcspecs(
         self.STUBMAIN.typedefs(equal(name))).pop()
     return spec