From 4444068bc4e273b86afbab28641abe7e477af25f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 16 Jun 2022 09:34:17 -0400 Subject: lv2specgen: Use cleaner methods for string manipulation --- lv2specgen/lv2specgen.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lv2specgen') diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py index c7b9132..d04966a 100755 --- a/lv2specgen/lv2specgen.py +++ b/lv2specgen/lv2specgen.py @@ -154,7 +154,7 @@ def isLiteral(n): def niceName(uri): global spec_bundle if uri.startswith(spec_ns_str): - return uri[len(spec_ns_str) :] + return uri.removeprefix(spec_ns_str) elif uri == str(rdfs.seeAlso): return "See also" @@ -830,7 +830,7 @@ def getShortName(uri): def getAnchor(uri): uri = str(uri) if uri.startswith(spec_ns_str): - return uri[len(spec_ns_str) :].replace("/", "_") + return uri.removeprefix(spec_ns_str).replace("/", "_") else: return getShortName(uri) @@ -861,7 +861,7 @@ def buildIndex(m, classlist, proplist, instalist=None): local_subclass = False for p in findStatements(m, c, rdfs.subClassOf, None): parent = str(p[2]) - if parent[0 : len(spec_ns_str)] == spec_ns_str: + if parent.startswith(spec_ns_str): local_subclass = True if local_subclass: continue @@ -1512,7 +1512,7 @@ def specgen( ) filename = os.path.basename(specloc) - basename = filename[0 : filename.rfind(".")] + basename = os.path.splitext(filename)[0] template = template.replace("@STYLE_URI@", style_uri) template = template.replace("@PREFIXES@", str(prefixes_html)) -- cgit v1.2.1