Clean up the content loading

This commit is contained in:
Veronica Berglyd Olsen
2022-11-01 13:36:22 +01:00
parent 0cfaf4f021
commit f41db97860
5 changed files with 101 additions and 100 deletions
+8 -11
View File
@@ -205,18 +205,15 @@ class NWStatus:
def pack(self):
"""Pack the status entries into a dictionary.
"""
result = []
for key, data in self._store.items():
result. append((
data["name"], {
"key": key,
"count": str(data["count"]),
"red": str(data["cols"][0]),
"green": str(data["cols"][1]),
"blue": str(data["cols"][2]),
}
))
return result
yield (data["name"], {
"key": key,
"count": str(data["count"]),
"red": str(data["cols"][0]),
"green": str(data["cols"][1]),
"blue": str(data["cols"][2]),
})
return
def unpack(self, data):
"""Unpack a data dictionary and set the class values.