2018-08-03 Missing signature for functions¶
The signature of a function is not always available
in Python. The buildin functions
do not follow the same pattern as functions
written in Python but they provide
a backup plan with the attribute __text_signature__
:
<<<
print(open.__text_signature__)
>>>
($module, /, file, mode='r', buffering=-1, encoding=None,
errors=None, newline=None, closefd=True, opener=None)
As a result, inspect.signature(open)
returns a
non empty result. However, for a function
defined with pybind11,
this backup plan is not available:
Set the __text_signature__ attribute of callables.
That’s why the class
AutoSignatureDirective
may or may not work with regular expressions parsing the documentation
computed by pybind11 as a same function could have
several C++ signature with different types.