From 12204db42937fcbee8ef88443d8cf14516a16a56 Mon Sep 17 00:00:00 2001 From: mas2hc Date: Mon, 17 Jul 2023 19:12:29 +0700 Subject: [PATCH] Adds reset function to avoid memory interference. --- JsonPreprocessor/CJsonPreprocessor.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/JsonPreprocessor/CJsonPreprocessor.py b/JsonPreprocessor/CJsonPreprocessor.py index 227760ce..518d110b 100644 --- a/JsonPreprocessor/CJsonPreprocessor.py +++ b/JsonPreprocessor/CJsonPreprocessor.py @@ -184,6 +184,16 @@ def __init__(self, syntax: CSyntaxType = CSyntaxType.json , currentCfg : dict = self.lNestedParams = [] self.lDotInParamName = [] + def __reset(self) -> None: + ''' + Reset initial variables which are set in constructor method after master Json file is loaded. + ''' + self.lImportedFiles = [] + self.recursive_level = 0 + self.lUpdatedParams = {} + self.lNestedParams = [] + self.lDotInParamName = [] + def __sNormalizePath(self, sPath : str) -> str: """ Python struggles with @@ -778,5 +788,7 @@ def __handleStrNoneTrueFalse(objJson): exec(sExec, globals(), ldict) except: raise Exception(f"The variable '{parseNestedParam[0]}' is not available!") + + self.__reset() return oJson