Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catchup: into long_lived/initial_datalayer from main @ fd65c4feb6e5131f4916bf25f7637f99b81a1c02 #924

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion crates/chia_py_streamable_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,32 @@ pub fn py_json_dict_macro(input: proc_macro::TokenStream) -> proc_macro::TokenSt
}
});
}
syn::Fields::Unnamed(FieldsUnnamed { unnamed, .. }) if unnamed.len() == 1 => {
let ftype: syn::Type = unnamed
.first()
.expect("match arm if requires 1 item")
.ty
.clone();

py_protocol.extend( quote! {

impl #crate_name::to_json_dict::ToJsonDict for #ident {
fn to_json_dict(&self, py: pyo3::Python) -> pyo3::PyResult<pyo3::PyObject> {
Ok(self.0.to_json_dict(py)?.into())
}
}

impl #crate_name::from_json_dict::FromJsonDict for #ident {
fn from_json_dict(o: &pyo3::Bound<pyo3::PyAny>) -> pyo3::PyResult<Self> {
Ok(Self(
<#ftype as #crate_name::from_json_dict::FromJsonDict>::from_json_dict(&o)?
))
}
}
});
}
_ => {
panic!("PyJsonDict only supports structs");
panic!("PyJsonDict only supports named structs and single field unnamed structs");
}
}

Expand Down
14 changes: 5 additions & 9 deletions wheel/stubtest.allowlist.3-11-plus
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# TODO: ask stubtest/mypy about these as they seem unlikely to be our doing
chia_rs\.sized_byte_class\.TypeVar\.__bound__
chia_rs\.sized_byte_class\.TypeVar\.__constraints__
chia_rs\.sized_byte_class\.TypeVar\.__contravariant__
chia_rs\.sized_byte_class\.TypeVar\.__covariant__

chia_rs\.struct_stream\.TypeVar\.__bound__
chia_rs\.struct_stream\.TypeVar\.__constraints__
chia_rs\.struct_stream\.TypeVar\.__contravariant__
chia_rs\.struct_stream\.TypeVar\.__covariant__
chia_rs\..*\.TypeVar\.__init__
chia_rs\..*\.TypeVar\.__bound__
chia_rs\..*\.TypeVar\.__constraints__
chia_rs\..*\.TypeVar\.__contravariant__
chia_rs\..*\.TypeVar\.__covariant__
Loading