Skip to content

Commit

Permalink
add shorten_json_string to pyrsutils
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed Mar 22, 2023
1 parent d1bb0e3 commit dc8283e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions third-party/rsutils/py/pyrsutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <rsutils/easylogging/easyloggingpp.h>
#include <rsutils/string/split.h>
#include <rsutils/string/from.h>
#include <rsutils/string/shorten-json-string.h>
#include <rsutils/version.h>
#include <rsutils/number/running-average.h>
#include <rsutils/number/stabilized-value.h>
Expand All @@ -30,6 +31,18 @@ PYBIND11_MODULE(NAME, m) {
py::arg( "logger" ) = LIBREALSENSE_ELPP_ID );

m.def( "split", &rsutils::string::split );
m.def(
"shorten_json_string",
[]( std::string const & str, size_t max_length )
{ return rsutils::string::shorten_json_string( str, max_length ).to_string(); },
py::arg( "string" ),
py::arg( "max-length" ) = 96 );
m.def(
"shorten_json_string",
[]( nlohmann::json const & j, size_t max_length )
{ return rsutils::string::shorten_json_string( j.dump(), max_length ).to_string(); },
py::arg( "json" ),
py::arg( "max-length" ) = 96 );
m.def( "executable_path", &rsutils::os::executable_path );
m.def( "executable_name", &rsutils::os::executable_name, py::arg( "with_extension" ) = false );

Expand Down

0 comments on commit dc8283e

Please sign in to comment.