From c498b60ae068aa3dd2304e458280b103a8772efb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 23 Sep 2018 14:04:20 +0200 Subject: Fix various Python style issues --- lv2specgen/lv2docgen.py | 17 +++++++---------- lv2specgen/lv2specgen.py | 35 +++++++++++++++++------------------ 2 files changed, 24 insertions(+), 28 deletions(-) (limited to 'lv2specgen') diff --git a/lv2specgen/lv2docgen.py b/lv2specgen/lv2docgen.py index 423659e..23a239d 100755 --- a/lv2specgen/lv2docgen.py +++ b/lv2specgen/lv2docgen.py @@ -16,16 +16,16 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +import errno +import os +import sys + __date__ = '2012-03-27' __version__ = '0.0.0' __authors__ = 'David Robillard' __license__ = 'ISC License ' __contact__ = 'devel@lists.lv2plug.in' -import errno -import os -import sys - try: import rdflib except ImportError: @@ -47,7 +47,7 @@ def get_doc(model, subject): if comment: return '

%s

' % comment return '' - + def port_doc(model, port): name = model.value(port, lv2.name, None) comment = model.value(port, rdfs.comment, None) @@ -131,11 +131,8 @@ if __name__ == '__main__': pass else: raise - - print 'Writing <%s> documentation to %s' % (plugin, outpath) + + print('Writing <%s> documentation to %s' % (plugin, outpath)) out = open(outpath, 'w') out.write(html) out.close() - - - diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py index ada5bd8..1435f12 100755 --- a/lv2specgen/lv2specgen.py +++ b/lv2specgen/lv2specgen.py @@ -30,18 +30,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -__date__ = "2011-10-26" -__version__ = __date__.replace('-', '.') -__authors__ = """ -Christopher Schmidt, -Uldis Bojars, -Sergio Fernández, -David Robillard""" -__license__ = "MIT License " -__contact__ = "devel@lists.lv2plug.in" - import datetime -import glob import optparse import os import re @@ -51,6 +40,16 @@ import xml.sax.saxutils import xml.dom import xml.dom.minidom +__date__ = "2011-10-26" +__version__ = __date__.replace('-', '.') +__authors__ = """ +Christopher Schmidt, +Uldis Bojars, +Sergio Fernández, +David Robillard""" +__license__ = "MIT License " +__contact__ = "devel@lists.lv2plug.in" + try: from lxml import etree have_lxml = True @@ -98,7 +97,7 @@ ns_list = { "http://lv2plug.in/ns/lv2core#" : "lv2", "http://usefulinc.com/ns/doap#" : "doap", "http://ontologi.es/doap-changeset#" : "dcs" - } +} rdf = rdflib.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#') rdfs = rdflib.Namespace('http://www.w3.org/2000/01/rdf-schema#') @@ -457,7 +456,7 @@ def parseCollection(model, node): def getTermLink(uri, subject=None, predicate=None): uri = str(uri) extra = '' - if subject != None and predicate != None: + if subject is not None and predicate is not None: extra = 'about="%s" rel="%s" resource="%s"' % (str(subject), niceName(str(predicate)), uri) if (uri.startswith(spec_ns_str)): return '%s' % (uri.replace(spec_ns_str, ""), extra, niceName(uri)) @@ -500,7 +499,7 @@ def rdfsClassInfo(term, m): onProp = getObject(p) elif getPredicate(p) == rdfs.comment: comment = getObject(p) - if onProp != None: + if onProp is not None: doc += 'Restriction on %s' % getTermLink(onProp) prop_str = '' @@ -530,7 +529,7 @@ def rdfsClassInfo(term, m): if prop_str != '': doc += '%s
\n' % prop_str - if comment != None: + if comment is not None: doc += "%s\n" % getLiteralString(comment) doc += '' @@ -808,7 +807,7 @@ def buildIndex(m, classlist, proplist, instalist=None, filelist=None): body += '
  • %s
  • ' % termLink(m, p) body += '\n' - if (instalist != None and len(instalist) > 0): + if (instalist is not None and len(instalist) > 0): head += 'Instances' body += '
      ' instalist.sort() @@ -818,7 +817,7 @@ def buildIndex(m, classlist, proplist, instalist=None, filelist=None): body += '
    • %s
    • ' % (anchor, p) body += '
    \n' - if (filelist != None and len(filelist) > 0): + if (filelist is not None and len(filelist) > 0): head += 'Files' body += '
      ' filelist.sort() @@ -1030,7 +1029,7 @@ def specVersion(m, subject): latest_doap_revision = revision latest_doap_release = getObject(i) date = "" - if latest_doap_release != None: + if latest_doap_release is not None: for i in findStatements(m, latest_doap_release, doap.created, None): date = getLiteralString(getObject(i)) -- cgit v1.2.1