Skip to content

Commit

Permalink
fix(python): Use strings to expose ClosedInterval in expr IR (#16369)
Browse files Browse the repository at this point in the history
  • Loading branch information
wence- authored May 21, 2024
1 parent 233386b commit c334c70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
17 changes: 4 additions & 13 deletions py-polars/src/lazyframe/visitor/expr_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,13 @@ pub struct Literal {
dtype: PyObject,
}

#[pyclass(name = "ClosedInterval")]
#[derive(Copy, Clone)]
pub enum PyClosedInterval {
Both,
Left,
Right,
None,
}

impl IntoPy<PyObject> for Wrap<ClosedInterval> {
fn into_py(self, py: Python<'_>) -> PyObject {
match self.0 {
ClosedInterval::Both => PyClosedInterval::Both,
ClosedInterval::Left => PyClosedInterval::Left,
ClosedInterval::Right => PyClosedInterval::Right,
ClosedInterval::None => PyClosedInterval::None,
ClosedInterval::Both => "both",
ClosedInterval::Left => "left",
ClosedInterval::Right => "right",
ClosedInterval::None => "none",
}
.into_py(py)
}
Expand Down
1 change: 0 additions & 1 deletion py-polars/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ fn _expr_nodes(_py: Python, m: &Bound<PyModule>) -> PyResult<()> {
m.add_class::<PyOperator>().unwrap();
m.add_class::<PyStringFunction>().unwrap();
m.add_class::<PyBooleanFunction>().unwrap();
m.add_class::<PyClosedInterval>().unwrap();
// Options
m.add_class::<PyWindowMapping>().unwrap();
m.add_class::<PyRollingGroupOptions>().unwrap();
Expand Down

0 comments on commit c334c70

Please sign in to comment.