Skip to content

Commit 1b3c0b0

Browse files
Copilotbambriz
andcommitted
Add InternalOptions imports and fix additional hardcoded strings
Co-authored-by: bambriz <[email protected]>
1 parent 6f6ba06 commit 1b3c0b0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

sdk/cosmos/azure-cosmos/azure/cosmos/container.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ def __repr__(self) -> str:
109109

110110
def _get_properties_with_options(self, options: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
111111
kwargs = {}
112-
if options and "excludedLocations" in options:
113-
kwargs[Constants.Kwargs.EXCLUDED_LOCATIONS] = options['excludedLocations']
112+
if options and InternalOptions.EXCLUDED_LOCATIONS in options:
113+
kwargs[Constants.Kwargs.EXCLUDED_LOCATIONS] = options[InternalOptions.EXCLUDED_LOCATIONS]
114114
return self._get_properties(**kwargs)
115115

116116
def _get_properties(self, **kwargs: Any) -> Dict[str, Any]:
@@ -204,9 +204,9 @@ def read( # pylint:disable=docstring-missing-param
204204
DeprecationWarning,
205205
)
206206
if populate_partition_key_range_statistics is not None:
207-
request_options["populatePartitionKeyRangeStatistics"] = populate_partition_key_range_statistics
207+
request_options[InternalOptions.POPULATE_PARTITION_KEY_RANGE_STATISTICS] = populate_partition_key_range_statistics
208208
if populate_quota_info is not None:
209-
request_options["populateQuotaInfo"] = populate_quota_info
209+
request_options[InternalOptions.POPULATE_QUOTA_INFO] = populate_quota_info
210210
container = self.client_connection.ReadContainer(self.container_link, options=request_options, **kwargs)
211211
# Only cache Container Properties that will not change in the lifetime of the container
212212
self.client_connection._set_container_properties_cache(self.container_link, # pylint: disable=protected-access

sdk/cosmos/azure-cosmos/azure/cosmos/database.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from ._cosmos_client_connection import CosmosClientConnection
3333
from ._base import build_options, _set_throughput_options, _deserialize_throughput, _replace_throughput
3434
from ._constants import _Constants as Constants
35+
InternalOptions = Constants.InternalOptions
3536
from .container import ContainerProxy
3637
from .offer import Offer, ThroughputProperties
3738
from .http_constants import StatusCodes as _StatusCodes

0 commit comments

Comments
 (0)