Skip to content

Commit 9376f1e

Browse files
authored
Fix mismatching type of ConsistencyPolicy with docstring (#43150)
* Fix mismatching type of `ConsistencyPolicy` with docstring * Updated value type to be Any to support more types * Added CHANGELOG.md
1 parent b7871c2 commit 9376f1e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

sdk/cosmos/azure-cosmos/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#### Other Changes
1313
* Removed dual endpoint tracking from the sdk. See [PR 40451](https://github.com/Azure/azure-sdk-for-python/pull/40451).
1414
* Reverted typehints to fix the mismatch issue. See [PR 43124](https://github.com/Azure/azure-sdk-for-python/pull/43124)
15+
* Corrected type hints for `ConsistencyPolicy` in `DatabaseAccount` class. See [PR 43150](https://github.com/Azure/azure-sdk-for-python/pull/43150)
1516

1617
### 4.14.0b4 (2025-09-11)
1718

sdk/cosmos/azure-cosmos/azure/cosmos/documents.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"""Classes and enums for documents in the Azure Cosmos database service.
2323
"""
2424

25-
from typing import Optional, TYPE_CHECKING, Union
25+
from typing import Optional, TYPE_CHECKING, Union, Any
2626

2727
from typing_extensions import Literal, TypedDict
2828

@@ -60,7 +60,8 @@ class DatabaseAccount: # pylint: disable=too-many-instance-attributes
6060
is not guaranteed to be real time.
6161
:ivar ConsistencyPolicy:
6262
UserConsistencyPolicy settings.
63-
:vartype ConsistencyPolicy: Dict[str, Union[str, int]]
63+
:vartype ConsistencyPolicy:
64+
dict[str, Any]
6465
:ivar boolean EnableMultipleWritableLocations:
6566
Flag on the azure Cosmos account that indicates if writes can take
6667
place in multiple locations.
@@ -74,7 +75,7 @@ def __init__(self) -> None:
7475
self.ConsumedDocumentStorageInMB: int = 0
7576
self.ReservedDocumentStorageInMB: int = 0
7677
self.ProvisionedDocumentStorageInMB: int = 0
77-
self.ConsistencyPolicy: Optional[UserConsistencyPolicy] = None
78+
self.ConsistencyPolicy: Optional[dict[str, Any]] = None
7879
self._WritableLocations: list[dict[str, str]] = []
7980
self._ReadableLocations: list[dict[str, str]] = []
8081
self._EnableMultipleWritableLocations = False

0 commit comments

Comments
 (0)