Skip to content

Commit 0c049c3

Browse files
feat(python): Rename credentials parameter to credential in CredentialProviderAzure (#21295)
1 parent 3e28786 commit 0c049c3

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

py-polars/polars/io/cloud/credential_provider/_providers.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def __init__(
172172
*,
173173
scopes: list[str] | None = None,
174174
tenant_id: str | None = None,
175-
credentials: Any | None = None,
175+
credential: Any | None = None,
176176
_storage_account: str | None = None,
177177
) -> None:
178178
"""
@@ -186,7 +186,7 @@ def __init__(
186186
Scopes to pass to `get_token`
187187
tenant_id
188188
Azure tenant ID.
189-
credentials
189+
credential
190190
Optionally pass an instantiated Azure credential class to use (e.g.
191191
`azure.identity.DefaultAzureCredential`). The credential class must
192192
have a `get_token()` method.
@@ -199,21 +199,21 @@ def __init__(
199199
scopes if scopes is not None else ["https://storage.azure.com/.default"]
200200
)
201201
self.tenant_id = tenant_id
202-
self.credentials = credentials
202+
self.credential = credential
203203

204-
if credentials is not None:
205-
# If the user passes a credentials class, we just need to ensure it
204+
if credential is not None:
205+
# If the user passes a credential class, we just need to ensure it
206206
# has a `get_token()` method.
207-
if not hasattr(credentials, "get_token"):
207+
if not hasattr(credential, "get_token"):
208208
msg = (
209-
f"the provided `credentials` object {credentials!r} does "
209+
f"the provided `credential` object {credential!r} does "
210210
"not have a `get_token()` method."
211211
)
212212
raise ValueError(msg)
213213

214214
# We don't need the module if we are permitted and able to retrieve the
215215
# account key from the Azure CLI.
216-
elif self._try_get_azure_storage_account_credentials_if_permitted() is None:
216+
elif self._try_get_azure_storage_account_credential_if_permitted() is None:
217217
self._ensure_module_availability()
218218

219219
if verbose():
@@ -227,13 +227,13 @@ def __init__(
227227
def __call__(self) -> CredentialProviderFunctionReturn:
228228
"""Fetch the credentials."""
229229
if (
230-
v := self._try_get_azure_storage_account_credentials_if_permitted()
230+
v := self._try_get_azure_storage_account_credential_if_permitted()
231231
) is not None:
232232
return v
233233

234234
# Done like this to bypass mypy, we don't have stubs for azure.identity
235235
credential = (
236-
self.credentials
236+
self.credential
237237
or importlib.import_module("azure.identity").__dict__[
238238
"DefaultAzureCredential"
239239
]()
@@ -244,7 +244,7 @@ def __call__(self) -> CredentialProviderFunctionReturn:
244244
"bearer_token": token.token,
245245
}, token.expires_on
246246

247-
def _try_get_azure_storage_account_credentials_if_permitted(
247+
def _try_get_azure_storage_account_credential_if_permitted(
248248
self,
249249
) -> CredentialProviderFunctionReturn | None:
250250
POLARS_AUTO_USE_AZURE_STORAGE_ACCOUNT_KEY = os.getenv(

0 commit comments

Comments
 (0)