@@ -123,16 +123,25 @@ def create(self, entity: EntityType, **kwargs) -> None:
123123 request .url = self ._base_url + request .url
124124 self .requests .append (request )
125125
126- def update (self , entity : EntityType , mode : Union [str , UpdateMode ] = UpdateMode .MERGE , ** kwargs ) -> None :
126+ def update (
127+ self ,
128+ entity : EntityType ,
129+ mode : Union [str , UpdateMode ] = UpdateMode .MERGE ,
130+ * ,
131+ etag : Optional [str ] = None ,
132+ match_condition : Optional [MatchConditions ] = None ,
133+ ** kwargs ,
134+ ) -> None :
127135 """Adds an update operation to the current batch.
128136
129137 :param entity: The properties for the table entity.
130138 :type entity: ~azure.data.tables.TableEntity or dict[str, Any]
131139 :param mode: Merge or Replace entity
132140 :type mode: ~azure.data.tables.UpdateMode
133- :keyword str etag: Etag of the entity
134- :keyword match_condition: MatchCondition
135- :paramtype match_condition: ~azure.core.MatchCondition
141+ :keyword etag: Etag of the entity.
142+ :paramtype etag: str or None
143+ :keyword match_condition: The match condition to use upon the etag.
144+ :paramtype match_condition: ~azure.core.MatchConditions or None
136145 :return: None
137146 :raises ValueError:
138147
@@ -150,8 +159,6 @@ def update(self, entity: EntityType, mode: Union[str, UpdateMode] = UpdateMode.M
150159 partition_key = _prepare_key (entity ["PartitionKey" ])
151160 row_key = _prepare_key (entity ["RowKey" ])
152161
153- match_condition = kwargs .pop ("match_condition" , None )
154- etag = kwargs .pop ("etag" , None )
155162 if match_condition and not etag and isinstance (entity , TableEntity ):
156163 if hasattr (entity , "metadata" ):
157164 etag = entity .metadata .get ("etag" )
@@ -188,14 +195,22 @@ def update(self, entity: EntityType, mode: Union[str, UpdateMode] = UpdateMode.M
188195 request .url = self ._base_url + request .url
189196 self .requests .append (request )
190197
191- def delete (self , entity : EntityType , ** kwargs ) -> None :
198+ def delete (
199+ self ,
200+ entity : EntityType ,
201+ * ,
202+ etag : Optional [str ] = None ,
203+ match_condition : Optional [MatchConditions ] = None ,
204+ ** kwargs ,
205+ ) -> None :
192206 """Adds a delete operation to the current branch.
193207
194- param entity: The properties for the table entity.
208+ : param entity: The properties for the table entity.
195209 :type entity: ~azure.data.tables.TableEntity or dict[str, Any]
196- :keyword str etag: Etag of the entity
197- :keyword match_condition: MatchCondition
198- :paramtype match_condition: ~azure.core.MatchCondition
210+ :keyword etag: Etag of the entity.
211+ :paramtype etag: str or None
212+ :keyword match_condition: The match condition to use upon the etag.
213+ :paramtype match_condition: ~azure.core.MatchConditions or None
199214 :return: None
200215 :raises: ValueError
201216
@@ -209,27 +224,24 @@ def delete(self, entity: EntityType, **kwargs) -> None:
209224 :caption: Creating and adding an entity to a Table
210225 """
211226 self ._verify_partition_key (entity )
212- match_condition = kwargs .pop ("match_condition" , None )
213- etag = kwargs .pop ("etag" , None )
214227 if match_condition and not etag and isinstance (entity , TableEntity ):
215228 etag = entity .metadata .get ("etag" )
216- match_condition = _get_match_condition (
217- etag = etag , match_condition = match_condition or MatchConditions .Unconditionally
218- )
219229 request = build_table_delete_entity_request (
220230 table = self .table_name ,
221231 partition_key = _prepare_key (entity ["PartitionKey" ]),
222232 row_key = _prepare_key (entity ["RowKey" ]),
223- etag = etag ,
224- match_condition = match_condition ,
233+ etag = etag , # type: ignore[arg-type] # Set None to skip checking etag.
234+ match_condition = _get_match_condition (
235+ etag = etag , match_condition = match_condition or MatchConditions .Unconditionally
236+ ),
225237 version = self ._config .version ,
226238 ** kwargs ,
227239 )
228240 request .url = self ._base_url + request .url
229241 self .requests .append (request )
230242
231243 def upsert (self , entity : EntityType , mode : Union [str , UpdateMode ] = UpdateMode .MERGE , ** kwargs ) -> None :
232- """Adds an upsert (update/ merge) operation to the batch.
244+ """Adds an upsert (merge or replace ) operation to the batch.
233245
234246 :param entity: The properties for the table entity.
235247 :type entity: ~azure.data.tables.TableEntity or dict[str, Any]
0 commit comments