mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
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:
parent
94f417baa9
commit
e169caa462
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user