From c4263e6c8fee0a69663750fa145f6f52ea88ab01 Mon Sep 17 00:00:00 2001 From: haixuanTao Date: Mon, 17 Jun 2024 11:00:52 +0200 Subject: [PATCH] Remove bound from definition of .to_py_dict --- apis/python/node/src/lib.rs | 4 ++-- apis/python/operator/src/lib.rs | 2 +- binaries/runtime/src/operator/python.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apis/python/node/src/lib.rs b/apis/python/node/src/lib.rs index fe090354..45125ec0 100644 --- a/apis/python/node/src/lib.rs +++ b/apis/python/node/src/lib.rs @@ -74,7 +74,7 @@ impl Node { let event = py.allow_threads(|| self.events.recv(timeout.map(Duration::from_secs_f32))); if let Some(event) = event { let dict = event - .to_py_dict_bound(py) + .to_py_dict(py) .context("Could not convert event into a dict")?; Ok(Some(dict)) } else { @@ -96,7 +96,7 @@ impl Node { /// /// :rtype: dict pub fn __next__(&mut self, py: Python) -> PyResult>> { - self.next(py, Some(2.0)) + self.next(py, None) } /// You can iterate over the event stream with a loop diff --git a/apis/python/operator/src/lib.rs b/apis/python/operator/src/lib.rs index 2f667579..2c027e9a 100644 --- a/apis/python/operator/src/lib.rs +++ b/apis/python/operator/src/lib.rs @@ -16,7 +16,7 @@ pub struct PyEvent { } impl PyEvent { - pub fn to_py_dict_bound(self, py: Python<'_>) -> PyResult> { + pub fn to_py_dict(self, py: Python<'_>) -> PyResult> { let mut pydict = HashMap::new(); match &self.event { MergedEvent::Dora(_) => pydict.insert("kind", "dora".to_object(py)), diff --git a/binaries/runtime/src/operator/python.rs b/binaries/runtime/src/operator/python.rs index 366b9482..fa488388 100644 --- a/binaries/runtime/src/operator/python.rs +++ b/binaries/runtime/src/operator/python.rs @@ -209,7 +209,7 @@ pub fn run( } let py_event = PyEvent::from(event) - .to_py_dict_bound(py) + .to_py_dict(py) .context("Could not convert event to pydict bound")?; let status_enum = operator