Skip to content

Commit 5164337

Browse files
authored
Merge pull request #31 from m-clare/maryanne/fix-deprecation-warnings
fix: address compilation warnings
2 parents 67f984a + 21fadb6 commit 5164337

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/lib.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::io::BufReader;
33

44
use ::e57::{CartesianCoordinate, E57Reader};
55
use ndarray::Ix2;
6-
use numpy::PyArray;
6+
use numpy::{PyArray, PyArrayMethods};
77
use pyo3::prelude::*;
88

99
#[pyclass]
@@ -81,24 +81,24 @@ unsafe fn read_points(py: Python<'_>, filepath: &str) -> PyResult<E57> {
8181
let n_intensities = intensity_vec.len();
8282
let mut e57 = E57 {
8383
points: Py::from(
84-
PyArray::from_vec(py, point_vec)
85-
.reshape((nrows, 3))
84+
PyArray::from_vec_bound(py, point_vec)
85+
.reshape([nrows, 3])
8686
.unwrap(),
8787
),
88-
color: Py::from(PyArray::new(py, (0, 3), false)),
89-
intensity: Py::from(PyArray::new(py, (0, 1), false)),
88+
color: Py::from(PyArray::new_bound(py, (0, 3), false)),
89+
intensity: Py::from(PyArray::new_bound(py, (0, 1), false)),
9090
};
9191
if n_colors == n_points {
9292
e57.color = Py::from(
93-
PyArray::from_vec(py, color_vec)
94-
.reshape((nrows, 3))
93+
PyArray::from_vec_bound(py, color_vec)
94+
.reshape([nrows, 3])
9595
.unwrap(),
9696
)
9797
}
9898
if n_intensities == n_points {
9999
e57.intensity = Py::from(
100-
PyArray::from_vec(py, intensity_vec)
101-
.reshape((nrows, 1))
100+
PyArray::from_vec_bound(py, intensity_vec)
101+
.reshape([nrows, 1])
102102
.unwrap(),
103103
)
104104
}
@@ -107,7 +107,7 @@ unsafe fn read_points(py: Python<'_>, filepath: &str) -> PyResult<E57> {
107107

108108
/// e57 pointcloud file reading.
109109
#[pymodule]
110-
fn e57(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
110+
fn e57(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
111111
m.add_class::<E57>()?;
112112
m.add_function(wrap_pyfunction!(raw_xml, m)?)?;
113113
m.add_function(wrap_pyfunction!(read_points, m)?)?;

0 commit comments

Comments
 (0)