From ec0094e06c81f084303edf40a13db0ee1e05fc06 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 24 Mar 2019 19:12:39 +0100 Subject: Use sorted() for sorted iteration --- lv2specgen/lv2specgen.py | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'lv2specgen') diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py index 94af967..17e4fa5 100755 --- a/lv2specgen/lv2specgen.py +++ b/lv2specgen/lv2specgen.py @@ -485,10 +485,9 @@ def rdfsClassInfo(term, m): restrictions.append(getSubject(meta_type)) if len(superclasses) > 0: - superclasses.sort() doc += "\nSub-class of" first = True - for superclass in superclasses: + for superclass in sorted(superclasses): doc += getProperty(getTermLink(superclass), first) first = False @@ -538,10 +537,9 @@ def rdfsClassInfo(term, m): # Find out about properties which have rdfs:domain of t d = classdomains.get(str(term), "") if d: - d.sort() dlist = '' first = True - for k in d: + for k in sorted(d): dlist += getProperty(getTermLink(k), first) first = False doc += "In domain of%s" % dlist @@ -549,10 +547,9 @@ def rdfsClassInfo(term, m): # Find out about properties which have rdfs:range of t r = classranges.get(str(term), "") if r: - r.sort() rlist = '' first = True - for k in r: + for k in sorted(r): rlist += getProperty(getTermLink(k), first) first = False doc += "In range of%s" % rlist @@ -754,9 +751,8 @@ def buildIndex(m, classlist, proplist, instalist=None, filelist=None): if (len(classlist) > 0): head += 'Classes' body += '