From 0e49ce5a1eedfdb0b670088002da056c5f7140cc Mon Sep 17 00:00:00 2001 From: Maik Nijhuis Date: Mon, 4 Jul 2022 14:45:06 +0200 Subject: [PATCH 1/3] Add MoreSane python doc strings --- python/pysettings.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/pysettings.cc b/python/pysettings.cc index 3c51616..ec6dbb4 100644 --- a/python/pysettings.cc +++ b/python/pysettings.cc @@ -156,9 +156,12 @@ void init_settings(py::module& m) { DOC(radler_Settings_Multiscale_shape)); py::class_(settings, "MoreSane") - .def_readwrite("location", &radler::Settings::MoreSane::location) - .def_readwrite("arguments", &radler::Settings::MoreSane::arguments) - .def_readwrite("sigma_levels", &radler::Settings::MoreSane::sigma_levels); + .def_readwrite("location", &radler::Settings::MoreSane::location, + DOC(radler_Settings_MoreSane_location)) + .def_readwrite("arguments", &radler::Settings::MoreSane::arguments, + DOC(radler_Settings_MoreSane_arguments)) + .def_readwrite("sigma_levels", &radler::Settings::MoreSane::sigma_levels, + DOC(radler_Settings_MoreSane_sigma_levels)); py::class_(settings, "Python", DOC(radler_Settings_Python)) -- GitLab From 2af89c210bd8d5437a0cc9a75d98f83f70a35f2a Mon Sep 17 00:00:00 2001 From: Maik Nijhuis Date: Mon, 4 Jul 2022 14:45:24 +0200 Subject: [PATCH 2/3] Add extra comma to pybind11_mkdoc output --- doc/CMakeLists.txt | 8 +++++++- python/docstrings/settings_docstrings.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 6a224fe..4404db8 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -67,7 +67,13 @@ if(BUILD_DOCSTRINGS) ${PYBIND11_MKDOC_BASE_COMMAND} -o ${DOCSTRINGS_NAME}_docstrings.h - ${FILE_TO_DOCUMENT}) + ${FILE_TO_DOCUMENT} + # Add a comma to the resulting file and make it ISO C++ compliant. + COMMAND + sed + -i + "'s=\\(__EXPAND(__COUNT(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1\\)))=\\1,))='" + ${DOCSTRINGS_NAME}_docstrings.h) endforeach() add_custom_target( diff --git a/python/docstrings/settings_docstrings.h b/python/docstrings/settings_docstrings.h index 2b7607d..5e95b25 100644 --- a/python/docstrings/settings_docstrings.h +++ b/python/docstrings/settings_docstrings.h @@ -5,7 +5,7 @@ #define __EXPAND(x) x #define __COUNT(_1, _2, _3, _4, _5, _6, _7, COUNT, ...) COUNT -#define __VA_SIZE(...) __EXPAND(__COUNT(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1)) +#define __VA_SIZE(...) __EXPAND(__COUNT(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1,)) #define __CAT1(a, b) a ## b #define __CAT2(a, b) __CAT1(a, b) #define __DOC1(n1) __doc_##n1 -- GitLab From be21e28093bd69ed2b87d35f8bb73c793d131b28 Mon Sep 17 00:00:00 2001 From: Maik Nijhuis Date: Wed, 6 Jul 2022 11:30:02 +0200 Subject: [PATCH 3/3] Review comment: Use ", 0" instead of "," --- doc/CMakeLists.txt | 2 +- python/docstrings/settings_docstrings.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 4404db8..10f375f 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -72,7 +72,7 @@ if(BUILD_DOCSTRINGS) COMMAND sed -i - "'s=\\(__EXPAND(__COUNT(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1\\)))=\\1,))='" + "'s=\\(__EXPAND(__COUNT(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1\\)))=\\1, 0))='" ${DOCSTRINGS_NAME}_docstrings.h) endforeach() diff --git a/python/docstrings/settings_docstrings.h b/python/docstrings/settings_docstrings.h index 5e95b25..aad329c 100644 --- a/python/docstrings/settings_docstrings.h +++ b/python/docstrings/settings_docstrings.h @@ -5,7 +5,7 @@ #define __EXPAND(x) x #define __COUNT(_1, _2, _3, _4, _5, _6, _7, COUNT, ...) COUNT -#define __VA_SIZE(...) __EXPAND(__COUNT(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1,)) +#define __VA_SIZE(...) __EXPAND(__COUNT(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1, 0)) #define __CAT1(a, b) a ## b #define __CAT2(a, b) __CAT1(a, b) #define __DOC1(n1) __doc_##n1 -- GitLab