This is an automated email from the ASF dual-hosted git repository.

manjusaka pushed a commit to branch manjusaka/fix-operator-error
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/manjusaka/fix-operator-error 
by this push:
     new e324c42eb Update code
e324c42eb is described below

commit e324c42ebce95283f9f02ba8e8c30b67d35a7587
Author: Manjusaka <[email protected]>
AuthorDate: Wed Nov 8 22:30:47 2023 +0800

    Update code
    
    Signed-off-by: Manjusaka <[email protected]>
---
 bindings/python/python/opendal/__init__.pyi  | 4 ++--
 bindings/python/src/operator.rs              | 9 ++++++---
 bindings/python/tests/conftest.py            | 2 +-
 core/src/types/operator/blocking_operator.rs | 6 ------
 4 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/bindings/python/python/opendal/__init__.pyi 
b/bindings/python/python/opendal/__init__.pyi
index b73c0a5f9..03f702337 100644
--- a/bindings/python/python/opendal/__init__.pyi
+++ b/bindings/python/python/opendal/__init__.pyi
@@ -43,6 +43,7 @@ class Operator:
     def copy(self, source: str, target: str): ...
     def rename(self, source: str, target: str): ...
     def remove_all(self, path: str): ...
+    def to_async_operator(self) -> AsyncOperator: ...
 
 class AsyncOperator:
     def __init__(self, scheme: str, **kwargs): ...
@@ -73,8 +74,7 @@ class AsyncOperator:
     async def copy(self, source: str, target: str): ...
     async def rename(self, source: str, target: str): ...
     async def remove_all(self, path: str): ...
-    @property
-    def operator(self) -> Operator: ...
+    def to_operator(self) -> Operator: ...
 
 class File:
     def read(self, size: Optional[int] = None) -> memoryview: ...
diff --git a/bindings/python/src/operator.rs b/bindings/python/src/operator.rs
index 3c16882b3..19908bffe 100644
--- a/bindings/python/src/operator.rs
+++ b/bindings/python/src/operator.rs
@@ -184,6 +184,10 @@ impl Operator {
         Ok(capability::Capability::new(self.0.info().full_capability()))
     }
 
+    pub fn to_async_operator(&self) -> PyResult<AsyncOperator> {
+        Ok(AsyncOperator(self.0.clone().into()))
+    }
+
     fn __repr__(&self) -> String {
         let info = self.0.info();
         let name = info.name();
@@ -454,9 +458,8 @@ impl AsyncOperator {
     pub fn capability(&self) -> PyResult<capability::Capability> {
         Ok(capability::Capability::new(self.0.info().full_capability()))
     }
-    
-    #[getter]
-    pub fn operator(&self) -> PyResult<Operator> {
+
+    pub fn to_operator(&self) -> PyResult<Operator> {
         Ok(Operator(self.0.clone().blocking()))
     }
 
diff --git a/bindings/python/tests/conftest.py 
b/bindings/python/tests/conftest.py
index 498ef5444..3385ee3f7 100644
--- a/bindings/python/tests/conftest.py
+++ b/bindings/python/tests/conftest.py
@@ -63,7 +63,7 @@ def async_operator(service_name, setup_config):
 
 @pytest.fixture(scope="session")
 def operator(async_operator):
-    return async_operator.operator
+    return async_operator.to_operator()
 
 
 @pytest.fixture(autouse=True)
diff --git a/core/src/types/operator/blocking_operator.rs 
b/core/src/types/operator/blocking_operator.rs
index f531a94c7..0dc8819af 100644
--- a/core/src/types/operator/blocking_operator.rs
+++ b/core/src/types/operator/blocking_operator.rs
@@ -139,12 +139,6 @@ impl BlockingOperator {
         OperatorInfo::new(self.accessor.info())
     }
 
-    /// Create a new non-blocking operator.
-    ///
-    /// This operation is nearly no cost.
-    pub fn non_blocking(&self) -> Operator {
-        Operator::from_inner(self.accessor.clone()).with_limit(self.limit)
-    }
 }
 
 /// # Operator blocking API.

Reply via email to