refactor(py): update the type stubs (and expose DType)

This commit is contained in:
Anand Balakrishnan 2023-05-04 13:33:56 -07:00
parent 9b07df440b
commit 31c65a4734
No known key found for this signature in database
10 changed files with 102 additions and 56 deletions

View file

@ -7,8 +7,8 @@ use pyo3::prelude::*;
use pyo3::types::{PyDict, PyString};
use crate::expr::PyBoolExpr;
use crate::signals::{BoolSignal, FloatSignal, IntSignal, Kind, PySignal, UnsignedIntSignal};
use crate::PyArgusError;
use crate::signals::{BoolSignal, FloatSignal, IntSignal, PySignal, UnsignedIntSignal};
use crate::{DType, PyArgusError};
#[derive(Debug, Clone, derive_more::From, derive_more::TryInto)]
#[try_into(owned, ref, ref_mut)]
@ -42,16 +42,16 @@ impl PyTrace {
})?;
let kind = val.borrow().kind;
let signal: SignalKind = match kind {
Kind::Bool => val.downcast::<PyCell<BoolSignal>>().unwrap().borrow().0.clone().into(),
Kind::Int => val.downcast::<PyCell<IntSignal>>().unwrap().borrow().0.clone().into(),
Kind::UnsignedInt => val
DType::Bool => val.downcast::<PyCell<BoolSignal>>().unwrap().borrow().0.clone().into(),
DType::Int => val.downcast::<PyCell<IntSignal>>().unwrap().borrow().0.clone().into(),
DType::UnsignedInt => val
.downcast::<PyCell<UnsignedIntSignal>>()
.unwrap()
.borrow()
.0
.clone()
.into(),
Kind::Float => val.downcast::<PyCell<FloatSignal>>().unwrap().borrow().0.clone().into(),
DType::Float => val.downcast::<PyCell<FloatSignal>>().unwrap().borrow().0.clone().into(),
};
signals.insert(key.to_string(), signal);