1414#include " export.hpp"
1515#include " converters.hpp"
1616
17- #include < iostream >
17+ #include < python/cxx/OpmCommonPythonDoc.hpp >
1818
19+ #include < iostream>
1920
2021namespace {
2122
@@ -164,11 +165,12 @@ std::string get_string(DeckItem * item, std::size_t index) {
164165
165166}
166167void python::common::export_DeckKeyword (py::module & module ) {
167- py::class_< DeckKeyword >( module , " DeckKeyword" )
168- .def (py::init<const ParserKeyword& >())
169168
170- . def ( py::init ([]( const ParserKeyword& parser_keyword, py::list record_list, UnitSystem& active_system, UnitSystem& default_system) {
169+ using namespace Opm ::Common::DocStrings ;
171170
171+ py::class_<DeckKeyword>(module , " DeckKeyword" , DeckKeyword_docstring)
172+ .def (py::init<const ParserKeyword&>(), py::arg (" parser_keyword" ), DeckKeyword_init_parser_keyword_docstring)
173+ .def (py::init ([](const ParserKeyword& parser_keyword, py::list record_list, UnitSystem& active_system, UnitSystem& default_system) {
172174 std::vector< std::vector<DeckValue> > value_record_list;
173175 int i = 0 ;
174176 for (py::handle record_obj : record_list) {
@@ -218,27 +220,26 @@ void python::common::export_DeckKeyword(py::module& module) {
218220 value_record_list.push_back ( value_record );
219221 }
220222 return DeckKeyword (parser_keyword, value_record_list, active_system, default_system);
221- } ) )
222-
223- .def ( " __repr__ " , &DeckKeyword::name )
224- .def ( " __str__ " , &str< DeckKeyword> )
225- . def ( " __iter__ " , [] ( const DeckKeyword &keyword) { return py::make_iterator (keyword. begin (), keyword. end ()); }, py:: keep_alive<0 ,1 >())
226- .def ( " __getitem__" , getRecord, ref_internal)
227- .def ( " __len__" , &DeckKeyword::size )
228- .def_property_readonly (" name" , &DeckKeyword::name )
229-
230- .def (py::init ([](const ParserKeyword& parser_keyword, py::array_t <int > py_data) {
223+ } ), py::arg ( " parser_keyword " ), py::arg ( " record_list " ), py::arg ( " active_system " ), py::arg ( " default_system " ), DeckKeyword_init_parser_keyword_record_list_docstring )
224+ . def ( " __repr__ " , &DeckKeyword::name, DeckKeyword_repr_docstring)
225+ .def (" __str__ " , &str< DeckKeyword>, DeckKeyword_str_docstring )
226+ .def (" __iter__ " , []( const DeckKeyword &keyword) { return py::make_iterator (keyword. begin (), keyword. end ()); },
227+ py::keep_alive<0 ,1 >(), DeckKeyword_iter_docstring )
228+ .def (" __getitem__" , getRecord, ref_internal, py::arg ( " index " ), DeckKeyword_getitem_docstring )
229+ .def (" __len__" , &DeckKeyword::size, DeckKeyword_len_docstring )
230+ .def_property_readonly (" name" , &DeckKeyword::name, DeckKeyword_name_docstring )
231+
232+ .def (py::init ([](const ParserKeyword& parser_keyword, py::array_t <int > py_data) {
231233 return DeckKeyword (parser_keyword, convert::vector (py_data));
232- } ) )
234+ }), py::arg ( " parser_keyword " ), py::arg ( " py_data " ), DeckKeyword_init_parser_keyword_pydata_int_docstring )
233235
234- .def (py::init ([](const ParserKeyword& parser_keyword, py::array_t <double > py_data, UnitSystem& active_system, UnitSystem& default_system) {
236+ .def (py::init ([](const ParserKeyword& parser_keyword, py::array_t <double > py_data, UnitSystem& active_system, UnitSystem& default_system) {
235237 return DeckKeyword (parser_keyword, convert::vector (py_data), active_system, default_system);
236- } ) )
238+ }), py::arg ( " parser_keyword " ), py::arg ( " py_data " ), py::arg ( " active_system " ), py::arg ( " default_system " ), DeckKeyword_init_parser_keyword_pydata_double_docstring )
237239
238- .def (" get_int_array" , &get_int_array)
239- .def (" get_raw_array" , &get_raw_array)
240- .def (" get_SI_array" , &get_SI_array)
241- ;
240+ .def (" get_int_array" , &get_int_array, DeckKeyword_get_int_array_docstring)
241+ .def (" get_raw_array" , &get_raw_array, DeckKeyword_get_raw_array_docstring)
242+ .def (" get_SI_array" , &get_SI_array, DeckKeyword_get_SI_array_docstring);
242243
243244
244245 py::class_< DeckRecord >( module , " DeckRecord" )
@@ -249,26 +250,26 @@ void python::common::export_DeckKeyword(py::module& module) {
249250 ;
250251
251252
252- py::class_< DeckItem >(module , " DeckItem" )
253- .def ( " __len__" , &DeckItem::data_size )
254- .def (" is_uda" , &DeckItem::is_uda)
255- .def (" is_double" , &DeckItem::is_double)
256- .def (" is_int" , &DeckItem::is_int)
257- .def (" is_string" , &DeckItem::is_string)
258- .def (" get_str" , &get_string)
259- .def (" get_int" , &DeckItem::get<int >)
260- .def (" get_raw" , &DeckItem::get<double >)
261- .def (" get_uda" , &DeckItem::get<UDAValue>)
262- .def (" get_SI" , &DeckItem::getSIDouble)
263- .def (" get_data_list" , &item_to_pylist)
264- .def (" get_raw_data_list" , &raw_data_to_pylist)
265- .def (" get_SI_data_list" , &SI_data_to_pylist)
266- .def (" __has_value" , &DeckItem::hasValue)
267- .def (" __defaulted" , &DeckItem::defaultApplied)
268- .def (" __is_numeric" , &uda_item_is_numeric)
269- .def (" __uda_double" , &get_uda_double)
270- .def (" __uda_str" , &get_uda_str)
271- .def (" name" , &DeckItem::name)
253+ py::class_<DeckItem>(module , " DeckItem" , DeckItem_docstring )
254+ .def (" __len__" , &DeckItem::data_size, DeckItem_len_docstring )
255+ .def (" is_uda" , &DeckItem::is_uda, DeckItem_is_uda_docstring )
256+ .def (" is_double" , &DeckItem::is_double, DeckItem_is_double_docstring )
257+ .def (" is_int" , &DeckItem::is_int, DeckItem_is_int_docstring )
258+ .def (" is_string" , &DeckItem::is_string, DeckItem_is_string_docstring )
259+ .def (" get_str" , &get_string, py::arg ( " index " ), DeckItem_get_str_docstring )
260+ .def (" get_int" , &DeckItem::get<int >, py::arg ( " index " ), DeckItem_get_int_docstring )
261+ .def (" get_raw" , &DeckItem::get<double >, py::arg ( " index " ), DeckItem_get_raw_docstring )
262+ .def (" get_uda" , &DeckItem::get<UDAValue>, py::arg ( " index " ), DeckItem_get_uda_docstring )
263+ .def (" get_SI" , &DeckItem::getSIDouble, py::arg ( " index " ), DeckItem_get_SI_docstring )
264+ .def (" get_data_list" , &item_to_pylist, DeckItem_get_data_list_docstring )
265+ .def (" get_raw_data_list" , &raw_data_to_pylist, DeckItem_get_raw_data_list_docstring )
266+ .def (" get_SI_data_list" , &SI_data_to_pylist, DeckItem_get_SI_data_list_docstring )
267+ .def (" __has_value" , &DeckItem::hasValue, py::arg ( " index " ), DeckItem_has_value_docstring )
268+ .def (" __defaulted" , &DeckItem::defaultApplied, py::arg ( " index " ), DeckItem_defaulted_docstring )
269+ .def (" __is_numeric" , &uda_item_is_numeric, DeckItem_is_numeric_docstring )
270+ .def (" __uda_double" , &get_uda_double, DeckItem_uda_double_docstring )
271+ .def (" __uda_str" , &get_uda_str, DeckItem_uda_str_docstring )
272+ .def (" name" , &DeckItem::name, DeckItem_name_docstring )
272273 ;
273274
274275
0 commit comments