summaryrefslogtreecommitdiff
path: root/jimbrella/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'jimbrella/utils.py')
-rw-r--r--jimbrella/utils.py11
1 files changed, 0 insertions, 11 deletions
diff --git a/jimbrella/utils.py b/jimbrella/utils.py
index 31fafbc..fd2c86d 100644
--- a/jimbrella/utils.py
+++ b/jimbrella/utils.py
@@ -19,14 +19,3 @@ def human_timedelta(delta: timedelta) -> str:
hours = delta.seconds // 3600
minutes = (delta.seconds - (hours * 3600)) // 60
return days + f"{hours:0>2}:{minutes:0>2}" # zero-pad to two digits
-
-
-def group_by_key(data: list, key: str) -> dict:
- """Groups a list of dicts by the value of their `key` into a dict of lists of dicts."""
- keys = set([item[key] for item in data])
- # initiate a dict with `keys` as keys and [] as values
- groups = dict.fromkeys(keys, [])
- for k in keys:
- groups[k] = [item for item in data if item[key] == k]
-
- return groups