@@ -108,7 +108,7 @@ def __repr__(self) -> str:
108108 async def _get_properties_with_options (self , options : Optional [Dict [str , Any ]] = None ) -> Dict [str , Any ]:
109109 kwargs = {}
110110 if options and "excludedLocations" in options :
111- kwargs ['excluded_locations' ] = options ['excludedLocations' ]
111+ kwargs [Constants . Kwargs . EXCLUDED_LOCATIONS ] = options ['excludedLocations' ]
112112 return await self ._get_properties (** kwargs )
113113
114114 async def _get_properties (self , ** kwargs : Any ) -> Dict [str , Any ]:
@@ -190,17 +190,17 @@ async def read(
190190 :returns: Dict representing the retrieved container.
191191 :rtype: Dict[str, Any]
192192 """
193- session_token = kwargs .get ('session_token' )
193+ session_token = kwargs .get (Constants . Kwargs . SESSION_TOKEN )
194194 if session_token is not None :
195195 warnings .warn (
196196 "The 'session_token' flag does not apply to this method and is always ignored even if passed."
197197 " It will now be removed in the future." ,
198198 DeprecationWarning )
199199
200200 if priority is not None :
201- kwargs ['priority' ] = priority
201+ kwargs [Constants . Kwargs . PRIORITY ] = priority
202202 if initial_headers is not None :
203- kwargs ['initial_headers' ] = initial_headers
203+ kwargs [Constants . Kwargs . INITIAL_HEADERS ] = initial_headers
204204 request_options = _build_options (kwargs )
205205 if populate_partition_key_range_statistics is not None :
206206 request_options ["populatePartitionKeyRangeStatistics" ] = populate_partition_key_range_statistics
@@ -277,21 +277,21 @@ async def create_item(
277277 DeprecationWarning )
278278
279279 if pre_trigger_include is not None :
280- kwargs ['pre_trigger_include' ] = pre_trigger_include
280+ kwargs [Constants . Kwargs . PRE_TRIGGER_INCLUDE ] = pre_trigger_include
281281 if post_trigger_include is not None :
282- kwargs ['post_trigger_include' ] = post_trigger_include
282+ kwargs [Constants . Kwargs . POST_TRIGGER_INCLUDE ] = post_trigger_include
283283 if session_token is not None :
284- kwargs ['session_token' ] = session_token
284+ kwargs [Constants . Kwargs . SESSION_TOKEN ] = session_token
285285 if initial_headers is not None :
286- kwargs ['initial_headers' ] = initial_headers
286+ kwargs [Constants . Kwargs . INITIAL_HEADERS ] = initial_headers
287287 if priority is not None :
288- kwargs ['priority' ] = priority
288+ kwargs [Constants . Kwargs . PRIORITY ] = priority
289289 if no_response is not None :
290- kwargs ['no_response' ] = no_response
290+ kwargs [Constants . Kwargs . NO_RESPONSE ] = no_response
291291 if retry_write is not None :
292292 kwargs [Constants .Kwargs .RETRY_WRITE ] = retry_write
293293 if throughput_bucket is not None :
294- kwargs ["throughput_bucket" ] = throughput_bucket
294+ kwargs [Constants . Kwargs . THROUGHPUT_BUCKET ] = throughput_bucket
295295 request_options = _build_options (kwargs )
296296 request_options ["disableAutomaticIdGeneration" ] = not enable_automatic_id_generation
297297 if indexing_directive is not None :
@@ -356,15 +356,15 @@ async def read_item(
356356 """
357357 doc_link = self ._get_document_link (item )
358358 if post_trigger_include is not None :
359- kwargs ['post_trigger_include' ] = post_trigger_include
359+ kwargs [Constants . Kwargs . POST_TRIGGER_INCLUDE ] = post_trigger_include
360360 if session_token is not None :
361- kwargs ['session_token' ] = session_token
361+ kwargs [Constants . Kwargs . SESSION_TOKEN ] = session_token
362362 if initial_headers is not None :
363- kwargs ['initial_headers' ] = initial_headers
363+ kwargs [Constants . Kwargs . INITIAL_HEADERS ] = initial_headers
364364 if priority is not None :
365- kwargs ['priority' ] = priority
365+ kwargs [Constants . Kwargs . PRIORITY ] = priority
366366 if throughput_bucket is not None :
367- kwargs ["throughput_bucket" ] = throughput_bucket
367+ kwargs [Constants . Kwargs . THROUGHPUT_BUCKET ] = throughput_bucket
368368 request_options = _build_options (kwargs )
369369
370370 request_options ["partitionKey" ] = await self ._set_partition_key (partition_key )
@@ -410,13 +410,13 @@ def read_all_items(
410410 :rtype: AsyncItemPaged[Dict[str, Any]]
411411 """
412412 if session_token is not None :
413- kwargs ['session_token' ] = session_token
413+ kwargs [Constants . Kwargs . SESSION_TOKEN ] = session_token
414414 if initial_headers is not None :
415- kwargs ['initial_headers' ] = initial_headers
415+ kwargs [Constants . Kwargs . INITIAL_HEADERS ] = initial_headers
416416 if priority is not None :
417- kwargs ['priority' ] = priority
417+ kwargs [Constants . Kwargs . PRIORITY ] = priority
418418 if throughput_bucket is not None :
419- kwargs ["throughput_bucket" ] = throughput_bucket
419+ kwargs [Constants . Kwargs . THROUGHPUT_BUCKET ] = throughput_bucket
420420 feed_options = _build_options (kwargs )
421421 if max_item_count is not None :
422422 feed_options ["maxItemCount" ] = max_item_count
@@ -669,19 +669,19 @@ def query_items(
669669
670670 # Update 'feed_options' from 'kwargs'
671671 if utils .valid_key_value_exist (kwargs , "max_item_count" ):
672- feed_options ["maxItemCount" ] = kwargs .pop ("max_item_count" )
672+ feed_options ["maxItemCount" ] = kwargs .pop (Constants . Kwargs . MAX_ITEM_COUNT )
673673 if utils .valid_key_value_exist (kwargs , "populate_query_metrics" ):
674- feed_options ["populateQueryMetrics" ] = kwargs .pop ("populate_query_metrics" )
674+ feed_options ["populateQueryMetrics" ] = kwargs .pop (Constants . Kwargs . POPULATE_QUERY_METRICS )
675675 if utils .valid_key_value_exist (kwargs , "populate_index_metrics" ):
676- feed_options ["populateIndexMetrics" ] = kwargs .pop ("populate_index_metrics" )
676+ feed_options ["populateIndexMetrics" ] = kwargs .pop (Constants . Kwargs . POPULATE_INDEX_METRICS )
677677 if utils .valid_key_value_exist (kwargs , "enable_scan_in_query" ):
678- feed_options ["enableScanInQuery" ] = kwargs .pop ("enable_scan_in_query" )
678+ feed_options ["enableScanInQuery" ] = kwargs .pop (Constants . Kwargs . ENABLE_SCAN_IN_QUERY )
679679 if utils .valid_key_value_exist (kwargs , "max_integrated_cache_staleness_in_ms" ):
680- max_integrated_cache_staleness_in_ms = kwargs .pop ("max_integrated_cache_staleness_in_ms" )
680+ max_integrated_cache_staleness_in_ms = kwargs .pop (Constants . Kwargs . MAX_INTEGRATED_CACHE_STALENESS )
681681 validate_cache_staleness_value (max_integrated_cache_staleness_in_ms )
682682 feed_options ["maxIntegratedCacheStaleness" ] = max_integrated_cache_staleness_in_ms
683683 if utils .valid_key_value_exist (kwargs , "continuation_token_limit" ):
684- feed_options ["responseContinuationTokenLimitInKb" ] = kwargs .pop ("continuation_token_limit" )
684+ feed_options ["responseContinuationTokenLimitInKb" ] = kwargs .pop (Constants . Kwargs . RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB )
685685 feed_options ["correlatedActivityId" ] = GenerateGuidId ()
686686
687687 # Set query with 'query' and 'parameters' from kwargs
@@ -1006,25 +1006,25 @@ async def upsert_item(
10061006 :rtype: ~azure.cosmos.CosmosDict[str, Any]
10071007 """
10081008 if pre_trigger_include is not None :
1009- kwargs ['pre_trigger_include' ] = pre_trigger_include
1009+ kwargs [Constants . Kwargs . PRE_TRIGGER_INCLUDE ] = pre_trigger_include
10101010 if post_trigger_include is not None :
1011- kwargs ['post_trigger_include' ] = post_trigger_include
1011+ kwargs [Constants . Kwargs . POST_TRIGGER_INCLUDE ] = post_trigger_include
10121012 if session_token is not None :
1013- kwargs ['session_token' ] = session_token
1013+ kwargs [Constants . Kwargs . SESSION_TOKEN ] = session_token
10141014 if initial_headers is not None :
1015- kwargs ['initial_headers' ] = initial_headers
1015+ kwargs [Constants . Kwargs . INITIAL_HEADERS ] = initial_headers
10161016 if priority is not None :
1017- kwargs ['priority' ] = priority
1017+ kwargs [Constants . Kwargs . PRIORITY ] = priority
10181018 if etag is not None :
10191019 kwargs ['etag' ] = etag
10201020 if match_condition is not None :
10211021 kwargs ['match_condition' ] = match_condition
10221022 if no_response is not None :
1023- kwargs ['no_response' ] = no_response
1023+ kwargs [Constants . Kwargs . NO_RESPONSE ] = no_response
10241024 if retry_write is not None :
10251025 kwargs [Constants .Kwargs .RETRY_WRITE ] = retry_write
10261026 if throughput_bucket is not None :
1027- kwargs ["throughput_bucket" ] = throughput_bucket
1027+ kwargs [Constants . Kwargs . THROUGHPUT_BUCKET ] = throughput_bucket
10281028 request_options = _build_options (kwargs )
10291029 request_options ["disableAutomaticIdGeneration" ] = True
10301030 await self ._get_properties_with_options (request_options )
@@ -1095,25 +1095,25 @@ async def replace_item(
10951095 """
10961096 item_link = self ._get_document_link (item )
10971097 if pre_trigger_include is not None :
1098- kwargs ['pre_trigger_include' ] = pre_trigger_include
1098+ kwargs [Constants . Kwargs . PRE_TRIGGER_INCLUDE ] = pre_trigger_include
10991099 if post_trigger_include is not None :
1100- kwargs ['post_trigger_include' ] = post_trigger_include
1100+ kwargs [Constants . Kwargs . POST_TRIGGER_INCLUDE ] = post_trigger_include
11011101 if session_token is not None :
1102- kwargs ['session_token' ] = session_token
1102+ kwargs [Constants . Kwargs . SESSION_TOKEN ] = session_token
11031103 if initial_headers is not None :
1104- kwargs ['initial_headers' ] = initial_headers
1104+ kwargs [Constants . Kwargs . INITIAL_HEADERS ] = initial_headers
11051105 if priority is not None :
1106- kwargs ['priority' ] = priority
1106+ kwargs [Constants . Kwargs . PRIORITY ] = priority
11071107 if etag is not None :
11081108 kwargs ['etag' ] = etag
11091109 if match_condition is not None :
11101110 kwargs ['match_condition' ] = match_condition
11111111 if no_response is not None :
1112- kwargs ['no_response' ] = no_response
1112+ kwargs [Constants . Kwargs . NO_RESPONSE ] = no_response
11131113 if retry_write is not None :
11141114 kwargs [Constants .Kwargs .RETRY_WRITE ] = retry_write
11151115 if throughput_bucket is not None :
1116- kwargs ["throughput_bucket" ] = throughput_bucket
1116+ kwargs [Constants . Kwargs . THROUGHPUT_BUCKET ] = throughput_bucket
11171117 request_options = _build_options (kwargs )
11181118 request_options ["disableAutomaticIdGeneration" ] = True
11191119 await self ._get_properties_with_options (request_options )
@@ -1184,23 +1184,23 @@ async def patch_item(
11841184 :rtype: ~azure.cosmos.CosmosDict[str, Any]
11851185 """
11861186 if pre_trigger_include is not None :
1187- kwargs ['pre_trigger_include' ] = pre_trigger_include
1187+ kwargs [Constants . Kwargs . PRE_TRIGGER_INCLUDE ] = pre_trigger_include
11881188 if post_trigger_include is not None :
1189- kwargs ['post_trigger_include' ] = post_trigger_include
1189+ kwargs [Constants . Kwargs . POST_TRIGGER_INCLUDE ] = post_trigger_include
11901190 if session_token is not None :
1191- kwargs ['session_token' ] = session_token
1191+ kwargs [Constants . Kwargs . SESSION_TOKEN ] = session_token
11921192 if priority is not None :
1193- kwargs ['priority' ] = priority
1193+ kwargs [Constants . Kwargs . PRIORITY ] = priority
11941194 if etag is not None :
11951195 kwargs ['etag' ] = etag
11961196 if match_condition is not None :
11971197 kwargs ['match_condition' ] = match_condition
11981198 if no_response is not None :
1199- kwargs ['no_response' ] = no_response
1199+ kwargs [Constants . Kwargs . NO_RESPONSE ] = no_response
12001200 if retry_write is not None :
12011201 kwargs [Constants .Kwargs .RETRY_WRITE ] = retry_write
12021202 if throughput_bucket is not None :
1203- kwargs ["throughput_bucket" ] = throughput_bucket
1203+ kwargs [Constants . Kwargs . THROUGHPUT_BUCKET ] = throughput_bucket
12041204 request_options = _build_options (kwargs )
12051205 request_options ["disableAutomaticIdGeneration" ] = True
12061206 request_options ["partitionKey" ] = await self ._set_partition_key (partition_key )
@@ -1265,23 +1265,23 @@ async def delete_item(
12651265 :rtype: None
12661266 """
12671267 if pre_trigger_include is not None :
1268- kwargs ['pre_trigger_include' ] = pre_trigger_include
1268+ kwargs [Constants . Kwargs . PRE_TRIGGER_INCLUDE ] = pre_trigger_include
12691269 if post_trigger_include is not None :
1270- kwargs ['post_trigger_include' ] = post_trigger_include
1270+ kwargs [Constants . Kwargs . POST_TRIGGER_INCLUDE ] = post_trigger_include
12711271 if session_token is not None :
1272- kwargs ['session_token' ] = session_token
1272+ kwargs [Constants . Kwargs . SESSION_TOKEN ] = session_token
12731273 if initial_headers is not None :
1274- kwargs ['initial_headers' ] = initial_headers
1274+ kwargs [Constants . Kwargs . INITIAL_HEADERS ] = initial_headers
12751275 if etag is not None :
12761276 kwargs ['etag' ] = etag
12771277 if match_condition is not None :
12781278 kwargs ['match_condition' ] = match_condition
12791279 if priority is not None :
1280- kwargs ['priority' ] = priority
1280+ kwargs [Constants . Kwargs . PRIORITY ] = priority
12811281 if retry_write is not None :
12821282 kwargs [Constants .Kwargs .RETRY_WRITE ] = retry_write
12831283 if throughput_bucket is not None :
1284- kwargs ["throughput_bucket" ] = throughput_bucket
1284+ kwargs [Constants . Kwargs . THROUGHPUT_BUCKET ] = throughput_bucket
12851285 request_options = _build_options (kwargs )
12861286 request_options ["partitionKey" ] = await self ._set_partition_key (partition_key )
12871287 await self ._get_properties_with_options (request_options )
@@ -1535,13 +1535,13 @@ async def delete_all_items_by_partition_key(
15351535 DeprecationWarning )
15361536
15371537 if pre_trigger_include is not None :
1538- kwargs ['pre_trigger_include' ] = pre_trigger_include
1538+ kwargs [Constants . Kwargs . PRE_TRIGGER_INCLUDE ] = pre_trigger_include
15391539 if post_trigger_include is not None :
1540- kwargs ['post_trigger_include' ] = post_trigger_include
1540+ kwargs [Constants . Kwargs . POST_TRIGGER_INCLUDE ] = post_trigger_include
15411541 if session_token is not None :
1542- kwargs ['session_token' ] = session_token
1542+ kwargs [Constants . Kwargs . SESSION_TOKEN ] = session_token
15431543 if throughput_bucket is not None :
1544- kwargs ["throughput_bucket" ] = throughput_bucket
1544+ kwargs [Constants . Kwargs . THROUGHPUT_BUCKET ] = throughput_bucket
15451545 request_options = _build_options (kwargs )
15461546 # regardless if partition key is valid we set it as invalid partition keys are set to a default empty value
15471547 request_options ["partitionKey" ] = await self ._set_partition_key (partition_key )
@@ -1601,15 +1601,15 @@ async def execute_item_batch(
16011601 DeprecationWarning )
16021602
16031603 if pre_trigger_include is not None :
1604- kwargs ['pre_trigger_include' ] = pre_trigger_include
1604+ kwargs [Constants . Kwargs . PRE_TRIGGER_INCLUDE ] = pre_trigger_include
16051605 if post_trigger_include is not None :
1606- kwargs ['post_trigger_include' ] = post_trigger_include
1606+ kwargs [Constants . Kwargs . POST_TRIGGER_INCLUDE ] = post_trigger_include
16071607 if session_token is not None :
1608- kwargs ['session_token' ] = session_token
1608+ kwargs [Constants . Kwargs . SESSION_TOKEN ] = session_token
16091609 if priority is not None :
1610- kwargs ['priority' ] = priority
1610+ kwargs [Constants . Kwargs . PRIORITY ] = priority
16111611 if throughput_bucket is not None :
1612- kwargs ["throughput_bucket" ] = throughput_bucket
1612+ kwargs [Constants . Kwargs . THROUGHPUT_BUCKET ] = throughput_bucket
16131613 request_options = _build_options (kwargs )
16141614 request_options ["partitionKey" ] = await self ._set_partition_key (partition_key )
16151615 request_options ["disableAutomaticIdGeneration" ] = True
0 commit comments