feat(pyargus): add __str__ methods for Expr

This commit is contained in:
Anand Balakrishnan 2023-10-13 16:18:02 -07:00
parent 69daf21abe
commit fb72e60a0a

View file

@ -65,6 +65,10 @@ impl PyNumExpr {
format!("{:?}", &self.0) format!("{:?}", &self.0)
} }
fn __str__(&self) -> String {
format!("{}", self.0)
}
fn __neg__(&self) -> PyResult<Py<Negate>> { fn __neg__(&self) -> PyResult<Py<Negate>> {
Python::with_gil(|py| Py::new(py, Negate::new(self.clone()))) Python::with_gil(|py| Py::new(py, Negate::new(self.clone())))
} }
@ -308,6 +312,10 @@ impl PyBoolExpr {
format!("{:?}", &self.0) format!("{:?}", &self.0)
} }
fn __str__(&self) -> String {
format!("{}", self.0)
}
fn __invert__(&self) -> PyResult<Py<Not>> { fn __invert__(&self) -> PyResult<Py<Not>> {
Python::with_gil(|py| Py::new(py, Not::new(self.clone()))) Python::with_gil(|py| Py::new(py, Not::new(self.clone())))
} }