From 66264fe5730943576b847077dadf5e4531d4beb1 Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Wed, 2 Feb 2022 11:15:09 +0800 Subject: Adapt core to new db --- jimbrella/utils.py | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'jimbrella/utils.py') 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 -- cgit v1.2.3