Skip to content

Commit 9bc802f

Browse files
committed
workaround pybind11 vs fmt enum
1 parent da99e98 commit 9bc802f

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

libmambapy/src/libmambapy/bindings/utils.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -57,36 +57,36 @@ namespace mambapy
5757
{
5858
namespace py = pybind11;
5959

60-
py::enum_<fmt::emphasis>(m, "TextEmphasis")
61-
.value("Bold", fmt::emphasis::bold)
62-
.value("Faint", fmt::emphasis::faint)
63-
.value("Italic", fmt::emphasis::italic)
64-
.value("Underline", fmt::emphasis::underline)
65-
.value("Blink", fmt::emphasis::blink)
66-
.value("Reverse", fmt::emphasis::reverse)
67-
.value("Conceal", fmt::emphasis::conceal)
68-
.value("Strikethrough", fmt::emphasis::strikethrough)
69-
.def(py::init(&enum_from_str<fmt::emphasis>));
60+
auto emphasis = py::enum_<fmt::emphasis>(m, "TextEmphasis")
61+
.value("Bold", fmt::emphasis::bold)
62+
.value("Faint", fmt::emphasis::faint)
63+
.value("Italic", fmt::emphasis::italic)
64+
.value("Underline", fmt::emphasis::underline)
65+
.value("Blink", fmt::emphasis::blink)
66+
.value("Reverse", fmt::emphasis::reverse)
67+
.value("Conceal", fmt::emphasis::conceal)
68+
.value("Strikethrough", fmt::emphasis::strikethrough);
69+
emphasis.def(py::init(&enum_from_str<fmt::emphasis>));
7070
py::implicitly_convertible<py::str, fmt::emphasis>();
7171

72-
py::enum_<fmt::terminal_color>(m, "TextTerminalColor")
73-
.value("Black", fmt::terminal_color::black)
74-
.value("Red", fmt::terminal_color::red)
75-
.value("Green", fmt::terminal_color::green)
76-
.value("Yellow", fmt::terminal_color::yellow)
77-
.value("Blue", fmt::terminal_color::blue)
78-
.value("Magenta", fmt::terminal_color::magenta)
79-
.value("Cyan", fmt::terminal_color::cyan)
80-
.value("White", fmt::terminal_color::white)
81-
.value("BrightBlack", fmt::terminal_color::bright_black)
82-
.value("BrightRed", fmt::terminal_color::bright_red)
83-
.value("BrightGreen", fmt::terminal_color::bright_green)
84-
.value("BrightYellow", fmt::terminal_color::bright_yellow)
85-
.value("BrightBlue", fmt::terminal_color::bright_blue)
86-
.value("BrightMagenta", fmt::terminal_color::bright_magenta)
87-
.value("BrightCyan", fmt::terminal_color::bright_cyan)
88-
.value("BrightWhite", fmt::terminal_color::bright_white)
89-
.def(py::init(&enum_from_str<fmt::terminal_color>));
72+
auto terminal_color = py::enum_<fmt::terminal_color>(m, "TextTerminalColor")
73+
.value("Black", fmt::terminal_color::black)
74+
.value("Red", fmt::terminal_color::red)
75+
.value("Green", fmt::terminal_color::green)
76+
.value("Yellow", fmt::terminal_color::yellow)
77+
.value("Blue", fmt::terminal_color::blue)
78+
.value("Magenta", fmt::terminal_color::magenta)
79+
.value("Cyan", fmt::terminal_color::cyan)
80+
.value("White", fmt::terminal_color::white)
81+
.value("BrightBlack", fmt::terminal_color::bright_black)
82+
.value("BrightRed", fmt::terminal_color::bright_red)
83+
.value("BrightGreen", fmt::terminal_color::bright_green)
84+
.value("BrightYellow", fmt::terminal_color::bright_yellow)
85+
.value("BrightBlue", fmt::terminal_color::bright_blue)
86+
.value("BrightMagenta", fmt::terminal_color::bright_magenta)
87+
.value("BrightCyan", fmt::terminal_color::bright_cyan)
88+
.value("BrightWhite", fmt::terminal_color::bright_white);
89+
terminal_color.def(py::init(&enum_from_str<fmt::terminal_color>));
9090
py::implicitly_convertible<py::str, fmt::terminal_color>();
9191

9292
py::class_<fmt::rgb>(m, "TextRGBColor")

0 commit comments

Comments
 (0)