Skip to content

Commit 5e9e02f

Browse files
linter
Signed-off-by: Elena Kolevska <[email protected]>
1 parent 92639df commit 5e9e02f

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

dapr/clients/grpc/client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,6 @@ def execute_state_transaction(
884884
transactional_metadata: Optional[Dict[str, str]] = dict(),
885885
metadata: Optional[MetadataTuple] = None,
886886
) -> DaprResponse:
887-
888887
"""Saves or deletes key-value pairs to a statestore as a transaction
889888
890889
This saves or deletes key-values to the statestore as part of a single transaction,

examples/state_store/state_store.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,25 @@
8989
print(f'Got items with etags: {[(i.data, i.etag) for i in items]}')
9090

9191
# Transaction delete
92-
d.execute_state_transaction(store_name=storeName, operations=[
93-
TransactionalStateOperation(operation_type=TransactionOperationType.delete, key=key),
94-
TransactionalStateOperation(operation_type=TransactionOperationType.delete, key=another_key),])
92+
d.execute_state_transaction(
93+
store_name=storeName,
94+
operations=[
95+
TransactionalStateOperation(operation_type=TransactionOperationType.delete, key=key),
96+
TransactionalStateOperation(
97+
operation_type=TransactionOperationType.delete, key=another_key
98+
),
99+
],
100+
)
95101

96102
# Batch get
97-
items = d.get_bulk_state(store_name=storeName, keys=[key, another_key],
98-
states_metadata={'metakey': 'metavalue'}).items
103+
items = d.get_bulk_state(
104+
store_name=storeName, keys=[key, another_key], states_metadata={'metakey': 'metavalue'}
105+
).items
99106
print(f'Got values after transaction delete: {[data.data for data in items]}')
100107

101108
# Delete one state by key.
102-
d.delete_state(store_name=storeName, key=yet_another_key, state_metadata={'metakey': 'metavalue'})
109+
d.delete_state(
110+
store_name=storeName, key=yet_another_key, state_metadata={'metakey': 'metavalue'}
111+
)
103112
data = d.get_state(store_name=storeName, key=yet_another_key).data
104113
print(f'Got value after delete: {data}')

tests/clients/test_dapr_grpc_client.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,16 @@ def test_transaction_then_get_states(self):
508508
self.assertEqual(resp.items[1].key, another_key)
509509
self.assertEqual(resp.items[1].data, to_bytes(another_value.upper()))
510510

511-
dapr.execute_state_transaction(store_name='statestore',
512-
operations=[TransactionalStateOperation(key=key, operation_type=TransactionOperationType.delete),
513-
TransactionalStateOperation(key=another_key, operation_type=TransactionOperationType.delete), ],
511+
dapr.execute_state_transaction(
512+
store_name='statestore',
513+
operations=[
514+
TransactionalStateOperation(
515+
key=key, operation_type=TransactionOperationType.delete
516+
),
517+
TransactionalStateOperation(
518+
key=another_key, operation_type=TransactionOperationType.delete
519+
),
520+
],
514521
)
515522
resp = dapr.get_state(store_name='statestore', key=key)
516523
self.assertEqual(resp.data, b'')

0 commit comments

Comments
 (0)