From e9d7716d4de109a214e25422e1a543665106c66d Mon Sep 17 00:00:00 2001 From: Samuel Mok <131749029+utsmok@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:18:00 +0100 Subject: [PATCH] Replaces strlen() with len() and substr() with a slice --- stenway/sml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stenway/sml.py b/stenway/sml.py index 720e241..57e744e 100644 --- a/stenway/sml.py +++ b/stenway/sml.py @@ -172,7 +172,7 @@ def __init__(self, rootName = "Root"): self.emptyNodesAfter = [] def setDefaultIndentation(self, defaultIndentation): - if (defaultIndentation != None and strlen(defaultIndentation) > 0 and + if (defaultIndentation != None and len(defaultIndentation) > 0 and not WsvString.isWhitespace(defaultIndentation)): raise Exception("Indentation value contains non whitespace character") @@ -488,7 +488,7 @@ def serializeDocumentNonPreserving(document, minified = False): endKeyword = None result = SmlSerializer.serializeElementNonPreserving(document.getRoot(), 0, defaultIndentation, endKeyword) - result = substr(result, 0, -1) + result = result[0:-1] return result def serializeElementNonPreserving(element, level, defaultIndentation, endKeyword):