Skip to content

Commit

Permalink
Refactor numpy serializer
Browse files Browse the repository at this point in the history
Signed-off-by: Emanuele Giaquinta <[email protected]>
  • Loading branch information
exg committed Dec 28, 2024
1 parent a98466d commit 531cc95
Show file tree
Hide file tree
Showing 3 changed files with 366 additions and 635 deletions.
23 changes: 15 additions & 8 deletions src/serialize/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,23 @@ impl Serialize for DictWithNonStrKeys {
)?;
} else {
match pyobject_to_obtype(key.as_ptr(), opts) {
ObType::NumpyScalar
| ObType::NumpyArray
| ObType::Dict
| ObType::List
| ObType::Dataclass
| ObType::Pydantic
| ObType::Unknown => {
ObType::Bool
| ObType::Bytes
| ObType::Date
| ObType::Datetime
| ObType::Enum
| ObType::Ext
| ObType::Float
| ObType::Int
| ObType::None
| ObType::Str
| ObType::StrSubclass
| ObType::Time
| ObType::Tuple
| ObType::Uuid => (),
_ => {
err!("Dict key must a type serializable with OPT_NON_STR_KEYS")
}
_ => (),
}
map.serialize_entry(
&PyObject::new(
Expand Down
Loading

0 comments on commit 531cc95

Please sign in to comment.