Skip to content

Commit

Permalink
Fix bug in pyi generation
Browse files Browse the repository at this point in the history
  • Loading branch information
VirxEC committed Jun 23, 2024
1 parent 8b6706b commit 8ee787e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions codegen/pyi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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());
Expand Down

0 comments on commit 8ee787e

Please sign in to comment.