From 6443f34337d743a3ec6397609595a1571e187abe Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 21 Feb 2019 08:59:29 -0800 Subject: [PATCH] Drop _unique_dicts function It is not actually needed. projects_info deduplicates the package list, placing other builds into the builds list instead of making a new package entry. So it returns a sorted and deduped list of packages, as expected. --- src/pylorax/api/projects.py | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/pylorax/api/projects.py b/src/pylorax/api/projects.py index 9b31eb09..6f9de38c 100644 --- a/src/pylorax/api/projects.py +++ b/src/pylorax/api/projects.py @@ -353,29 +353,7 @@ def modules_list(dbo, module_names): """ # TODO - Figure out what to do with this for Fedora 'modules' - projs = _unique_dicts(projects_info(dbo, module_names), key=lambda p: p["name"].lower()) - return list(map(proj_to_module, projs)) - -def _unique_dicts(lst, key): - """Return a new list of dicts, only including one match of key(d) - - :param lst: list of dicts - :type lst: list - :param key: key function to match lst entries - :type key: function - :returns: list of the unique lst entries - :rtype: list - - Uses key(d) to test for duplicates in the returned list, creating a - list of unique return values. - """ - result = [] - result_keys = [] - for d in lst: - if key(d) not in result_keys: - result.append(d) - result_keys.append(key(d)) - return result + return list(map(proj_to_module, projects_info(dbo, module_names))) def modules_info(dbo, module_names): """Return details about a module, including dependencies