From 01874f5dcb071bf1b0914b5dbe6d4120a5a21c76 Mon Sep 17 00:00:00 2001 From: Michael Sinelnikov Date: Sun, 31 Mar 2024 16:47:35 +0300 Subject: [PATCH] Add bindings for separator validation --- src/python_bindings/bind_main_classes.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/python_bindings/bind_main_classes.cpp b/src/python_bindings/bind_main_classes.cpp index 2f3ea88a16..e7c83f6d6c 100644 --- a/src/python_bindings/bind_main_classes.cpp +++ b/src/python_bindings/bind_main_classes.cpp @@ -13,6 +13,7 @@ #include "py_util/get_py_type.h" #include "py_util/opt_to_py.h" #include "py_util/py_to_any.h" +#include "separator_validator.h" namespace { namespace py = pybind11; @@ -42,6 +43,12 @@ void BindMainClasses(py::module_& main_module) { py::register_exception(main_module, "ConfigurationError", PyExc_ValueError); + auto util_module = main_module.def_submodule("util"); + util_module.def( + "validate_separator", + [](std::string const& path, char sep) { return util::ValidateSeparator(path, sep); }, + "Validate separator for a CSV table"); + #define CERTAIN_SCRIPTS_ONLY \ "\nThis option is only expected to be used by Python scripts in which it is\n" \ "easier to set all options one by one. For normal use, you may set the\n" \