This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch python-layer
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/python-layer by this push:
new e82c681c0 Use PyClassInitializer instead
e82c681c0 is described below
commit e82c681c00b662cb75de2c1bd3ec60993656fc48
Author: Xuanwo <[email protected]>
AuthorDate: Thu Nov 2 15:14:41 2023 +0800
Use PyClassInitializer instead
Signed-off-by: Xuanwo <[email protected]>
---
bindings/python/src/layers.rs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/bindings/python/src/layers.rs b/bindings/python/src/layers.rs
index 52b33d559..c3c9a8cc9 100644
--- a/bindings/python/src/layers.rs
+++ b/bindings/python/src/layers.rs
@@ -54,7 +54,7 @@ impl RetryLayer {
jitter: bool,
max_delay: Option<f64>,
min_delay: Option<f64>,
- ) -> PyResult<(Self, Layer)> {
+ ) -> PyResult<PyClassInitializer<Self>> {
let mut retry = od::layers::RetryLayer::default();
if let Some(max_times) = max_times {
retry = retry.with_max_times(max_times);
@@ -73,8 +73,10 @@ impl RetryLayer {
}
let retry_layer = Self(retry);
+ let class =
PyClassInitializer::from(Layer(Box::new(retry_layer.clone())))
+ .add_subclass(retry_layer);
- Ok((retry_layer.clone(), Layer(Box::new(retry_layer))))
+ Ok(class)
}
}