Removed some warnings. Updated to new pyo3 api 0.22

This commit is contained in:
Anne de Jong 2024-08-11 13:57:03 +02:00
parent c7d2cfc43f
commit 0338807507
9 changed files with 11 additions and 10 deletions

View File

@ -96,6 +96,7 @@ default = ["f64", "cpal-api", "record"]
# Use this for debugging extensions # Use this for debugging extensions
# default = ["f64", "python-bindings", "record", "cpal-api"] # default = ["f64", "python-bindings", "record", "cpal-api"]
pulse-api = []
cpal-api = ["dep:cpal"] cpal-api = ["dep:cpal"]
record = ["dep:hdf5-sys", "dep:hdf5", "dep:chrono", "dep:uuid"] record = ["dep:hdf5-sys", "dep:hdf5", "dep:chrono", "dep:uuid"]
f64 = [] f64 = []

View File

@ -32,7 +32,7 @@ pub trait Stream {
} }
/// Stream API descriptor: type and corresponding text /// Stream API descriptor: type and corresponding text
#[cfg_attr(feature = "python-bindings", pyclass)] #[cfg_attr(feature = "python-bindings", pyclass(eq, eq_int))]
#[derive(strum_macros::EnumMessage, Debug, Clone, PartialEq, Serialize, Deserialize, strum_macros::Display)] #[derive(strum_macros::EnumMessage, Debug, Clone, PartialEq, Serialize, Deserialize, strum_macros::Display)]
#[allow(dead_code)] #[allow(dead_code)]
pub enum StreamApiDescr { pub enum StreamApiDescr {

View File

@ -8,7 +8,7 @@ use crate::config::*;
/// Data type description for samples coming from a stream /// Data type description for samples coming from a stream
#[derive(strum_macros::EnumMessage, PartialEq, Copy, Debug, Clone, Serialize, Deserialize)] #[derive(strum_macros::EnumMessage, PartialEq, Copy, Debug, Clone, Serialize, Deserialize)]
#[allow(dead_code)] #[allow(dead_code)]
#[cfg_attr(feature = "python-bindings", pyclass)] #[cfg_attr(feature = "python-bindings", pyclass(eq, eq_int))]
pub enum DataType { pub enum DataType {
/// 32-bit floats /// 32-bit floats
#[strum(message = "F32", detailed_message = "32-bits floating points")] #[strum(message = "F32", detailed_message = "32-bits floating points")]

View File

@ -50,7 +50,7 @@ use api::*;
use crate::config::*; use crate::config::*;
/// Stream types that can be started /// Stream types that can be started
/// ///
#[cfg_attr(feature = "python-bindings", pyclass)] #[cfg_attr(feature = "python-bindings", pyclass(eq, eq_int))]
#[derive(PartialEq, Clone, Copy)] #[derive(PartialEq, Clone, Copy)]
pub enum StreamType { pub enum StreamType {
/// Input-only stream /// Input-only stream

View File

@ -8,7 +8,7 @@ use serde::{Serialize, Deserialize};
/// Physical quantities that are I/O of a Daq device. /// Physical quantities that are I/O of a Daq device.
#[derive(PartialEq, Serialize, Deserialize, strum_macros::EnumMessage, Debug, Clone, Copy)] #[derive(PartialEq, Serialize, Deserialize, strum_macros::EnumMessage, Debug, Clone, Copy)]
#[cfg_attr(feature = "python-bindings", pyclass)] #[cfg_attr(feature = "python-bindings", pyclass(eq, eq_int))]
#[allow(dead_code)] #[allow(dead_code)]
pub enum Qty { pub enum Qty {
/// Number /// Number

View File

@ -2,8 +2,8 @@ use strum_macros::Display;
use crate::config::*; use crate::config::*;
/// Errors that happen in a stream /// Errors that happen in a stream
#[derive(strum_macros::EnumMessage, Debug, Clone, Display, Copy)] #[derive(strum_macros::EnumMessage, PartialEq, Debug, Clone, Display, Copy)]
#[cfg_attr(feature = "python-bindings", pyclass)] #[cfg_attr(feature = "python-bindings", pyclass(eq, eq_int))]
pub enum StreamError { pub enum StreamError {
/// Input overrun /// Input overrun
#[strum( #[strum(

View File

@ -97,7 +97,7 @@ impl SeriesBiquad {
let filter_coefs = &[1., 0., 0., 1., 0., 0.]; let filter_coefs = &[1., 0., 0., 1., 0., 0.];
SeriesBiquad::new(filter_coefs).unwrap() SeriesBiquad::new(filter_coefs).unwrap()
} }
// pub fn fromZpk(ZerosOrPoles)
fn clone_dyn(&self) -> Box<dyn Filter> { fn clone_dyn(&self) -> Box<dyn Filter> {
Box::new(self.clone()) Box::new(self.clone())
} }

View File

@ -587,12 +587,12 @@ mod test {
#[test] #[test]
#[should_panic] #[should_panic]
fn test_apssettings1() { fn test_apssettings1() {
let s = ApsSettingsBuilder::default().build().unwrap(); let _ = ApsSettingsBuilder::default().build().unwrap();
} }
#[test] #[test]
fn test_apssettings2() { fn test_apssettings2() {
let s = ApsSettingsBuilder::default() let _ = ApsSettingsBuilder::default()
.nfft(2048) .nfft(2048)
.fs(1.0) .fs(1.0)
.build() .build()

View File

@ -171,7 +171,7 @@ mod test {
let tres = tb.pop(10, 5).unwrap(); let tres = tb.pop(10, 5).unwrap();
assert_eq!(tres.shape(), [10, 1]); assert_eq!(tres.shape(), [10, 1]);
assert_eq!(tb.nsamples(), 15); assert_eq!(tb.nsamples(), 15);
let tres = tb.pop(10, 0).unwrap(); let _ = tb.pop(10, 0).unwrap();
assert_eq!(tb.nsamples(), 5); assert_eq!(tb.nsamples(), 5);
let tres = tb.pop(5, 5).unwrap(); let tres = tb.pop(5, 5).unwrap();
assert_eq!(tres.shape(), [5, 1]); assert_eq!(tres.shape(), [5, 1]);