MCPcopy Create free account
hub / github.com/YuminosukeSato/ironkernel / map

Method map

src/python/py_kernel.rs:111–137  ·  view source on GitHub ↗
(
        &self,
        spec: &PyKernelSpec,
        kwargs: Option<&Bound<'_, pyo3::types::PyDict>>,
    )

Source from the content-addressed store, hash-verified

109 /// Map a kernel spec over named arguments, returning a `MapSpec` for `rt.go()`.
110 #[pyo3(signature = (spec, **kwargs))]
111 fn map(
112 &self,
113 spec: &PyKernelSpec,
114 kwargs: Option<&Bound<'_, pyo3::types::PyDict>>,
115 ) -> PyResult<PyMapSpec> {
116 let mut arg_map: HashMap<String, ArgValue> = HashMap::new();
117 if let Some(kw) = kwargs {
118 for (key, val) in kw {
119 let name: String = key.extract()?;
120 if let Ok(buf) = val.extract::<PyBuffer>() {
121 arg_map.insert(name, ArgValue::Buffer(buf.inner));
122 } else if let Ok(v) = val.extract::<i64>() {
123 arg_map.insert(name, ArgValue::Scalar(v as f64));
124 } else if let Ok(v) = val.extract::<f64>() {
125 arg_map.insert(name, ArgValue::Scalar(v));
126 } else {
127 return Err(PyErr::new::<pyo3::exceptions::PyTypeError, _>(format!(
128 "argument '{name}' must be Buffer or numeric"
129 )));
130 }
131 }
132 }
133 Ok(PyMapSpec {
134 spec: spec.clone(),
135 args: arg_map,
136 })
137 }
138
139 // --- Math functions (unary: inherit temp_args) ---
140

Callers 15

merge_temp_argsFunction · 0.45
rewrite_args_internalMethod · 0.45
get_temp_argsMethod · 0.45
execute_callable_outcomeFunction · 0.45
goMethod · 0.45
argsMethod · 0.45
elementwiseMethod · 0.45
where_exprMethod · 0.45
execute_mapFunction · 0.45
args_all_unique_temp_idsFunction · 0.45
map_with_kwargsFunction · 0.45

Calls 1

BufferClass · 0.85

Tested by 15

args_all_unique_temp_idsFunction · 0.36
map_with_kwargsFunction · 0.36
map_with_scalar_kwargFunction · 0.36
map_with_int_kwargFunction · 0.36
map_with_no_kwargsFunction · 0.36
saxpy_1m_elementsFunction · 0.36
reduce_sum_largeFunction · 0.36
reduce_meanFunction · 0.36
eval_at_par_thresholdFunction · 0.36