From 610abf93021186a529c4bdeaf34d33682ea640da Mon Sep 17 00:00:00 2001 From: Susa Giogoli <su.giogoli@icloud.com> Date: Fri, 14 Jul 2023 14:48:28 +0200 Subject: [PATCH] Some more cleaning and commenting --- newmodeljsonparse.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/newmodeljsonparse.py b/newmodeljsonparse.py index 730f3c2..a1e35fd 100644 --- a/newmodeljsonparse.py +++ b/newmodeljsonparse.py @@ -367,18 +367,18 @@ def getComponentVarList(searched, list1, component, jsoncomponents): return list1 -def buildComponents(interfacesreturn, variabledict, jsoninterfaces, jsoncomponents, jsonmeasurements, jsonparameters, jsonfunctions, objcomponentsclone, enumnodedict, enumvalues, enumnames): - """ - Iterates recursively through - :param interfacesreturn: - :param variabledict: - :param jsoninterfaces: - :param jsoncomponents: - :param jsonmeasurements: - :param jsonparameters: - :param jsonfunctions: - :param objcomponentsclone: - :param enumnodedict: +def buildComponents(interfacesreturn, jsoninterfaces, jsoncomponents, jsonmeasurements, jsonparameters, jsonfunctions, enumnodedict, enumvalues, enumnames): + """objcomponentsclone, + Iterates recursively throught the rootcomponent of the interface and its components etc.. + With every iteration it collects all variables and functions from each component and their basecomponents, + creates their respective objects and writesthem with the writefunctions from wf. + :param interfacesreturn: a dict in which all created objecttype node names get collect in the Format {uuid : objecttype} + :param jsoninterfaces: a list of all components that get looked at during the one rekursive iteration + :param jsoncomponents: a list of all elements with type component + :param jsonmeasurements: a list of all ements with type measurement + :param jsonparameters: a list with all elements of type parameter + :param jsonfunctions: a list of all elements with type function + :param enumnodedict: a dict with all the enumtypes from the format {uuid : enumtypenodename} :param enumvalues: :param enumnames: :return: @@ -408,10 +408,11 @@ def buildComponents(interfacesreturn, variabledict, jsoninterfaces, jsoncomponen functionobj = getFunctions(objfunctionlist, jsonparameters, jsonmeasurements) functionvars = getComponentVarList("functions", [], rootobj, jsoncomponents) wf.writefunction(functionobj, interfacesreturn[str(obj["uuid"])], functionvars.copy()) - buildComponents(interfacesreturn, variabledict, objcomponentslist, jsoncomponents, jsonmeasurements, jsonparameters, jsonfunctions, objcomponentsclone, enumnodedict, enumvalues, enumnames) + buildComponents(interfacesreturn, objcomponentslist, jsoncomponents, jsonmeasurements, jsonparameters, jsonfunctions, enumnodedict, enumvalues, enumnames) return interfacesreturn + def instantiateComponents(typesdict, interfaces, jsoncomponents, instantiatedict, eventsdict, streamsdict, componentlist, headnodeindex, variabledict): for interface in interfaces: root = interface @@ -497,7 +498,7 @@ def main(): enumnodedict = returnvalenums[0] enumvalues = returnvalenums[1] enumnames = returnvalenums[2] - typesdict = buildComponents({}, {}, jsoninterfaces, jsoncomponents, jsonmeasurements, jsonparameters, jsonfunctions, [], enumnodedict, enumvalues, enumnames) + typesdict = buildComponents({}, jsoninterfaces, jsoncomponents, jsonmeasurements, jsonparameters, jsonfunctions, enumnodedict, enumvalues, enumnames) returnval = instantiate(typesdict, jsoninterfaces, jsoncomponents) instantiatedict = returnval[0] eventsdict = returnval[1] -- GitLab