From 294527085e9ca48a8057ba6ec366c3c8218e2151 Mon Sep 17 00:00:00 2001 From: James Pace Date: Fri, 14 Aug 2026 14:00:46 -0400 Subject: [PATCH] Add constructors. --- src/lib.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 754e496..145d2d3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,6 +44,14 @@ impl DiagnosticLevel { } } +#[pymethods] +impl DiagnosticLevel { + #[new] + pub fn new() -> Self { + Self::UNSET + } +} + #[pyclass] pub struct DiagnosticStatus { #[pyo3(get, set)] @@ -58,6 +66,20 @@ pub struct DiagnosticStatus { values: Py, } +#[pymethods] +impl DiagnosticStatus { + #[new] + pub fn new(py: Python<'_>) -> Self { + Self { + level: DiagnosticLevel::new(), + name: PyString::new(py, "").unbind(), + message: PyString::new(py, "").unbind(), + hardware_id: PyString::new(py, "").unbind(), + values: PyDict::new(py).unbind(), + } + } +} + impl DiagnosticStatus { fn from_rust<'py>( py: Python<'py>,