Commit a51da808 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Added configuration file for flake8 pass, too

parent 8c985d5f
[flake8]
ignore = E501,E225,C103
max-line-length = 160
......@@ -219,8 +219,8 @@ An example for SetLength:
return "Choose the information you want - whole-structure or sequence dump not supported."
def __getattr__(self, x):
self._Caccessor += "_"+Clean(x)
self._accessPath += "."+x
self._Caccessor += "_" + Clean(x)
self._accessPath += "." + x
return self
def __setattr__(self, name, value):
......@@ -237,7 +237,7 @@ An example for SetLength:
def Get(self, **args): # postfix="", reset=True
try:
bridgeFuncName = Clean(self._nodeTypeName) + "_" + self._Caccessor + "_Get"+args.get("postfix", "")
bridgeFuncName = Clean(self._nodeTypeName) + "_" + self._Caccessor + "_Get" + args.get("postfix", "")
if bridgeFuncName not in DV_Types.funcTypeLookup:
raise AsnCoderError("Function %s not found in lookup - contact support." % bridgeFuncName)
resType = DV_Types.funcTypeLookup[bridgeFuncName]
......@@ -269,7 +269,7 @@ An example for SetLength:
def Set(self, value, **args): # postfix="", reset=True
try:
# print Clean(self._nodeTypeName) + "_" + self._Caccessor + "_Set"+postfix
bridgeFunc = getattr(JMP, Clean(self._nodeTypeName) + "_" + self._Caccessor + "_Set"+args.get("postfix", ""))
bridgeFunc = getattr(JMP, Clean(self._nodeTypeName) + "_" + self._Caccessor + "_Set" + args.get("postfix", ""))
if isinstance(value, float):
ctypesValue = c_double(value)
elif isinstance(value, int):
......@@ -283,8 +283,9 @@ An example for SetLength:
oldAP = self._accessPath
if args.get("reset", True):
self.Reset()
raise AsnCoderError("The access path you used (%s) or the value you tried to assign (%s) is not valid. %s" %
(oldAP, str(value), str(e)))
raise AsnCoderError(
"The access path you used (%s) or the value you tried to assign (%s) is not valid. %s" % (
oldAP, str(value), str(e)))
if args.get("reset", True):
self.Reset()
......@@ -298,7 +299,7 @@ An example for SetLength:
def getErrCode(pErr):
errCode = 0
for i in range(4):
errCode = (errCode << 8) | GetBufferByte(pErr, (3-i))
errCode = (errCode << 8) | GetBufferByte(pErr, (3 - i))
return errCode
def Encode(self, bitstream, bACN=False):
......
......@@ -46,6 +46,7 @@ from commonPy.recursiveMapper import RecursiveMapper
import commonPy.verify
def usage():
'''Print usage instructions.'''
msg = 'Usage: %s <options> input1.asn1 [input2.asn1]...\nWhere options are:\n'
......@@ -114,7 +115,7 @@ class Printer(RecursiveMapper):
lines.append(
"%sif (%s.kind == %s) {" %
(self.maybeElse(childNo), srcCVariable, self.CleanName(child[2])))
lines.extend([' '+x
lines.extend([' ' + x
for x in self.Map(
"%s.u.%s" % (srcCVariable, self.CleanName(child[0])),
prefix + "::" + self.CleanName(child[0]),
......@@ -131,7 +132,7 @@ class Printer(RecursiveMapper):
lines.append(" int i%s;" % uniqueId)
limit = sourceSequenceLimit(node, srcCVariable)
lines.append(" for(i%s=0; i%s<%s; i%s++) {" % (uniqueId, uniqueId, limit, uniqueId))
lines.extend([" "+x
lines.extend([" " + x
for x in self.Map(
"%s.arr[i%s]" % (srcCVariable, uniqueId),
prefix + "::Elem",
......@@ -153,7 +154,7 @@ def main():
if sys.argv.count("-o") != 0:
idx = sys.argv.index("-o")
try:
commonPy.configMT.outputDir = os.path.normpath(sys.argv[idx+1]) + os.sep
commonPy.configMT.outputDir = os.path.normpath(sys.argv[idx + 1]) + os.sep
except: # pragma: no cover
usage() # pragma: no cover
del sys.argv[idx]
......@@ -239,7 +240,7 @@ def main():
C_SourceFile.write('#ifdef __linux__\n')
C_SourceFile.write(' pthread_mutex_lock(&g_printing_mutex);\n')
C_SourceFile.write('#endif\n')
lines = [" "+x
lines = [" " + x
for x in printer.Map(
'(*pData)',
'',
......
......@@ -129,7 +129,7 @@ class Printer(RecursiveMapper):
(self.maybeElse(childNo), srcCVariable, self.CleanName(child[2])))
lines.append(" printf(\"%s:\");" % child[0]) # Choices need the field name printed
lines.extend(
[' '+x
[' ' + x
for x in self.Map(
"%s.u.%s" % (srcCVariable, self.CleanName(child[0])),
prefix + "::" + self.CleanName(child[0]),
......@@ -150,7 +150,7 @@ class Printer(RecursiveMapper):
lines.append(" if (i%s) " % uniqueId)
lines.append(" printf(\",\");")
lines.extend(
[" "+x
[" " + x
for x in self.Map(
"%s.arr[i%s]" % (srcCVariable, uniqueId),
prefix + "::Elem",
......@@ -173,7 +173,7 @@ def main():
if sys.argv.count("-o") != 0:
idx = sys.argv.index("-o")
try:
commonPy.configMT.outputDir = os.path.normpath(sys.argv[idx+1]) + os.sep
commonPy.configMT.outputDir = os.path.normpath(sys.argv[idx + 1]) + os.sep
except: # pragma: no cover
usage() # pragma: no cover
del sys.argv[idx]
......@@ -262,7 +262,7 @@ def main():
C_SourceFile.write(' //printf("%%s %s ::= ", paramName);\n' % nodeTypename)
C_SourceFile.write(' printf("%s ", paramName);\n')
# C_SourceFile.write('\n'.join(printer.Map('(*pData)', '', node, leafTypeDict, commonPy.asnParser.g_names)))
lines = [" "+x for x in printer.Map('(*pData)', '', node, leafTypeDict, commonPy.asnParser.g_names)]
lines = [" " + x for x in printer.Map('(*pData)', '', node, leafTypeDict, commonPy.asnParser.g_names)]
C_SourceFile.write("\n".join(lines))
C_SourceFile.write('\n#ifdef __linux__\n')
C_SourceFile.write(' pthread_mutex_unlock(&g_printing_mutex);\n')
......
......@@ -350,17 +350,17 @@ def CreateGettersAndSetters(path, params, accessPathInC, node, names, leafTypeDi
if node._range == []:
panic("Python_A_mapper: string (in %s) must have a SIZE constraint!\n" % node.Location()) # pragma: no cover
if isSequenceVariable(node):
CommonBaseImpl("OCTETSTRING", "long", path, params, accessPathInC+".nCount", "Length")
CommonBaseImpl("OCTETSTRING", "long", path, params, accessPathInC + ".nCount", "Length")
else:
CommonBaseImplSequenceFixed("OCTETSTRING", "long", path, params, accessPathInC+".nCount", node, "Length")
CommonBaseImplSequenceFixed("OCTETSTRING", "long", path, params, accessPathInC + ".nCount", node, "Length")
params.AddParam('int', "iDx", leafTypeDict)
CommonBaseImpl("OCTETSTRING_bytes", "byte", path+"_iDx", params, accessPathInC + (".arr["+params._vars[-1]+"]"), "")
CommonBaseImpl("OCTETSTRING_bytes", "byte", path + "_iDx", params, accessPathInC + (".arr[" + params._vars[-1] + "]"), "")
params.Pop()
elif isinstance(node, AsnEnumerated):
CommonBaseImpl("ENUMERATED", "int", path, params, accessPathInC)
elif isinstance(node, AsnSequence) or isinstance(node, AsnSet) or isinstance(node, AsnChoice):
if isinstance(node, AsnChoice):
CommonBaseImpl("CHOICE selector", "int", path+"_kind", params, accessPathInC+".kind")
CommonBaseImpl("CHOICE selector", "int", path + "_kind", params, accessPathInC + ".kind")
union = ""
if isinstance(node, AsnChoice):
union = ".u"
......@@ -372,18 +372,18 @@ def CreateGettersAndSetters(path, params, accessPathInC, node, names, leafTypeDi
baseTypeOfChild = leafTypeDict.get(baseTypeOfChild, baseTypeOfChild)
if baseTypeOfChild not in ['INTEGER', 'REAL', 'BOOLEAN', 'OCTET STRING', 'ENUMERATED']:
useStar = '' if baseTypeOfChild.endswith('OF') else '*'
CommonBaseImpl("Field " + childVarname + " selector", CleanNameAsPythonWants(childNode._containedType)+useStar, path+"_"+childVarname, params, accessPathInC+union+"."+childVarname, returnPointer=not baseTypeOfChild.endswith('OF'))
CreateGettersAndSetters(path+"_"+childVarname, params, accessPathInC+union+"."+childVarname, child[1], names, leafTypeDict)
CommonBaseImpl("Field " + childVarname + " selector", CleanNameAsPythonWants(childNode._containedType) + useStar, path + "_" + childVarname, params, accessPathInC + union + "." + childVarname, returnPointer=not baseTypeOfChild.endswith('OF'))
CreateGettersAndSetters(path + "_" + childVarname, params, accessPathInC + union + "." + childVarname, child[1], names, leafTypeDict)
elif isinstance(node, AsnSequenceOf) or isinstance(node, AsnSetOf):
containedNode = node._containedType
if isinstance(containedNode, str):
containedNode = names[containedNode]
if isSequenceVariable(node):
CommonBaseImpl("SEQUENCEOF/SETOF", "long", path, params, accessPathInC+".nCount", "Length")
CommonBaseImpl("SEQUENCEOF/SETOF", "long", path, params, accessPathInC + ".nCount", "Length")
else:
CommonBaseImplSequenceFixed("SEQUENCEOF/SETOF", "long", path, params, accessPathInC+".nCount", node, "Length")
CommonBaseImplSequenceFixed("SEQUENCEOF/SETOF", "long", path, params, accessPathInC + ".nCount", node, "Length")
params.AddParam('int', "iDx", leafTypeDict)
CreateGettersAndSetters(path+"_iDx", params, accessPathInC + (".arr["+params._vars[-1]+"]"), node._containedType, names, leafTypeDict)
CreateGettersAndSetters(path + "_iDx", params, accessPathInC + (".arr[" + params._vars[-1] + "]"), node._containedType, names, leafTypeDict)
params.Pop()
......@@ -448,8 +448,8 @@ def DumpTypeDumper(codeIndent, outputIndent, lines, variableName, node, names):
lines.append(codeIndent + 'def emitElem(i):')
lines.append(codeIndent + ' if i>0:')
lines.append(codeIndent + ' lines.append(",")')
DumpTypeDumper(codeIndent+" ", outputIndent+" ", lines,
variableName+'[i]', containedNode, names)
DumpTypeDumper(codeIndent + " ", outputIndent + " ", lines,
variableName + '[i]', containedNode, names)
lines.append(codeIndent + "map(emitElem, xrange(%s.GetLength()))" % variableName)
lines.append(codeIndent + 'lines.append("}")')
......@@ -480,7 +480,7 @@ def CreateDeclarationForType(nodeTypename: str, names: AST_Lookup, leafTypeDict:
g_outputFile.write(" super(" + name + ", self).__init__(\"" + name + "\", ptr)\n")
if isinstance(node, AsnString):
g_outputFile.write('''#\n''')
CreateGettersAndSetters(name+"_", Params(nodeTypename), "", node, names, leafTypeDict)
CreateGettersAndSetters(name + "_", Params(nodeTypename), "", node, names, leafTypeDict)
g_outputFile.write("\n def GSER(self):\n")
g_outputFile.write(" ''' Return the GSER representation of the value '''\n")
g_outputFile.write(" lines = []\n")
......
......@@ -284,7 +284,7 @@ def CreateDeclarationForType(nodeTypename, names, leafTypeDict):
if elemNo > 1:
g_outputFile.write('[')
for i in range(0, elemNo):
g_outputFile.write("%s_elem%02d " % (CleanNameAsSimulinkWants(nodeTypename), i+1))
g_outputFile.write("%s_elem%02d " % (CleanNameAsSimulinkWants(nodeTypename), i + 1))
if elemNo > 1:
g_outputFile.write(']')
g_outputFile.write(";\n\n")
......
......@@ -263,7 +263,7 @@ def CreateDeclarationForType(nodeTypename, names, leafTypeDict):
if elemNo > 1:
g_outputFile.write('[')
for i in range(0, elemNo):
g_outputFile.write("%s_elem%02d " % (CleanNameAsSimulinkWants(nodeTypename), i+1))
g_outputFile.write("%s_elem%02d " % (CleanNameAsSimulinkWants(nodeTypename), i + 1))
if elemNo > 1:
g_outputFile.write(']')
g_outputFile.write(";\n\n")
......
......@@ -302,14 +302,14 @@ def OnEnumerated(nodeTypename, node, unused_leafTypeDict):
# g_outputFile.write("\t %s[%s]" % (CleanNameAsScadeWants(member[0]), member[1]))
controlString += 'Value$name=%(enumerant)s`values,pragmas,ed:Value$oid=%(oid)s,kcg:Pragma`pragmas,TEXTenum_val %(value)s,' % {
"enumerant": CleanNameAsScadeWants(member[0]),
"oid": GetOID(nodeTypename+"_"+member[0]),
"oid": GetOID(nodeTypename + "_" + member[0]),
"value": member[1]
}
else: # pragma: no cover
controlString += 'Value$name=%(enumerant)s`values,pragmas,ed:Value$oid=%(oid)s,' % \
{ # pragma: no cover
"enumerant": CleanNameAsScadeWants(member[0]), # pragma: no cover
"oid": GetOID(nodeTypename+"_"+member[0]) # pragma: no cover
"oid": GetOID(nodeTypename + "_" + member[0]) # pragma: no cover
} # pragma: no cover
controlString += 'pragmas`Type,ed:Type$oid=!ed/%(oid)s' % {"oid": oid}
RenderElements(controlString)
......
......@@ -261,7 +261,7 @@ def CreateDeclarationForType(nodeTypename, names, leafTypeDict):
if elemNo > 1:
g_outputFile.write('[')
for i in range(0, elemNo):
g_outputFile.write("%s_elem%02d " % (CleanNameAsSimulinkWants(nodeTypename), i+1))
g_outputFile.write("%s_elem%02d " % (CleanNameAsSimulinkWants(nodeTypename), i + 1))
if elemNo > 1:
g_outputFile.write(']')
g_outputFile.write(";\n\n")
......
......@@ -363,8 +363,8 @@ class {cleanTypename}_SQL(Base):
def CreateEnumerated(nodeTypename, node, unused_leafTypeDict):
checkConstraint = ' OR '.join('data='+x[1] for x in node._members)
constants = '\n '.join(CleanName(x[0])+' = '+x[1]
checkConstraint = ' OR '.join('data=' + x[1] for x in node._members)
constants = '\n '.join(CleanName(x[0]) + ' = ' + x[1]
for x in node._members)
# defValue = CleanName(nodeTypename) + "_SQL." + CleanName(node._members[0][0])
g_sqlalchemyOutput.write('''
......
......@@ -26,7 +26,7 @@ def main():
for si in SystemsAndImplementations:
sp, sp_impl, modelingLanguage, fv_name = si[0], si[1], si[2], si[3]
sp = commonPy.aadlAST.g_apLevelContainers[sp]
print(sp._id+"."+sp_impl, "(", modelingLanguage, ") FV_name:", fv_name)
print(sp._id + "." + sp_impl, "(", modelingLanguage, ") FV_name:", fv_name)
for param in sp._params:
print("\t", end=' ')
if isinstance(param, commonPy.aadlAST.InParam):
......@@ -43,7 +43,7 @@ def main():
if len(sp._connections):
print("\tConnections:")
for pair in sp._connections:
print("\t\tfrom", pair._from._componentId+':'+pair._from._portId, "to", pair._to._componentId+':'+pair._to._portId)
print("\t\tfrom", pair._from._componentId + ':' + pair._from._portId, "to", pair._to._componentId + ':' + pair._to._portId)
print()
if __name__ == "__main__":
......
......@@ -104,7 +104,7 @@ class FromCtoOSS(RecursiveMapper):
lines.append("%sif (%s.kind == %s) {\n" %
(self.maybeElse(childNo), srcCVariable, self.CleanName(child[2])))
lines.extend(
[' '+x
[' ' + x
for x in self.Map(
"%s.u.%s" % (srcCVariable, self.CleanName(child[0])),
destVar + ".u." + self.CleanName(child[0]),
......@@ -123,7 +123,7 @@ class FromCtoOSS(RecursiveMapper):
limit = sourceSequenceLimit(node, srcCVariable)
lines.append(" for(i%s=0; i%s<%s; i%s++) {\n" % (uniqueId, uniqueId, limit, uniqueId))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
"%s.arr[i%s]" % (srcCVariable, uniqueId),
"%s.value[i%s]" % (destVar, uniqueId),
......@@ -194,7 +194,7 @@ class FromOSStoC(RecursiveMapper):
lines.append("%sif (%s.choice == OSS_%s_chosen) {\n" %
(self.maybeElse(childNo), srcVar, self.CleanName(child[0])))
lines.extend(
[' '+x
[' ' + x
for x in self.Map(
srcVar + ".u." + self.CleanName(child[0]),
"%s.u.%s" % (dstCVariable, self.CleanName(child[0])),
......@@ -215,7 +215,7 @@ class FromOSStoC(RecursiveMapper):
lines.append(" for(i%s=0; i%s<%s; i%s++) {\n" %
(uniqueId, uniqueId, targetSequenceLimit(node, dstCVariable), uniqueId))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
srcVar + ".value[i%s]" % uniqueId,
"%s.arr[i%s]" % (dstCVariable, uniqueId),
......@@ -291,7 +291,7 @@ class C_GlueGenerator(ASynchronousToolGlueGenerator):
node,
leafTypeDict,
names)
lines = [" "+x for x in lines]
lines = [" " + x for x in lines]
self.C_SourceFile.write("".join(lines))
if self.useOSS and encoding.lower() == "uper":
......@@ -386,7 +386,7 @@ class C_GlueGenerator(ASynchronousToolGlueGenerator):
node,
leafTypeDict,
names)
lines = [" "+x for x in lines]
lines = [" " + x for x in lines]
self.C_SourceFile.write("".join(lines))
if self.useOSS and encoding.lower() == "uper":
......
This diff is collapsed.
......@@ -170,7 +170,7 @@ class FromObjectGeodeToASN1SCC(RecursiveMapper):
childNo += 1
lines.append("%sif (%s.present == %d) {\n" % (self.maybeElse(childNo), srcSDLVariable, childNo))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
"%s.u.u%d.fd_%s" % (srcSDLVariable, childNo, self.CleanName(child[0]).lower()),
destVar + (".u.%s" % self.CleanName(child[0])),
......@@ -188,7 +188,7 @@ class FromObjectGeodeToASN1SCC(RecursiveMapper):
lines.append(" int i%s;\n" % uniqueId)
lines.append(" for(i%s=0; i%s<%s.length; i%s++) {\n" % (uniqueId, uniqueId, srcSDLVariable, uniqueId))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
"%s.cont[i%s]" % (srcSDLVariable, uniqueId),
"%s.arr[i%s]" % (destVar, uniqueId),
......@@ -273,7 +273,7 @@ class FromObjectGeodeToOSS(RecursiveMapper):
childNo += 1
lines.append("%sif (%s.present == %d) {\n" % (self.maybeElse(childNo), srcSDLVariable, childNo))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
"%s.u.u%d.fd_%s" % (srcSDLVariable, childNo, self.CleanName(child[0]).lower()),
destVar + (".u.%s" % self.CleanName(child[0])),
......@@ -291,7 +291,7 @@ class FromObjectGeodeToOSS(RecursiveMapper):
lines.append(" int i%s;\n" % uniqueId)
lines.append(" for(i%s=0; i%s<%s.length; i%s++) {\n" % (uniqueId, uniqueId, srcSDLVariable, uniqueId))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
"%s.cont[i%s]" % (srcSDLVariable, uniqueId),
"%s.value[i%s]" % (destVar, uniqueId),
......@@ -389,7 +389,7 @@ class FromASN1SCCtoObjectGeode(RecursiveMapper):
lines.append("%sif (%s.kind == %s) {\n" %
(self.maybeElse(childNo), srcVar, self.CleanName(child[2])))
lines.extend(
[' '+x
[' ' + x
for x in self.Map(
srcVar + ".u." + self.CleanName(child[0]),
"%s.u.u%d.fd_%s" % (dstSDLVariable, childNo, self.CleanName(child[0]).lower()),
......@@ -409,7 +409,7 @@ class FromASN1SCCtoObjectGeode(RecursiveMapper):
lines.append(" %s.length = %s;\n" % (dstSDLVariable, limit))
lines.append(" for(i%s=0; i%s<%s; i%s++) {\n" % (uniqueId, uniqueId, limit, uniqueId))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
srcVar + ".arr[i%s]" % uniqueId,
"%s.cont[i%s]" % (dstSDLVariable, uniqueId),
......@@ -505,7 +505,7 @@ class FromOSStoObjectGeode(RecursiveMapper):
lines.append("%sif (%s.choice == OSS_%s_chosen) {\n" %
(self.maybeElse(childNo), srcVar, self.CleanName(child[0])))
lines.extend(
[' '+x
[' ' + x
for x in self.Map(
srcVar + ".u." + self.CleanName(child[0]),
"%s.u.u%d.fd_%s" % (dstSDLVariable, childNo, self.CleanName(child[0]).lower()),
......@@ -524,7 +524,7 @@ class FromOSStoObjectGeode(RecursiveMapper):
lines.append(" %s.length = %s.count;\n" % (dstSDLVariable, srcVar))
lines.append(" for(i%s=0; i%s<%s.count; i%s++) {\n" % (uniqueId, uniqueId, srcVar, uniqueId))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
srcVar + ".value[i%s]" % uniqueId,
"%s.cont[i%s]" % (dstSDLVariable, uniqueId),
......@@ -636,7 +636,7 @@ class OG_GlueGenerator(ASynchronousToolGlueGenerator):
leafTypeDict,
names)
lines = [" "+x.rstrip()+"\\" for x in lines]
lines = [" " + x.rstrip() + "\\" for x in lines]
fileOutHeader.write("\n".join(lines))
# Call the encoder
......@@ -763,7 +763,7 @@ class OG_GlueGenerator(ASynchronousToolGlueGenerator):
leafTypeDict,
names)
lines = [" "+x.rstrip()+"\\" for x in lines]
lines = [" " + x.rstrip() + "\\" for x in lines]
fileOutHeader.write("\n".join(lines))
if self.useOSS and encoding.lower() == "uper":
......
......@@ -115,7 +115,7 @@ errCodes = {{}}
'''.format(fvName=FVname))
if FVname == "":
panic("GUI APLCs must have an FV_Name attribute! (%s)\n" %
subProgram._id+"."+subProgramImplementation) # pragma: no cover
subProgram._id + "." + subProgramImplementation) # pragma: no cover
def OnStartup(modelingLanguage, asnFile, subProgram, subProgramImplementation,
......@@ -525,15 +525,15 @@ def WriteCodeForGUIControls(prefixes, parentControl, node, subProgram,
asnStr = prefixes[0]
for i in range(1, len(prefixes)):
if len(parentControl) >= i:
asnStr += "[{index}]".format(index=parentControl[i-1])
asnStr += prefixes[i][len(prefixes[i-1]):]
asnStr += "[{index}]".format(index=parentControl[i - 1])
asnStr += prefixes[i][len(prefixes[i - 1]):]
for item in prefixes[0].split('.'):
pyStr += '''["{prefixKey}"]'''.format(prefixKey=item)
for i in range(1, len(prefixes)):
if len(parentControl) >= i:
pyStr += "[{index}]".format(index=parentControl[i-1])
for item in prefixes[i][len(prefixes[i-1]):].split('.'):
pyStr += "[{index}]".format(index=parentControl[i - 1])
for item in prefixes[i][len(prefixes[i - 1]):].split('.'):
if len(item) > 0:
pyStr += '''["{prefixKey}"]'''.format(prefixKey=item)
......@@ -565,7 +565,7 @@ def WriteCodeForGUIControls(prefixes, parentControl, node, subProgram,
g_iter * " " + "val" + pyStr + " = " + asnStr + ".GetPyString()\n")
if isinstance(node, AsnEnumerated):
g_fromASN1ToPyside.append(g_iter * " "+"val" + pyStr + " = {}\n")
g_fromASN1ToPyside.append(g_iter * " " + "val" + pyStr + " = {}\n")
for enum_value in node._members:
g_fromPysideToASN1.append(
g_iter * " " + "if val" + pyStr +
......
......@@ -71,8 +71,8 @@ def OnStartup(modelingLanguage, asnFile, subProgram, unused_subProgramImplementa
global g_HeaderFile
if g_HeaderFile is None:
g_HeaderFile = open(outputDir + "python/gui_swig.h", "w")
g_HeaderFile.write('#ifndef __HEADER_'+cleanFVname+"_H__\n")
g_HeaderFile.write('#define __HEADER_'+cleanFVname+"_H__\n\n")
g_HeaderFile.write('#ifndef __HEADER_' + cleanFVname + "_H__\n")
g_HeaderFile.write('#define __HEADER_' + cleanFVname + "_H__\n\n")
g_HeaderFile.write('typedef unsigned char byte;\n\n')
g_HeaderFile.write("int OpenMsgQueueForReading(char *queueName);\n")
g_HeaderFile.write("void CloseMsgQueue(int queue_id);\n")
......@@ -123,9 +123,9 @@ def OnStartup(modelingLanguage, asnFile, subProgram, unused_subProgramImplementa
''' % {"FVname": maybeFVname})
# have we ever seen before the combination of FVname and Language?
if maybeFVname+modelingLanguage.lower() not in g_perFV:
if maybeFVname + modelingLanguage.lower() not in g_perFV:
# No, check for things that must be instantiated once per FV+Lang
g_perFV[maybeFVname+modelingLanguage.lower()] = maybeFVname
g_perFV[maybeFVname + modelingLanguage.lower()] = maybeFVname
# The first time you see an FV with an sp_impl that is also a GUI_PI, create a thread to poll /FVName_PI_queue
if modelingLanguage.lower() == "gui_pi":
......@@ -159,7 +159,7 @@ def OnStartup(modelingLanguage, asnFile, subProgram, unused_subProgramImplementa
g_footerPython.append(' poll_' + cleanFVname + '._bDie = True')
g_footerPython.append(' poll_' + cleanFVname + '.join()')
if modelingLanguage.lower() == "gui_pi":
g_TMprocessors.append(' if self.messageReceivedType == i_'+CleanSP+':')
g_TMprocessors.append(' if self.messageReceivedType == i_' + CleanSP + ':')
g_TMprocessors.append(' print "\\n"+chr(27)+"[32m" + "Received Telemetry: ' + CleanSP + '" + chr(27) + "[0m\\n"')
g_TMprocessors.append(' backup = self._pMem')
for param in subProgram._params:
......@@ -180,11 +180,11 @@ def OnStartup(modelingLanguage, asnFile, subProgram, unused_subProgramImplementa
for param in subProgram._params:
CleanParam = CleanName(param._id)
nodeTypename = param._signal._asnNodename
parms.append("var_"+CleanName(nodeTypename))
parms.append("var_" + CleanName(nodeTypename))
decl += ",".join(parms)
decl += "):"
g_bodyPython.append(decl)
g_bodyPython.append(" if -1 == SendTC_%s(%s):" % (CleanSP, ",".join([x+"._ptr" for x in parms])))
g_bodyPython.append(" if -1 == SendTC_%s(%s):" % (CleanSP, ",".join([x + "._ptr" for x in parms])))
g_bodyPython.append(" print 'Failed to send TC: %s...\\n'" % CleanSP)
g_bodyPython.append(" raise IOError(\"%s\")" % CleanSP)
......
......@@ -108,7 +108,7 @@ class FromQGenCToASN1SCC(RecursiveMapper):
childNo += 1
lines.append("%sif (%s.choiceIdx == %d) {\n" % (self.maybeElse(childNo), srcQGenC, childNo))
lines.extend(
[' '+x
[' ' + x
for x in self.Map(
"%s.%s" % (srcQGenC, self.CleanName(child[0])),
destVar + ".u." + self.CleanName(child[0]),
......@@ -160,7 +160,7 @@ class FromASN1SCCtoQGenC(RecursiveMapper):
limit = sourceSequenceLimit(node, srcVar)
for i in range(0, node._range[-1]):
lines.append("if (%s>=%d) %s.element_data[%d] = %s.arr[%d]; else %s.element_data[%d] = 0;\n" %
(limit, i+1, dstQGenC, i, srcVar, i, dstQGenC, i))
(limit, i + 1, dstQGenC, i, srcVar, i, dstQGenC, i))
if len(node._range) > 1 and node._range[0] != node._range[1]:
lines.append("%s.length = %s;\n" % (dstQGenC, limit))
return lines
......@@ -192,7 +192,7 @@ class FromASN1SCCtoQGenC(RecursiveMapper):
childNo += 1
lines.append("%sif (%s.kind == %s) {\n" % (self.maybeElse(childNo), srcVar, self.CleanName(child[2])))
lines.extend(
[' '+x
[' ' + x
for x in self.Map(
srcVar + ".u." + self.CleanName(child[0]),
"%s.%s" % (dstQGenC, self.CleanName(child[0])),
......@@ -270,7 +270,7 @@ class FromQGenCToOSS(RecursiveMapper):
childNo += 1
lines.append("%sif (%s.choiceIdx == %d) {\n" % (self.maybeElse(childNo), srcQGenC, childNo))
lines.extend(
[' '+x
[' ' + x
for x in self.Map(
"%s.%s" % (srcQGenC, self.CleanName(child[0])),
destVar + ".u." + self.CleanName(child[0]),
......@@ -319,7 +319,7 @@ class FromOSStoQGenC(RecursiveMapper):
lines = []
for i in range(0, node._range[-1]):
lines.append("if (%s.length >= %d) %s.element_data[%d] = %s.value[%d]; else %s.element_data[%d] = 0;\n" %
(srcVar, i+1, dstQGenC, i, srcVar, i, dstQGenC, i))
(srcVar, i + 1, dstQGenC, i, srcVar, i, dstQGenC, i))
if len(node._range) > 1 and node._range[0] != node._range[1]:
lines.append("%s.length = %s.length;" % (dstQGenC, srcVar))
return lines
......@@ -351,7 +351,7 @@ class FromOSStoQGenC(RecursiveMapper):
childNo += 1
lines.append("%sif (%s.choice == OSS_%s_chosen) {\n" % (self.maybeElse(childNo), srcVar, self.CleanName(child[0])))
lines.extend(
[' '+x
[' ' + x
for x in self.Map(
srcVar + ".u." + self.CleanName(child[0]),
"%s.%s" % (dstQGenC, self.CleanName(child[0])),
......
......@@ -104,7 +104,7 @@ class FromRTDSToASN1SCC(RecursiveMapper):
childNo += 1
lines.append("%sif (%s.present == %d) {\n" % (self.maybeElse(childNo), srcSDLVariable, childNo))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
"%s.__value.%s" % (srcSDLVariable, self.CleanName(child[0])),
destVar + (".u.%s" % self.CleanName(child[0])),
......@@ -122,7 +122,7 @@ class FromRTDSToASN1SCC(RecursiveMapper):
lines.append(" int i%s;\n" % uniqueId)
lines.append(" for(i%s=0; i%s<%s.length; i%s++) {\n" % (uniqueId, uniqueId, srcSDLVariable, uniqueId))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
"%s.elements[i%s]" % (srcSDLVariable, uniqueId),
"%s.arr[i%s]" % (destVar, uniqueId),
......@@ -207,7 +207,7 @@ class FromRTDSToOSS(RecursiveMapper):
childNo += 1
lines.append("%sif (%s.present == %d) {\n" % (self.maybeElse(childNo), srcSDLVariable, childNo))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
"%s.u.u%d.%s" % (srcSDLVariable, childNo, self.CleanName(child[0])),
destVar + (".u.%s" % self.CleanName(child[0])),
......@@ -225,7 +225,7 @@ class FromRTDSToOSS(RecursiveMapper):
lines.append(" int i%s;\n" % uniqueId)
lines.append(" for(i%s=0; i%s<%s.length; i%s++) {\n" % (uniqueId, uniqueId, srcSDLVariable, uniqueId))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
"%s.cont[i%s]" % (srcSDLVariable, uniqueId),
"%s.value[i%s]" % (destVar, uniqueId),
......@@ -306,7 +306,7 @@ class FromASN1SCCtoRTDS(RecursiveMapper):
lines.append("%sif (%s.kind == %s) {\n" %
(self.maybeElse(childNo), srcVar, self.CleanName(child[2])))
lines.extend(
[' '+x
[' ' + x
for x in self.Map(
srcVar + ".u." + self.CleanName(child[0]),
"%s.__value.%s" % (dstSDLVariable, self.CleanName(child[0])),
......@@ -326,7 +326,7 @@ class FromASN1SCCtoRTDS(RecursiveMapper):
lines.append(" %s.length = %s;\n" % (dstSDLVariable, limit))
lines.append(" for(i%s=0; i%s<%s; i%s++) {\n" % (uniqueId, uniqueId, limit, uniqueId))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
srcVar + ".arr[i%s]" % uniqueId,
"%s.elements[i%s]" % (dstSDLVariable, uniqueId),
......@@ -422,7 +422,7 @@ class FromOSStoRTDS(RecursiveMapper):
lines.append("%sif (%s.choice == OSS_%s_chosen) {\n" %
(self.maybeElse(childNo), srcVar, self.CleanName(child[0])))
lines.extend(
[' '+x
[' ' + x
for x in self.Map(
srcVar + ".u." + self.CleanName(child[0]),
"%s.u.u%d.%s" % (dstSDLVariable, childNo, self.CleanName(child[0])),
......@@ -441,7 +441,7 @@ class FromOSStoRTDS(RecursiveMapper):
lines.append(" %s.length = %s.count;\n" % (dstSDLVariable, srcVar))
lines.append(" for(i%s=0; i%s<%s.count; i%s++) {\n" % (uniqueId, uniqueId, srcVar, uniqueId))
lines.extend(
[" "+x
[" " + x
for x in self.Map(
srcVar + ".value[i%s]" % uniqueId,
"%s.cont[i%s]" % (dstSDLVariable, uniqueId),
......@@ -506,7 +506,7 @@ class RTDS_GlueGenerator(ASynchronousToolGlueGenerator):
leafTypeDict,
names)
lines = [" "+x.rstrip() for x in lines]
lines = [" " + x.rstrip() for x in lines]
fileOutSource.write("\n".join(lines))
fileOutSource.write("\n}\n\n")
......@@ -539,7 +539,7 @@ class RTDS_GlueGenerator(ASynchronousToolGlueGenerator):
leafTypeDict,
names)
lines = [" "+x.rstrip() for x in lines]