| 99 | } |
| 100 | |
| 101 | DefineList defineListFromPython(const pybind11::dict& dict) |
| 102 | { |
| 103 | DefineList defines; |
| 104 | for (const auto& [key, value] : dict) |
| 105 | { |
| 106 | if (!pybind11::isinstance<pybind11::str>(key)) |
| 107 | FALCOR_THROW("Define key must be a string."); |
| 108 | auto keyStr = key.cast<std::string>(); |
| 109 | if (pybind11::isinstance<pybind11::str>(value)) |
| 110 | defines.add(keyStr, value.cast<std::string>()); |
| 111 | else if (pybind11::isinstance<pybind11::bool_>(value)) |
| 112 | defines.add(keyStr, value.cast<bool>() ? "1" : "0"); |
| 113 | else if (pybind11::isinstance<pybind11::int_>(value)) |
| 114 | defines.add(keyStr, std::to_string(value.cast<int64_t>())); |
| 115 | else |
| 116 | FALCOR_THROW("Define value for key '{}' must be a string, bool, or int.", keyStr); |
| 117 | } |
| 118 | return defines; |
| 119 | } |
| 120 | |
| 121 | pybind11::dict typeConformanceListToPython(const TypeConformanceList& conformances) |
| 122 | { |
no test coverage detected