diff --git a/src/core/algorithms/algorithm.h b/src/core/algorithms/algorithm.h index 9e466fbe23..0918a69041 100644 --- a/src/core/algorithms/algorithm.h +++ b/src/core/algorithms/algorithm.h @@ -105,10 +105,10 @@ class Algorithm { [[nodiscard]] std::unordered_set GetPossibleOptions() const; - std::unordered_map > GetOptValues() { - std::unordered_map > opt_values; + std::unordered_map> GetOptValues() { + std::unordered_map> opt_values; for (auto& i : possible_options_) { - if(i.second->IsSet()){ + if (i.second->IsSet()) { opt_values[i.second->GetName()] = i.second->GetOptValue(); } } diff --git a/src/core/config/ioption.h b/src/core/config/ioption.h index 95126161cc..9ebea6f4d8 100644 --- a/src/core/config/ioption.h +++ b/src/core/config/ioption.h @@ -7,7 +7,7 @@ #include "boost/any.hpp" namespace config { -struct OptValue{ +struct OptValue { std::type_index type; boost::any value; }; diff --git a/src/core/config/option.h b/src/core/config/option.h index e0fdefd26b..8c93d0f4e0 100644 --- a/src/core/config/option.h +++ b/src/core/config/option.h @@ -91,7 +91,8 @@ class Option : public IOption { } std::unique_ptr GetOptValue() override { - return std::make_unique(OptValue{std::type_index(typeid(T)),boost::any(*value_ptr_)}); + return std::make_unique( + OptValue{std::type_index(typeid(T)), boost::any(*value_ptr_)}); } private: diff --git a/src/python_bindings/opt_to_str.cpp b/src/python_bindings/opt_to_str.cpp index f3d88ff287..b408dc342c 100644 --- a/src/python_bindings/opt_to_str.cpp +++ b/src/python_bindings/opt_to_str.cpp @@ -5,57 +5,48 @@ using ConvFunction = std::function; template std::pair normal_conv_pair{ - std::type_index(typeid(T)), - [](boost::any value) { return py::cast(boost::any_cast(value)); } -}; + std::type_index(typeid(T)), + [](boost::any value) { return py::cast(boost::any_cast(value)); }}; template <> std::pair normal_conv_pair{ - std::type_index(typeid(bool)), - [](boost::any value) { return py::cast(boost::any_cast(value)); } -}; + std::type_index(typeid(bool)), + [](boost::any value) { return py::cast(boost::any_cast(value)); }}; template <> std::pair normal_conv_pair{ - std::type_index(typeid(config::IndicesType)), - [](boost::any value) { - auto opt_value = (boost::any_cast(value)); - return py::cast(opt_value); - } -}; + std::type_index(typeid(config::IndicesType)), [](boost::any value) { + auto opt_value = (boost::any_cast(value)); + return py::cast(opt_value); + }}; template <> std::pair normal_conv_pair{ - std::type_index(typeid(algos::metric::MetricAlgo)), - [](boost::any value){ - auto opt_value = boost::any_cast(value); - return py::cast(opt_value._to_string()); - } -}; + std::type_index(typeid(algos::metric::MetricAlgo)), [](boost::any value) { + auto opt_value = boost::any_cast(value); + return py::cast(opt_value._to_string()); + }}; template <> std::pair normal_conv_pair{ - std::type_index(typeid(algos::metric::Metric)), - [](boost::any value){ - auto opt_value = boost::any_cast(value); - return py::cast(opt_value._to_string()); - } -}; + std::type_index(typeid(algos::metric::Metric)), [](boost::any value) { + auto opt_value = boost::any_cast(value); + return py::cast(opt_value._to_string()); + }}; const std::unordered_map converters{ - normal_conv_pair, - normal_conv_pair, - normal_conv_pair, - normal_conv_pair, - normal_conv_pair, - normal_conv_pair, - normal_conv_pair, - normal_conv_pair, - normal_conv_pair, - normal_conv_pair, - normal_conv_pair -}; -} // namespace + normal_conv_pair, + normal_conv_pair, + normal_conv_pair, + normal_conv_pair, + normal_conv_pair, + normal_conv_pair, + normal_conv_pair, + normal_conv_pair, + normal_conv_pair, + normal_conv_pair, + normal_conv_pair}; +} // namespace -namespace python_bindings{ - py::object opt_to_str(std::type_index type, boost::any val) { - return converters.at(type)(val); - } -} // namespace python_bindings \ No newline at end of file +namespace python_bindings { +py::object opt_to_str(std::type_index type, boost::any val) { + return converters.at(type)(val); +} +} // namespace python_bindings diff --git a/src/python_bindings/opt_to_str.h b/src/python_bindings/opt_to_str.h index 5e200d2137..b76a6282d4 100644 --- a/src/python_bindings/opt_to_str.h +++ b/src/python_bindings/opt_to_str.h @@ -14,12 +14,12 @@ #include "config/error/type.h" #include "config/indices/type.h" #include "config/max_lhs/type.h" +#include "config/names.h" #include "config/tabular_data/input_table_type.h" #include "config/thread_number/type.h" -#include "config/names.h" #include "model/types/types.h" -namespace python_bindings{ - namespace py = pybind11; - py::object opt_to_str(std::type_index type, boost::any val); -} // namespace python_bindings \ No newline at end of file +namespace python_bindings { +namespace py = pybind11; +py::object opt_to_str(std::type_index type, boost::any val); +} // namespace python_bindings diff --git a/src/python_bindings/py_algorithm.h b/src/python_bindings/py_algorithm.h index 5ebf1a5e78..24076d2ed9 100644 --- a/src/python_bindings/py_algorithm.h +++ b/src/python_bindings/py_algorithm.h @@ -14,9 +14,9 @@ #include "config/error/type.h" #include "config/indices/type.h" #include "config/max_lhs/type.h" +#include "config/names.h" #include "config/tabular_data/input_table_type.h" #include "config/thread_number/type.h" -#include "config/names.h" #include "model/types/types.h" #include "opt_to_str.h" @@ -60,7 +60,7 @@ class PyAlgorithmBase { std::unordered_map GetOpts() { auto opt_ = algorithm_->GetOptValues(); std::unordered_map res; - for (const auto& [name,value] : opt_) { + for (const auto& [name, value] : opt_) { if (name == config::names::kTable || name == config::names::kInputFormat) { continue; }