Skip to content

Commit

Permalink
Bump numpy and pyo3 version to 0.23
Browse files Browse the repository at this point in the history
Also remove useless clippy "allow"
  • Loading branch information
jeromerobert committed Nov 29, 2024
1 parent 29d7ccf commit 072ee70
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
21 changes: 7 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ crate-type = ["cdylib"]
[dependencies]
log = "0.4.22"
tucanos = { git = "https://github.com/tucanos/tucanos.git", rev = "252380e" }
numpy = "0.22"
pyo3 = { version = "0.22", features = ["extension-module", "multiple-pymethods"] }
pyo3-log = "0.11"
numpy = "0.23"
pyo3 = { version = "0.23", features = ["extension-module", "multiple-pymethods"] }
pyo3-log = "0.12"

[features]
default = ["parry"]
Expand All @@ -32,23 +32,16 @@ all = { level = "deny", priority = -1 }
pedantic = { level = "deny", priority = -1 }
nursery = { level = "deny", priority = -1 }
cargo = { level = "deny", priority = -1 }
module_name_repetitions = "allow"
missing_panics_doc = "allow"
match_same_arms = "allow"
similar_names = "allow"
cast_possible_truncation = "allow"
missing_errors_doc = "allow"
cast_precision_loss = "allow"
multiple_crate_versions = "allow"
cargo_common_metadata = "allow"
doc_markdown = "allow"
suboptimal_flops = "allow"
many_single_char_names = "allow"
cast_sign_loss = "allow"
cast_possible_wrap = "allow"
should_panic_without_expect = "allow"
unreadable_literal = "allow"
manual_clamp = "allow"
# TODO: to remove
cognitive_complexity = "allow"
needless_pass_by_value = "allow"
ptr_as_ptr = "allow"
ptr_as_ref = "allow"
ref_as_ptr = "allow"
needless_pass_by_value = "allow"
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ use pyo3::{
};

fn to_numpy_1d<T: numpy::Element>(py: Python<'_>, vec: Vec<T>) -> Bound<'_, PyArray1<T>> {
PyArray::from_vec_bound(py, vec)
PyArray::from_vec(py, vec)
}

fn to_numpy_2d<T: numpy::Element>(py: Python<'_>, vec: Vec<T>, m: usize) -> Bound<'_, PyArray2<T>> {
let n = vec.len();
PyArray::from_vec_bound(py, vec)
PyArray::from_vec(py, vec)
.reshape([n / m, m])
.unwrap()
}
Expand Down
8 changes: 4 additions & 4 deletions src/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ macro_rules! create_mesh {
pub fn add_boundary_faces<'py>(&mut self, py: Python<'py>) ->
PyResult<(Bound<'py, PyDict>, Bound<'py, PyDict>)> {
let (bdy, ifc) = self.mesh.add_boundary_faces();
let dict_bdy = PyDict::new_bound(py);
let dict_bdy = PyDict::new(py);
for (k, v) in bdy.iter() {
dict_bdy.set_item(k, v)?;
}
let dict_ifc = PyDict::new_bound(py);
let dict_ifc = PyDict::new(py);
for (k, v) in ifc.iter() {
dict_ifc.set_item(k, to_numpy_1d(py, v.to_vec()))?;
}
Expand Down Expand Up @@ -554,7 +554,7 @@ macro_rules! create_mesh {
if let Err(res) = res {
Err(PyRuntimeError::new_err(res.to_string()))
} else {
let dict = PyDict::new_bound(py);
let dict = PyDict::new(py);
for (k, v) in res.unwrap().iter() {
dict.set_item(k, to_numpy_1d(py, v.to_vec()))?;
}
Expand All @@ -569,7 +569,7 @@ macro_rules! create_mesh {
if let Err(res) = res {
Err(PyRuntimeError::new_err(res.to_string()))
} else {
let dict = PyDict::new_bound(py);
let dict = PyDict::new(py);
for (k, v) in res.unwrap().iter() {
dict.set_item(k, to_numpy_1d(py, v.to_vec()))?;
}
Expand Down
2 changes: 1 addition & 1 deletion src/remesher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ macro_rules! create_remesher {
/// Get the default remesher parameters
pub fn default_params<'py>(&mut self, py: Python<'py>) -> Bound<'py, PyDict> {
let default_params = RemesherParams::default();
let dict = PyDict::new_bound(py);
let dict = PyDict::new(py);
dict.set_item("num_iter", default_params.num_iter).unwrap();
dict.set_item("two_steps", default_params.two_steps).unwrap();
dict.set_item("split_max_iter", default_params.split_max_iter).unwrap();
Expand Down

0 comments on commit 072ee70

Please sign in to comment.