utils: internal utilities

exception pybindgen.utils.SkipWrapper

Bases: exceptions.Exception

Exception that is raised to signal a wrapper failed to generate but must simply be skipped. for internal pybindgen use

x.__init__(...) initializes x; see help(type(x)) for signature

pybindgen.utils.ascii(str_or_unicode_or_None) → str_or_None

Make sure the value is either str or unicode object, and if it is unicode convert it to ascii. Also, None is an accepted value, and returns itself.

pybindgen.utils.call_with_error_handling(callback, args, kwargs, wrapper, exceptions_to_handle=(<class 'pybindgen.typehandlers.base.TypeConfigurationError'>, <class 'pybindgen.typehandlers.base.CodeGenerationError'>, <class 'pybindgen.typehandlers.base.NotSupportedError'>))

for internal pybindgen use

pybindgen.utils.eval_param(param_value, wrapper=None)
pybindgen.utils.eval_retval(retval_value, wrapper=None)
pybindgen.utils.get_mangled_name(base_name, template_args)

for internal pybindgen use

pybindgen.utils.mangle_name(name)

make a name Like<This,and,That> look Like__lt__This_and_That__gt__

pybindgen.utils.param(*args, **kwargs)

Simplified syntax for representing a parameter with delayed lookup.

Parameters are the same as L{Parameter.new}.

pybindgen.utils.parse_param_spec(param_spec)
pybindgen.utils.parse_retval_spec(retval_spec)
pybindgen.utils.retval(*args, **kwargs)

Simplified syntax for representing a return value with delayed lookup.

Parameters are the same as L{ReturnValue.new}.

pybindgen.utils.write_preamble(code_sink, min_python_version=None)

Write a preamble, containing includes, #define’s and typedef’s necessary to correctly compile the code with the given minimum python version.