jscheffl commented on code in PR #60254:
URL: https://github.com/apache/airflow/pull/60254#discussion_r2677656646


##########
providers/google/src/airflow/providers/google/cloud/hooks/kubernetes_engine.py:
##########
@@ -498,7 +498,7 @@ def __init__(
         )
 
     @contextlib.asynccontextmanager
-    async def get_conn(self) -> async_client.ApiClient:
+    async def get_conn(self) -> async_client.ApiClient:  # type: 
ignore[override]

Review Comment:
   I assume this change is not needed if comments above are considered.



##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/hooks/kubernetes.py:
##########
@@ -239,7 +258,7 @@ def _get_field(self, field_name):
         prefixed_name = f"extra__kubernetes__{field_name}"
         return self.conn_extras.get(prefixed_name) or None
 
-    def get_conn(self) -> client.ApiClient:
+    def get_conn(self) -> _TimeoutK8sApiClient:

Review Comment:
   I'd propose NOT changing the signature of the method as the class passed as 
return is a private wrapper. Then people looking at type hints are not 
wondering what this is. As well as the timeout wrapper is not adding any 
interface of benefit to expose.
   ```suggestion
       def get_conn(self) -> client.ApiClient:
   ```



##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/hooks/kubernetes.py:
##########
@@ -874,10 +893,10 @@ async def _get_field(self, field_name):
         return extras.get(prefixed_name)
 
     @contextlib.asynccontextmanager
-    async def get_conn(self) -> async_client.ApiClient:
+    async def get_conn(self) -> AsyncIterator[_TimeoutAsyncK8sApiClient]:  # 
type: ignore[override]

Review Comment:
   I assume staying compatible should also prevent the need of the type ignore.
   ```suggestion
       async def get_conn(self) -> async_client.ApiClient:
   ```



##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/hooks/kubernetes.py:
##########
@@ -307,11 +326,11 @@ def get_conn(self) -> client.ApiClient:
                 client_configuration=self.client_configuration,
                 context=cluster_context,
             )
-            return client.ApiClient()
+            return _TimeoutK8sApiClient()
 
         return self._get_default_client(cluster_context=cluster_context)
 
-    def _get_default_client(self, *, cluster_context: str | None = None) -> 
client.ApiClient:
+    def _get_default_client(self, *, cluster_context: str | None = None) -> 
_TimeoutK8sApiClient:

Review Comment:
   Same as above: Recommend to keep return declaration compatible
   ```suggestion
       def _get_default_client(self, *, cluster_context: str | None = None) -> 
client.ApiClient:
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to