aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-06-16 09:34:17 -0400
committerDavid Robillard <d@drobilla.net>2022-06-16 09:34:51 -0400
commit4444068bc4e273b86afbab28641abe7e477af25f (patch)
treed1fed908f5505396658a13c1162562e60989ccc4
parent74f10d4e420cf711ccc824a3029b01a213a0dec2 (diff)
downloadlv2-4444068bc4e273b86afbab28641abe7e477af25f.tar.xz
lv2specgen: Use cleaner methods for string manipulation
-rwxr-xr-xlv2specgen/lv2specgen.py8
1 files changed, 4 insertions, 4 deletions
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))