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

Avoid use of private APIs from azure.storage #427

Merged
merged 4 commits into from
Sep 16, 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
19 changes: 11 additions & 8 deletions adlfs/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@
ResourceExistsError,
ResourceNotFoundError,
)
from azure.storage.blob import BlobSasPermissions, generate_blob_sas
from azure.storage.blob._models import BlobBlock, BlobProperties, BlobType
from azure.storage.blob._shared.base_client import create_configuration
from azure.storage.blob import (
BlobBlock,
BlobProperties,
BlobSasPermissions,
BlobType,
generate_blob_sas,
)
from azure.storage.blob.aio import BlobPrefix
from azure.storage.blob.aio import BlobServiceClient as AIOBlobServiceClient
from azure.storage.blob.aio._list_blobs_helper import BlobPrefix
from fsspec.asyn import AsyncFileSystem, _get_batch_size, get_loop, sync, sync_wrapper
from fsspec.spec import AbstractBufferedFile
from fsspec.utils import infer_storage_options
Expand Down Expand Up @@ -61,6 +65,7 @@
"is_current_version",
]
_ROOT_PATH = "/"
_DEFAULT_BLOCK_SIZE = 4 * 1024 * 1024

_SOCKET_TIMEOUT_DEFAULT = object()

Expand Down Expand Up @@ -143,7 +148,7 @@ class AzureBlobFileSystem(AsyncFileSystem):
The credentials with which to authenticate. Optional if the account URL already has a SAS token.
Can include an instance of TokenCredential class from azure.identity
blocksize: int
The block size to use for download/upload operations. Defaults to the value of
The block size to use for download/upload operations. Defaults to hardcoded value of
``BlockBlobService.MAX_BLOCK_SIZE``
client_id: str
Client ID to use when authenticating using an AD Service Principal client/secret.
Expand Down Expand Up @@ -219,7 +224,7 @@ def __init__(
sas_token: str = None,
request_session=None,
socket_timeout=_SOCKET_TIMEOUT_DEFAULT,
blocksize: int = create_configuration(storage_sdk="blob").max_block_size,
blocksize: int = _DEFAULT_BLOCK_SIZE,
client_id: str = None,
client_secret: str = None,
tenant_id: str = None,
Expand Down Expand Up @@ -285,7 +290,6 @@ def __init__(
and self.sas_token is None
and self.account_key is None
):

(
self.credential,
self.sync_credential,
Expand Down Expand Up @@ -397,7 +401,6 @@ def _get_credential_from_service_principal(self):
return (async_credential, sync_credential)

def _get_default_azure_credential(self, **kwargs):

"""
Create a Credential for authentication using DefaultAzureCredential

Expand Down
Loading