File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 77#include < nanobind/eigen/dense.h>
88#include < nanobind/eigen/sparse.h>
99
10+ #include < string_view>
11+
1012namespace proxsuite {
1113namespace common {
1214namespace python {
1315namespace detail {
14- inline auto
16+ inline nanobind::str
1517type_name_short (nanobind::handle h)
1618{
1719 namespace nb = nanobind;
1820 assert (h.is_type ());
19- return nb::type_name (h);
21+ // nb::type_name return the type_name with modules.
22+ // In the next step, we will trim the modules to only keep the type name.
23+ auto str = nb::type_name (h);
24+ std::string_view work_str (str.c_str ());
25+ auto dot_index = work_str.find_last_of (' .' );
26+ if (dot_index == std::string_view::npos) {
27+ return str;
28+ } else {
29+ return nb::str (work_str.data () + dot_index + 1 );
30+ }
31+ // return nb::str(dot_it++, str.end());
2032}
2133} // namespace detail
2234
You can’t perform that action at this time.
0 commit comments