Skip to content

Commit fd89c02

Browse files
committed
Code cleanup
1 parent e4e0904 commit fd89c02

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

sdk/cosmos/azure-cosmos/azure/cosmos/_auth_policy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from azure.core.exceptions import HttpResponseError
1515

1616
from .http_constants import HttpHeaders
17+
from ._constants import _Constants as Constants
1718

1819
HTTPRequestType = TypeVar("HTTPRequestType", HttpRequest, LegacyHttpRequest)
1920

@@ -22,7 +23,7 @@
2223
# Composition was considered, but still required accessing protected members, so inheritance is retained
2324
# for seamless Azure SDK pipeline integration.
2425
class CosmosBearerTokenCredentialPolicy(BearerTokenCredentialPolicy):
25-
AadDefaultScope = Constants._Constants.AAD_DEFAULT_SCOPE
26+
AadDefaultScope = Constants.AAD_DEFAULT_SCOPE
2627

2728
def __init__(self, credential, account_scope: str, override_scope: Optional[str] = None):
2829
self._account_scope = account_scope

sdk/cosmos/azure-cosmos/azure/cosmos/_cosmos_client_connection.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def __init__( # pylint: disable=too-many-statements
118118
auth: CredentialDict,
119119
connection_policy: Optional[ConnectionPolicy] = None,
120120
consistency_level: Optional[str] = None,
121-
audience: Optional[str] = None,
122121
**kwargs: Any
123122
) -> None:
124123
"""
@@ -133,8 +132,6 @@ def __init__( # pylint: disable=too-many-statements
133132
The connection policy for the client.
134133
:param documents.ConsistencyLevel consistency_level:
135134
The default consistency policy for client operations.
136-
:param str audience:
137-
The overridden scope value.
138135
"""
139136
self.client_id = str(uuid.uuid4())
140137
self.url_connection = url_connection
@@ -206,7 +203,7 @@ def __init__( # pylint: disable=too-many-statements
206203

207204
credentials_policy = None
208205
if self.aad_credentials:
209-
scope_override = audience or os.environ.get(Constants.AAD_SCOPE_OVERRIDE, "")
206+
scope_override = os.environ.get(Constants.AAD_SCOPE_OVERRIDE, "")
210207
account_scope = base.create_scope_from_url(self.url_connection)
211208
credentials_policy = CosmosBearerTokenCredentialPolicy(
212209
self.aad_credentials,

sdk/cosmos/azure-cosmos/azure/cosmos/aio/_auth_policy_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from typing import Any, MutableMapping, TypeVar, cast, Optional
88

9-
from azure.cosmos import _constants as Constants
109
from azure.core.pipeline.policies import AsyncBearerTokenCredentialPolicy
1110
from azure.core.pipeline import PipelineRequest
1211
from azure.core.pipeline.transport import HttpRequest as LegacyHttpRequest
@@ -15,6 +14,7 @@
1514
from azure.core.exceptions import HttpResponseError
1615

1716
from ..http_constants import HttpHeaders
17+
from .._constants import _Constants as Constants
1818

1919
HTTPRequestType = TypeVar("HTTPRequestType", HttpRequest, LegacyHttpRequest)
2020

@@ -23,7 +23,7 @@
2323
# Composition was considered, but still required accessing protected members, so inheritance is retained
2424
# for seamless Azure SDK pipeline integration.
2525
class AsyncCosmosBearerTokenCredentialPolicy(AsyncBearerTokenCredentialPolicy):
26-
AadDefaultScope = Constants._Constants.AAD_DEFAULT_SCOPE
26+
AadDefaultScope = Constants.AAD_DEFAULT_SCOPE
2727

2828
def __init__(self, credential, account_scope: str, override_scope: Optional[str] = None):
2929
self._account_scope = account_scope

sdk/cosmos/azure-cosmos/azure/cosmos/aio/_cosmos_client_connection_async.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ def __init__( # pylint: disable=too-many-statements
124124
auth: CredentialDict,
125125
connection_policy: Optional[ConnectionPolicy] = None,
126126
consistency_level: Optional[str] = None,
127-
audience: Optional[str] = None,
128127
**kwargs: Any
129128
) -> None:
130129
"""
@@ -139,8 +138,6 @@ def __init__( # pylint: disable=too-many-statements
139138
The connection policy for the client.
140139
:param documents.ConsistencyLevel consistency_level:
141140
The default consistency policy for client operations.
142-
:param str audience:
143-
The overridden scope value.
144141
"""
145142
self.client_id = str(uuid.uuid4())
146143
self.url_connection = url_connection
@@ -214,7 +211,7 @@ def __init__( # pylint: disable=too-many-statements
214211

215212
credentials_policy = None
216213
if self.aad_credentials:
217-
scope_override = audience or os.environ.get(Constants.AAD_SCOPE_OVERRIDE, "")
214+
scope_override = os.environ.get(Constants.AAD_SCOPE_OVERRIDE, "")
218215
account_scope = base.create_scope_from_url(self.url_connection)
219216
credentials_policy = AsyncCosmosBearerTokenCredentialPolicy(
220217
self.aad_credentials,

0 commit comments

Comments
 (0)