From d7624311f60df5c262ed0cd5bd273e1f2362b2c7 Mon Sep 17 00:00:00 2001
From: stefan-gorules <127550877+stefan-gorules@users.noreply.github.com>
Date: Sat, 15 Feb 2025 21:46:55 +0100
Subject: [PATCH] fix: py validate methods (#316)
* fix: py validate methods
* fix
---
bindings/python/Cargo.toml | 1 -
bindings/python/src/expression.rs | 29 +++------
bindings/python/src/lib.rs | 6 +-
bindings/python/zen.pyi | 3 +-
core/expression/src/validate.rs | 101 +++---------------------------
5 files changed, 22 insertions(+), 118 deletions(-)
diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml
index e38b44a8..b09e865d 100644
--- a/bindings/python/Cargo.toml
+++ b/bindings/python/Cargo.toml
@@ -11,7 +11,6 @@ crate-type = ["cdylib"]
[dependencies]
anyhow = { workspace = true }
-bumpalo = "3"
either = "1.13"
pyo3 = { version = "0.23", features = ["anyhow", "serde", "either"] }
pyo3-async-runtimes = { version = "0.23", features = ["tokio-runtime", "attributes"] }
diff --git a/bindings/python/src/expression.rs b/bindings/python/src/expression.rs
index 2d32d013..2cd3b31a 100644
--- a/bindings/python/src/expression.rs
+++ b/bindings/python/src/expression.rs
@@ -1,11 +1,10 @@
use crate::variable::PyVariable;
use anyhow::{anyhow, Context};
use either::Either;
-use pyo3::types::{PyAnyMethods, PyDict};
+use pyo3::types::PyDict;
use pyo3::{pyclass, pyfunction, pymethods, Bound, IntoPyObjectExt, Py, PyAny, PyResult, Python};
-use pythonize::depythonize;
+use pythonize::{depythonize, pythonize};
use zen_expression::expression::{Standard, Unary};
-use zen_expression::validate::{validate_expression, validate_unary_expression, ValidationError};
use zen_expression::{Expression, Variable};
#[pyfunction]
@@ -100,29 +99,19 @@ impl PyExpression {
}
#[pyfunction]
-#[pyo3(name = "validate_expression")]
-pub fn py_validate_expression(py: Python, expression: String) -> PyResult