| 18 | #include <utility> |
| 19 | |
| 20 | static std::string formatKwargs(const nanobind::kwargs &kwargs) { |
| 21 | if (kwargs.size() == 0) |
| 22 | return {}; |
| 23 | std::string out = " (args = {"; |
| 24 | bool first = true; |
| 25 | for (const auto &item : kwargs) { |
| 26 | if (!first) |
| 27 | out += ", "; |
| 28 | first = false; |
| 29 | out += nanobind::cast<std::string>(item.first); |
| 30 | out += "="; |
| 31 | out += nanobind::cast<std::string>(nanobind::str(item.second)); |
| 32 | } |
| 33 | out += "})"; |
| 34 | return out; |
| 35 | } |
| 36 | |
| 37 | namespace { |
| 38 | class TraceSpan { |