From e169caa462a2bc67158ce480b1c9f9f320996077 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Tue, 20 Mar 2018 06:48:56 +0000 Subject: [PATCH] apibuild: Simplify uniq function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a set (unordered collections of unique elements) [1] to remove repeated elements in a list. 1: https://docs.python.org/3/tutorial/datastructures.html#sets Reviewed-by: Daniel P. Berrangé Signed-off-by: Radostin Stoyanov --- docs/apibuild.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 50ddf372dd..1619c8836f 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -130,11 +130,7 @@ def escape(raw): return raw def uniq(items): - d = {} - for item in items: - d[item] = 1 - k = sorted(d.keys()) - return k + return sorted(set(items)) class identifier: def __init__(self, name, header=None, module=None, type=None, lineno=0, -- GitLab