Skip to content

Commit

Permalink
Fix formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonspeed committed Apr 12, 2024
1 parent 39a96e4 commit 3d78fb2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
8 changes: 4 additions & 4 deletions py-polars/src/series/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl PySeries {
/// be handled on the Python side in a zero-copy manner.
///
/// This method will cast integers to floats so that `null = np.nan`.
#[allow(deprecated)] // This will be removed as part of #15215
#[allow(deprecated)] // This will be removed as part of #15215
fn to_numpy(&self, py: Python) -> PyResult<PyObject> {
use DataType::*;
let s = &self.series;
Expand Down Expand Up @@ -250,7 +250,7 @@ where
Some(v) => NumCast::from(v).unwrap(),
None => U::nan(),
};
#[allow(deprecated)] // This will be removed as part of #15215
#[allow(deprecated)] // This will be removed as part of #15215
let np_arr = PyArray1::from_iter(py, ca.iter().map(mapper));
np_arr.into_py(py)
}
Expand All @@ -262,15 +262,15 @@ fn date_series_to_numpy(py: Python, s: &Series) -> PyObject {
Some(v) => v as i64,
None => i64::MIN,
};
#[allow(deprecated)] // This will be removed as part of #15215
#[allow(deprecated)] // This will be removed as part of #15215
let np_arr = PyArray1::from_iter(py, ca.iter().map(mapper));
np_arr.into_py(py)
}
/// Convert datetimes and durations with i64::MIN representing a null value
fn temporal_series_to_numpy(py: Python, s: &Series) -> PyObject {
let s_phys = s.to_physical_repr();
let ca = s_phys.i64().unwrap();
#[allow(deprecated)] // This will be removed as part of #15215
#[allow(deprecated)] // This will be removed as part of #15215
let np_arr = PyArray1::from_iter(py, ca.iter().map(|v| v.unwrap_or(i64::MIN)));
np_arr.into_py(py)
}
9 changes: 6 additions & 3 deletions py-polars/src/series/numpy_ufunc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ unsafe fn aligned_array<T: Element + NativeType>(
let ptr = PY_ARRAY_API.PyArray_NewFromDescr(
py,
PY_ARRAY_API.get_type_object(py, npyffi::NpyTypes::PyArray_Type),
#[allow(deprecated)] // This will be removed as part of #15215
#[allow(deprecated)] // This will be removed as part of #15215
T::get_dtype(py).into_dtype_ptr(),
dims.ndim_cint(),
dims.as_dims_ptr(),
Expand All @@ -44,8 +44,11 @@ unsafe fn aligned_array<T: Element + NativeType>(
flags::NPY_ARRAY_OUT_ARRAY, // flag
ptr::null_mut(), //obj
);
(#[allow(deprecated)] // This will be removed as part of #15215
PyArray1::from_owned_ptr(py, ptr), buf)
(
#[allow(deprecated)] // This will be removed as part of #15215
PyArray1::from_owned_ptr(py, ptr),
buf,
)
}

/// Get reference counter for numpy arrays.
Expand Down
2 changes: 1 addition & 1 deletion py-polars/src/to_numpy.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(deprecated)] // This will be removed as part of #15215
#![allow(deprecated)] // This will be removed as part of #15215
use std::ffi::{c_int, c_void};

use ndarray::{Dim, Dimension, IntoDimension};
Expand Down

0 comments on commit 3d78fb2

Please sign in to comment.