Skip to content

Commit

Permalink
fixup! Can disable the section headings in docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
AWhetter committed Jan 16, 2021
1 parent 27b6e44 commit c079bef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ The valid options are:
* `-DPYBIND11_NOPYTHON=ON`: Disable all Python searching (disables tests)
* `-DBUILD_TESTING=ON`: Enable the tests
* `-DDOWNLOAD_CATCH=ON`: Download catch to build the C++ tests
* `-DOWNLOAD_EIGEN=ON`: Download Eigen for the NumPy tests
* `-DDOWNLOAD_EIGEN=ON`: Download Eigen for the NumPy tests
* `-DPYBIND11_INSTALL=ON/OFF`: Enable the install target (on by default for the
master project)
* `-DUSE_PYTHON_INSTALL_DIR=ON`: Try to install into the python dir
Expand Down
6 changes: 3 additions & 3 deletions docs/advanced/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ For example:
>>> help(example.add)
add(...)
| add(arg0: int, arg1: int) -> int
| add(arg0: int, arg1: int) -> int\
| add(arg0: float, arg1: float) -> float
| Overloaded function.
|
Expand Down Expand Up @@ -355,8 +355,8 @@ The above example would produce the following docstring:
>>> help(example.add)
add(...)
| add(arg0: int, arg1: int) -> int
| add(arg0: float, arg1: float) -> float
| add(arg0: int, arg1: int) -> int\
| add(arg0: float, arg1: float) -> float\
| add(arg0: None, arg1: None) -> None
| A function which adds two numbers.
|
Expand Down
1 change: 1 addition & 0 deletions include/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ class cpp_function : public function {
for (auto it = chain_start; it != nullptr; it = it->next) {
signatures += rec->name;
signatures += it->signature;
if (it->next != nullptr) signatures += "\\";
signatures += "\n";
}
if (options::show_section_headings()) {
Expand Down
10 changes: 5 additions & 5 deletions tests/test_factory_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def test_init_factory_signature(msg):
assert (
msg(m.TestFactory1.__init__.__doc__)
== """
__init__(self: m.factory_constructors.TestFactory1, arg0: m.factory_constructors.tag.unique_ptr_tag, arg1: int) -> None
__init__(self: m.factory_constructors.TestFactory1, arg0: str) -> None
__init__(self: m.factory_constructors.TestFactory1, arg0: m.factory_constructors.tag.pointer_tag) -> None
__init__(self: m.factory_constructors.TestFactory1, arg0: m.factory_constructors.tag.unique_ptr_tag, arg1: int) -> None\\
__init__(self: m.factory_constructors.TestFactory1, arg0: str) -> None\\
__init__(self: m.factory_constructors.TestFactory1, arg0: m.factory_constructors.tag.pointer_tag) -> None\\
__init__(self: m.factory_constructors.TestFactory1, arg0: handle, arg1: int, arg2: handle) -> None
Overloaded function.
Expand All @@ -107,8 +107,8 @@ def test_init_factory_signature(msg):
assert (
msg(m.TestFactory2.__init__.__doc__)
== """
__init__(self: m.factory_constructors.TestFactory2, arg0: m.factory_constructors.tag.pointer_tag, arg1: int) -> None
__init__(self: m.factory_constructors.TestFactory2, arg0: m.factory_constructors.tag.unique_ptr_tag, arg1: str) -> None
__init__(self: m.factory_constructors.TestFactory2, arg0: m.factory_constructors.tag.pointer_tag, arg1: int) -> None\\
__init__(self: m.factory_constructors.TestFactory2, arg0: m.factory_constructors.tag.unique_ptr_tag, arg1: str) -> None\\
__init__(self: m.factory_constructors.TestFactory2, arg0: m.factory_constructors.tag.move_tag) -> None
This is one part of the docstring.
This is the other part of the docstring.
Expand Down

0 comments on commit c079bef

Please sign in to comment.