Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-o-how committed Sep 13, 2024
1 parent 423d41d commit b62d9d4
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion crates/chia-bls/src/gtelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl GTElement {

#[classmethod]
#[pyo3(name = "from_parent")]
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: Self) -> PyResult<PyObject> {
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult<PyObject> {
Err(PyNotImplementedError::new_err(
"GTElement does not support from_parent().",
))
Expand Down
2 changes: 1 addition & 1 deletion crates/chia-bls/src/public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl PublicKey {

#[classmethod]
#[pyo3(name = "from_parent")]
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: Self) -> PyResult<PyObject> {
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult<PyObject> {
Err(PyNotImplementedError::new_err(
"PublicKey does not support from_parent().",
))
Expand Down
2 changes: 1 addition & 1 deletion crates/chia-bls/src/secret_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ impl SecretKey {

#[classmethod]
#[pyo3(name = "from_parent")]
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: Self) -> PyResult<PyObject> {
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult<PyObject> {
Err(PyNotImplementedError::new_err(
"SecretKey does not support from_parent().",
))
Expand Down
6 changes: 1 addition & 5 deletions crates/chia-bls/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,7 @@ impl Signature {

#[classmethod]
#[pyo3(name = "from_parent")]
pub fn from_parent(
_cls: &Bound<'_, PyType>,
_py: Python<'_>,
_instance: Self,
) -> PyResult<PyObject> {
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult<PyObject> {
Err(PyNotImplementedError::new_err(
"Signature does not support from_parent().",
))
Expand Down
4 changes: 2 additions & 2 deletions crates/chia-consensus/src/gen/owned_conditions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ fn convert_agg_sigs(a: &Allocator, agg_sigs: &[(PublicKey, NodePtr)]) -> Vec<(Pu
impl OwnedSpendConditions {
#[classmethod]
#[pyo3(name = "from_parent")]
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: Self) -> PyResult<PyObject> {
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult<PyObject> {
Err(PyNotImplementedError::new_err(
"OwnedSpendConditions does not support from_parent().",
))
Expand All @@ -169,7 +169,7 @@ impl OwnedSpendConditions {
impl OwnedSpendBundleConditions {
#[classmethod]
#[pyo3(name = "from_parent")]
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: Self) -> PyResult<PyObject> {
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult<PyObject> {
Err(PyNotImplementedError::new_err(
"OwnedSpendBundleConditions does not support from_parent().",
))
Expand Down
2 changes: 1 addition & 1 deletion crates/chia-protocol/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ impl ToJsonDict for Program {
impl Program {
#[classmethod]
#[pyo3(name = "from_parent")]
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: Self) -> PyResult<PyObject> {
pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult<PyObject> {
Err(PyNotImplementedError::new_err(
"This class does not support from_parent().",
))
Expand Down
40 changes: 22 additions & 18 deletions crates/chia-protocol/src/spend_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,31 +98,35 @@ impl SpendBundle {
impl SpendBundle {
#[classmethod]
#[pyo3(name = "aggregate")]
fn py_aggregate(cls: &Bound<'_, PyType>, spend_bundles: Vec<Self>) -> PyResult<PyObject> {
fn py_aggregate(
cls: &Bound<'_, PyType>,
py: Python<'_>,
spend_bundles: Vec<Self>,
) -> PyResult<PyObject> {
let aggregated = Self::aggregate(&spend_bundles);
Python::with_gil(|py| {
// Convert result into potential child class
let instance = cls.call(
(aggregated.coin_spends, aggregated.aggregated_signature),
None,
)?;
// Convert result into potential child class
let instance = cls.call(
(aggregated.coin_spends, aggregated.aggregated_signature),
None,
)?;

Ok(instance.into_py(py))
})
Ok(instance.into_py(py))
}

#[classmethod]
#[pyo3(name = "from_parent")]
pub fn from_parent(cls: &Bound<'_, PyType>, spend_bundle: Self) -> PyResult<PyObject> {
Python::with_gil(|py| {
// Convert result into potential child class
let instance = cls.call(
(spend_bundle.coin_spends, spend_bundle.aggregated_signature),
None,
)?;
pub fn from_parent(
cls: &Bound<'_, PyType>,
py: Python<'_>,
spend_bundle: Self,
) -> PyResult<PyObject> {
// Convert result into potential child class
let instance = cls.call(
(spend_bundle.coin_spends, spend_bundle.aggregated_signature),
None,
)?;

Ok(instance.into_py(py))
})
Ok(instance.into_py(py))
}

#[pyo3(name = "name")]
Expand Down

0 comments on commit b62d9d4

Please sign in to comment.