MCPcopy Create free account
hub / github.com/dds-bridge/dds / sequence_to_int_vector

Function sequence_to_int_vector

python/src/converters.cpp:15–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13constexpr int MaxSuitBitmask = 0x7FFC;
14
15auto sequence_to_int_vector(
16 const py::sequence& values,
17 const std::size_t expected_size,
18 const std::string& field_name) -> std::vector<int>
19{
20 if (values.size() != expected_size) {
21 throw py::value_error(field_name + " must have size " + std::to_string(expected_size));
22 }
23
24 std::vector<int> result;
25 result.reserve(expected_size);
26 for (const py::handle value : values) {
27 result.push_back(py::cast<int>(value));
28 }
29
30 return result;
31}
32
33auto sequence_to_bounded_int_vector(
34 const py::sequence& values,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected