From 8ee787ea9aee644ad4f678aa036e8598c125a247 Mon Sep 17 00:00:00 2001 From: VirxEC Date: Sat, 22 Jun 2024 20:38:08 -0400 Subject: [PATCH] Fix bug in pyi generation --- codegen/pyi.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codegen/pyi.rs b/codegen/pyi.rs index f957ec6..d037033 100644 --- a/codegen/pyi.rs +++ b/codegen/pyi.rs @@ -125,7 +125,7 @@ pub fn generator(type_data: &[PythonBindType]) -> io::Result<()> { } RustType::Option(InnerOptionType::Custom, type_name) | RustType::Option(InnerOptionType::Box, type_name) => { - python_types.push(format!("Optional[{type_name}]")); + write_fmt!(file, " {variable_name}: Optional[{type_name}]"); let python_type = if type_name == "Float" { "Float | float" @@ -134,8 +134,8 @@ pub fn generator(type_data: &[PythonBindType]) -> io::Result<()> { } else { type_name.as_str() }; - - write_fmt!(file, " {variable_name}: Optional[{python_type}]"); + + python_types.push(format!("Optional[{python_type}]")); } RustType::Box(inner_type) => { python_types.push(inner_type.to_string());