Skip to content

Commit

Permalink
fix: typing.Any is not imported for List[Any] (close #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gowee committed Jun 22, 2023
1 parent b80e2ce commit e2d42bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/target/python_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,11 @@ fn write_output(
);
}
}
Type::Array(_) => {
Type::Array(inner) => {
imports_from_typing.insert("List");
if schema.arena.get(inner).unwrap().is_any() {
imports_from_typing.insert("Any");
}
}
_ => {}
}
Expand Down
5 changes: 4 additions & 1 deletion src/target/python_inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ fn write_output(
});
}
}
Type::Array(_) => {
Type::Array(inner) => {
imports_from_typing.insert("List");
if schema.arena.get(inner).unwrap().is_any() {
imports_from_typing.insert("Any");
}
}
_ => {}
}
Expand Down

0 comments on commit e2d42bf

Please sign in to comment.