Skip to content

Commit 5dc2aba

Browse files
committed
reformat kv_entry actions with black
Signed-off-by: Jacob Floyd <[email protected]>
1 parent 31dfefc commit 5dc2aba

File tree

4 files changed

+22
-26
lines changed

4 files changed

+22
-26
lines changed

actions/kv_entry_append_property.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
from lib.action import St2BaseAction
66

7-
__all__ = [
8-
'St2KVPEntryAppendPropertyAction'
9-
]
7+
__all__ = ["St2KVPEntryAppendPropertyAction"]
108

119

1210
class St2KVPEntryAppendPropertyAction(St2BaseAction):
1311
# noinspection PyShadowingBuiltins
1412
def run(self, key, entry, property, value):
15-
with coordination_service.get_coordinator().get_lock('st2.kv_entry.' + key):
13+
with coordination_service.get_coordinator().get_lock("st2.kv_entry." + key):
1614
# get and deserialize object or fail.
1715
_key = self.client.keys.get_by_name(key, decrypt=False)
1816

@@ -36,7 +34,11 @@ def run(self, key, entry, property, value):
3634
try:
3735
_property.append(value)
3836
except AttributeError:
39-
raise Exception("Cannot append. Property {}.{}.{} is not an array!".format(key, entry, property))
37+
raise Exception(
38+
"Cannot append. Property {}.{}.{} is not an array!".format(
39+
key, entry, property
40+
)
41+
)
4042

4143
_entry[property] = _property
4244
deserialized[entry] = _entry
@@ -48,8 +50,8 @@ def run(self, key, entry, property, value):
4850

4951
self.client.keys.update(kvp)
5052
response = {
51-
'key': key,
52-
'entry_name': entry,
53-
'entry': _entry,
53+
"key": key,
54+
"entry_name": entry,
55+
"entry": _entry,
5456
}
5557
return response

actions/kv_entry_delete_property.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
from lib.action import St2BaseAction
66

7-
__all__ = [
8-
'St2KVPEntryDeletePropertyAction'
9-
]
7+
__all__ = ["St2KVPEntryDeletePropertyAction"]
108

119

1210
class St2KVPEntryDeletePropertyAction(St2BaseAction):
1311
# noinspection PyShadowingBuiltins
1412
def run(self, key, entry, property):
15-
with coordination_service.get_coordinator().get_lock('st2.kv_entry.' + key):
13+
with coordination_service.get_coordinator().get_lock("st2.kv_entry." + key):
1614
# get and deserialize object or fail.
1715
_key = self.client.keys.get_by_name(key, decrypt=False)
1816

@@ -42,9 +40,9 @@ def run(self, key, entry, property):
4240

4341
self.client.keys.update(kvp)
4442
response = {
45-
'key': key,
46-
'entry_name': entry,
47-
'entry': _entry,
48-
'entry_deleted': not _entry,
43+
"key": key,
44+
"entry_name": entry,
45+
"entry": _entry,
46+
"entry_deleted": not _entry,
4947
}
5048
return response

actions/kv_entry_get.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
from lib.action import St2BaseAction
44

5-
__all__ = [
6-
'St2KVPEntryGetAction'
7-
]
5+
__all__ = ["St2KVPEntryGetAction"]
86

97

108
class St2KVPEntryGetAction(St2BaseAction):

actions/kv_entry_upsert_property.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
from lib.action import St2BaseAction
66

7-
__all__ = [
8-
'St2KVPEntryUpsertPropertyAction'
9-
]
7+
__all__ = ["St2KVPEntryUpsertPropertyAction"]
108

119

1210
class St2KVPEntryUpsertPropertyAction(St2BaseAction):
1311
# noinspection PyShadowingBuiltins
1412
def run(self, key, entry, property, value):
15-
with coordination_service.get_coordinator().get_lock('st2.kv_entry.' + key):
13+
with coordination_service.get_coordinator().get_lock("st2.kv_entry." + key):
1614
# get and deserialize object or fail.
1715
_key = self.client.keys.get_by_name(key, decrypt=False)
1816

@@ -42,8 +40,8 @@ def run(self, key, entry, property, value):
4240

4341
self.client.keys.update(kvp)
4442
response = {
45-
'key': key,
46-
'entry_name': entry,
47-
'entry': _entry,
43+
"key": key,
44+
"entry_name": entry,
45+
"entry": _entry,
4846
}
4947
return response

0 commit comments

Comments
 (0)