mirror of
https://github.com/gorules/zen.git
synced 2026-10-04 16:02:18 +00:00
feat: date v2 (#345)
* feat: date v2 * implement more date functions * improve type safety * add more methods for dates * update utc to tz and add support * add unary node behaviour for date methods * add tests; fix errors in bindings * add date operators * fix types * change set date signature * update nightly
This commit is contained in:
@@ -2,7 +2,7 @@ use anyhow::Context;
|
||||
use pyo3::prelude::{PyAnyMethods, PyBytesMethods, PyDictMethods, PyListMethods, PyStringMethods};
|
||||
use pyo3::types::{PyBytes, PyDict, PyList, PyString};
|
||||
use pyo3::{Bound, FromPyObject, IntoPyObject, IntoPyObjectExt, PyAny, PyErr, PyResult, Python};
|
||||
use pythonize::depythonize;
|
||||
use pythonize::{depythonize, pythonize};
|
||||
use rust_decimal::prelude::ToPrimitive;
|
||||
use zen_expression::Variable;
|
||||
|
||||
@@ -40,11 +40,12 @@ pub fn variable_to_object<'py>(py: Python<'py>, val: &Variable) -> PyResult<Boun
|
||||
let dict = PyDict::new(py);
|
||||
let b = m.borrow();
|
||||
for (key, value) in b.iter() {
|
||||
dict.set_item(key, variable_to_object(py, value)?)?;
|
||||
dict.set_item(String::from(key.as_ref()), variable_to_object(py, value)?)?;
|
||||
}
|
||||
|
||||
dict.into_bound_py_any(py)
|
||||
}
|
||||
Variable::Dynamic(d) => Ok(pythonize(py, &d.to_value())?),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user