当前位置: 首页>>代码示例>>Python>>正文


Python base.TypeConfigurationError方法代码示例

本文整理汇总了Python中pybindgen.typehandlers.base.TypeConfigurationError方法的典型用法代码示例。如果您正苦于以下问题:Python base.TypeConfigurationError方法的具体用法?Python base.TypeConfigurationError怎么用?Python base.TypeConfigurationError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pybindgen.typehandlers.base的用法示例。


在下文中一共展示了base.TypeConfigurationError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_py_method_def

# 需要导入模块: from pybindgen.typehandlers import base [as 别名]
# 或者: from pybindgen.typehandlers.base import TypeConfigurationError [as 别名]
def get_py_method_def(self, name):
        """
        Returns an array element to use in a PyMethodDef table.
        Should only be called after code generation.

        name -- python wrapper/method name
        """
        if len(self.all_wrappers) == 1 \
                and not getattr(self.all_wrappers[0], 'NEEDS_OVERLOADING_INTERFACE', False):
            return self.all_wrappers[0].get_py_method_def(name)
        else:
            self._normalize_py_method_flags()
            flags = self.all_wrappers[0].get_py_method_def_flags()
            ## detect inconsistencies in flags; they must all be the same
            if __debug__:
                for func in self.all_wrappers:
                    try:
                        assert set(func.get_py_method_def_flags()) == set(flags),\
                            ("Expected PyMethodDef flags %r, got %r"
                             % (flags, func.get_py_method_def_flags()))
                    except (TypeConfigurationError,
                            CodeGenerationError,
                            NotSupportedError):
                        pass
            # check available docstrings for the overloads
            docstrings_set = set()
            for wrap in self.all_wrappers:
                if wrap.docstring is not None:
                    docstrings_set.add(wrap.docstring)
            docstring = None
            if len(docstrings_set) is 1:
                docstring = docstrings_set.pop()
            elif len(docstrings_set) > 1:
                raise CodeGenerationError("Overloaded '%s' has conflicting docstrings" % self.wrapper_name)

            assert isinstance(self.wrapper_return, string_types)
            assert isinstance(self.wrapper_actual_name, string_types)
            assert isinstance(self.wrapper_args, list)

            return "{(char *) \"%s\", (PyCFunction) %s, %s, %s }," % \
                (name, self.wrapper_actual_name, '|'.join(flags),
                 (docstring is None and "NULL" or ('"'+docstring+'"'))) 
开发者ID:KTH,项目名称:royal-chaos,代码行数:44,代码来源:overloading.py


注:本文中的pybindgen.typehandlers.base.TypeConfigurationError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。