Skip to content

Commit

Permalink
Avoided Python keyword 'type'
Browse files Browse the repository at this point in the history
  • Loading branch information
derekkingston committed Jan 9, 2018
1 parent 3dcf5d6 commit b71ee3a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/avtas/lmcp/lmcpgen/PythonMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand Down
8 changes: 4 additions & 4 deletions src/templates/py/LMCPFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()):
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions src/templates/py/SeriesEnum.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

class SeriesEnum:

def getName(self, type):
def getName(self, type_):
-<list_name_for_type>-

def getType(self, name):
-<list_type_for_name>-
return -1

def getInstance(self, type):
def getInstance(self, type_):
-<list_instance_for_type>-
return None

0 comments on commit b71ee3a

Please sign in to comment.