This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch v2-10-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 6c6797c5d9ab173d2860cf628543b866fa5873a5 Author: Jarek Potiuk <[email protected]> AuthorDate: Sun Aug 11 23:36:18 2024 +0200 Fix mypy checks for new azure libraries (#41386) (cherry picked from commit 68a6a0583b5100c1f313d7bff3dc664205d9a1ad) --- airflow/providers/microsoft/azure/hooks/wasb.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/airflow/providers/microsoft/azure/hooks/wasb.py b/airflow/providers/microsoft/azure/hooks/wasb.py index 237594139e..36cafd9933 100644 --- a/airflow/providers/microsoft/azure/hooks/wasb.py +++ b/airflow/providers/microsoft/azure/hooks/wasb.py @@ -213,7 +213,8 @@ class WasbHook(BaseHook): **extra, ) - def _get_container_client(self, container_name: str) -> ContainerClient: + # TODO: rework the interface as it might also return AsyncContainerClient + def _get_container_client(self, container_name: str) -> ContainerClient: # type: ignore[override] """ Instantiate a container client. @@ -222,7 +223,7 @@ class WasbHook(BaseHook): """ return self.blob_service_client.get_container_client(container_name) - def _get_blob_client(self, container_name: str, blob_name: str) -> BlobClient: + def _get_blob_client(self, container_name: str, blob_name: str) -> BlobClient | AsyncBlobClient: """ Instantiate a blob client. @@ -415,7 +416,8 @@ class WasbHook(BaseHook): self.create_container(container_name) blob_client = self._get_blob_client(container_name, blob_name) - return blob_client.upload_blob(data, blob_type, length=length, **kwargs) + # TODO: rework the interface as it might also return Awaitable + return blob_client.upload_blob(data, blob_type, length=length, **kwargs) # type: ignore[return-value] def download( self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs @@ -430,7 +432,8 @@ class WasbHook(BaseHook): :param length: Number of bytes to read from the stream. """ blob_client = self._get_blob_client(container_name, blob_name) - return blob_client.download_blob(offset=offset, length=length, **kwargs) + # TODO: rework the interface as it might also return Awaitable + return blob_client.download_blob(offset=offset, length=length, **kwargs) # type: ignore[return-value] def create_container(self, container_name: str) -> None: """ @@ -656,7 +659,8 @@ class WasbAsyncHook(WasbHook): return False return True - def _get_container_client(self, container_name: str) -> AsyncContainerClient: + # TODO: rework the interface as in parent Hook it returns ContainerClient + def _get_container_client(self, container_name: str) -> AsyncContainerClient: # type: ignore[override] """ Instantiate a container client.
