Skip to content

Commit

Permalink
Revert "client and upload kwargs"
Browse files Browse the repository at this point in the history
This reverts commit cca3c5e.
  • Loading branch information
Peter Barmettler committed Dec 1, 2022
1 parent 8a71e55 commit 8fdb60b
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions adlfs/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,8 +972,6 @@ def __init__(
default_fill_cache: bool = True,
default_cache_type: str = "bytes",
version_aware: bool = False,
client_kwargs: dict = None,
upload_kwargs: dict = None,
**kwargs,
):
super_kwargs = {
Expand Down Expand Up @@ -1031,10 +1029,10 @@ def __init__(
self.credential,
self.sync_credential,
) = self._get_default_azure_credential(**kwargs)
self.client_kwargs = client_kwargs or {}
self.upload_kwargs = upload_kwargs or {}

self.do_connect()
weakref.finalize(self, sync, self.loop, close_service_client, self)

if self.credential is not None:
weakref.finalize(self, sync, self.loop, close_credential, self)

Expand Down Expand Up @@ -1163,7 +1161,7 @@ def do_connect(self):
try:
if self.connection_string is not None:
self.service_client = AIOBlobServiceClient.from_connection_string(
conn_str=self.connection_string, **self.client_kwargs
conn_str=self.connection_string
)
elif self.account_name is not None:
if hasattr(self, "account_host"):
Expand All @@ -1180,7 +1178,6 @@ def do_connect(self):
account_url=self.account_url,
credential=cred,
_location_mode=self.location_mode,
**self.client_kwargs,
)
for cred in creds
if cred is not None
Expand All @@ -1192,12 +1189,11 @@ def do_connect(self):
account_url=self.account_url + self.sas_token,
credential=None,
_location_mode=self.location_mode,
**self.client_kwargs,
)
else:
# Fall back to anonymous login, and assume public container
self.service_client = AIOBlobServiceClient(
account_url=self.account_url, **self.client_kwargs
account_url=self.account_url
)
else:
raise ValueError(
Expand Down Expand Up @@ -2129,10 +2125,7 @@ async def _pipe_file(self, path, value, overwrite=True, **kwargs):
container=container_name, blob=path
) as bc:
result = await bc.upload_blob(
data=value,
overwrite=overwrite,
metadata={"is_directory": "false"},
**self.upload_kwargs,
data=value, overwrite=overwrite, metadata={"is_directory": "false"}
)
self.invalidate_cache(self._parent(path))
return result
Expand Down Expand Up @@ -2316,7 +2309,6 @@ async def _put_file(
raw_response_hook=make_callback(
"upload_stream_current", callback
),
**self.upload_kwargs,
)
self.invalidate_cache()
except ResourceExistsError:
Expand Down Expand Up @@ -2769,9 +2761,7 @@ async def _async_upload_chunk(self, final: bool = False, **kwargs):
async with self.container_client.get_blob_client(
blob=self.blob
) as bc:
await bc.upload_blob(
data=data, metadata=self.metadata, **kwargs
)
await bc.upload_blob(data=data, metadata=self.metadata)
elif length == 0 and final:
# just finalize
block_list = [BlobBlock(_id) for _id in self._block_list]
Expand All @@ -2790,7 +2780,6 @@ async def _async_upload_chunk(self, final: bool = False, **kwargs):
length=length,
blob_type=BlobType.AppendBlob,
metadata=self.metadata,
**kwargs,
)
else:
raise ValueError(
Expand Down

0 comments on commit 8fdb60b

Please sign in to comment.