Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: fix mypy failure #1244

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions astronomer/providers/microsoft/azure/hooks/wasb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""This module contains the Azure WASB hook's asynchronous implementation."""
from typing import Any, List, Optional, Union
from __future__ import annotations

from typing import Any, Union

from airflow.providers.microsoft.azure.hooks.wasb import WasbHook
from azure.core.exceptions import ResourceNotFoundError
Expand Down Expand Up @@ -55,9 +57,7 @@ def get_conn(self) -> BlobServiceClient:
app_id = conn.login
app_secret = conn.password
token_credential = ClientSecretCredential(tenant, app_id, app_secret)
return BlobServiceClient(
account_url=conn.host, credential=token_credential, **extra # type:ignore[arg-type]
)
return BlobServiceClient(account_url=conn.host, credential=token_credential, **extra)

sas_token = extra.pop("sas_token", extra.pop("extra__wasb__sas_token", None))
if sas_token:
Expand Down Expand Up @@ -113,11 +113,11 @@ def _get_container_client(self, container_name: str) -> ContainerClient:
async def get_blobs_list_async(
self,
container_name: str,
prefix: Optional[str] = None,
include: Optional[List[str]] = None,
prefix: str | None = None,
include: list[str] | None = None,
delimiter: str = "/",
**kwargs: Any,
) -> List[BlobProperties]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should inline this with apache/airflow#32545 changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! I've updated it. Could you please check again? Thanks!

) -> list[BlobProperties]:
"""
List blobs in a given container.

Expand All @@ -130,10 +130,10 @@ async def get_blobs_list_async(
:param delimiter: filters objects based on the delimiter (for e.g '.csv')
"""
container = self._get_container_client(container_name)
blob_list = []
blob_list: list[BlobProperties] = []
blobs = container.walk_blobs(name_starts_with=prefix, include=include, delimiter=delimiter, **kwargs)
async for blob in blobs:
blob_list.append(blob.name)
blob_list.append(blob)
return blob_list

async def check_for_prefix_async(self, container_name: str, prefix: str, **kwargs: Any) -> bool:
Expand Down