diff --git a/src/avtas/lmcp/lmcpgen/PythonMethods.java b/src/avtas/lmcp/lmcpgen/PythonMethods.java index 1c8e9c4..eb254bd 100644 --- a/src/avtas/lmcp/lmcpgen/PythonMethods.java +++ b/src/avtas/lmcp/lmcpgen/PythonMethods.java @@ -440,7 +440,7 @@ public static String struct_series_name_setup(MDMInfo[] infos, MDMInfo info, fin public static String list_name_for_type(MDMInfo[] infos, MDMInfo info, File outfile, StructInfo st, EnumInfo en, String ws) throws Exception { StringBuffer buf = new StringBuffer(); for (int i = 0; i < info.structs.length; i++) { - buf.append( ws + "if(type == " + info.structs[i].id + "): return \"" + info.structs[i].name + "\"\n" ); + buf.append( ws + "if(type_ == " + info.structs[i].id + "): return \"" + info.structs[i].name + "\"\n" ); } return buf.toString(); } @@ -456,7 +456,7 @@ public static String list_type_for_name(MDMInfo[] infos, MDMInfo info, File outf public static String list_instance_for_type(MDMInfo[] infos, MDMInfo info, File outfile, StructInfo st, EnumInfo en, String ws) throws Exception { StringBuffer buf = new StringBuffer(); for (int i = 0; i < info.structs.length; i++) { - buf.append( ws + "if(type == " + info.structs[i].id + "): return " + info.structs[i].name + "." + info.structs[i].name + "()\n" ); + buf.append( ws + "if(type_ == " + info.structs[i].id + "): return " + info.structs[i].name + "." + info.structs[i].name + "()\n" ); } return buf.toString(); } diff --git a/src/templates/py/LMCPFactory.py b/src/templates/py/LMCPFactory.py index c0fe62e..358c0f5 100644 --- a/src/templates/py/LMCPFactory.py +++ b/src/templates/py/LMCPFactory.py @@ -35,10 +35,10 @@ def getObject(self, buffer): if len(buffer) < HEADER_SIZE: print("getObject() : buffer too small for message") return None - type = getLMCPType(buffer) + type_ = getLMCPType(buffer) series = getLMCPSeries(buffer) version = getLMCPVersion(buffer) - obj = self.createObject(series, version, type) + obj = self.createObject(series, version, type_) if obj != None: obj.unpack(buffer, HEADER_SIZE + 15) return obj @@ -83,7 +83,7 @@ def unpackFromXMLNode(self, domNode): return objs def unpackFromDict(self, d): - if type(d) is not dict: + if not isinstance(d, dict): return None if ("datatype" in d.keys() and "datastring" in d.keys()): @@ -94,7 +94,7 @@ def unpackFromDict(self, d): obj = None for key in d: - if type(d[key]) is dict: + if isinstance(d[key], dict): name_parts = key.split("/") if len(name_parts) == 2: series_name = name_parts[0] diff --git a/src/templates/py/SeriesEnum.py b/src/templates/py/SeriesEnum.py index 4aa85c9..e3bea65 100644 --- a/src/templates/py/SeriesEnum.py +++ b/src/templates/py/SeriesEnum.py @@ -17,13 +17,13 @@ class SeriesEnum: - def getName(self, type): + def getName(self, type_): -- def getType(self, name): -- return -1 - def getInstance(self, type): + def getInstance(self, type_): -- return None