apibuild: Simplify uniq function

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é <berrange@redhat.com>
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
This commit is contained in:
Radostin Stoyanov 2018-03-20 06:48:56 +00:00 committed by Daniel P. Berrangé
parent 94f417baa9
commit e169caa462

View File

@ -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,