--- a/Beremiz.py Mon Aug 14 21:31:01 2017 +0300
+++ b/Beremiz.py Mon Aug 14 22:23:17 2017 +0300
@@ -62,7 +62,7 @@
def Usage(self):
print "Usage:"
- print "%s [Options] [Projectpath] [Buildpath]"%sys.argv[0]
+ print "%s [Options] [Projectpath] [Buildpath]" % sys.argv[0]
print ""
print "Supported options:"
print "-h --help Print this help"
--- a/BeremizIDE.py Mon Aug 14 21:31:01 2017 +0300
+++ b/BeremizIDE.py Mon Aug 14 22:23:17 2017 +0300
@@ -479,7 +479,7 @@
self.runtime_port = int(random.random() * 1000) + 61131
# launch local runtime
self.local_runtime = ProcessLogger(self.Log,
- "\"%s\" \"%s\" -p %s -i localhost %s %s"%(
+ "\"%s\" \"%s\" -p %s -i localhost %s %s" % (
sys.executable,
Bpath("Beremiz_service.py"),
self.runtime_port,
--- a/Beremiz_service.py Mon Aug 14 21:31:01 2017 +0300
+++ b/Beremiz_service.py Mon Aug 14 22:23:17 2017 +0300
@@ -44,7 +44,7 @@
-e - python extension (absolute path .py)
working_dir - directory where are stored PLC files
-"""%sys.argv[0]
+""" % sys.argv[0]
try:
opts, argv = getopt.getopt(sys.argv[1:], "i:p:n:x:t:a:w:c:e:h")
@@ -212,7 +212,7 @@
texts = {"value" : value}
for function, message in self.Tests:
if not function(value):
- message = wx.MessageDialog(self, message%texts, _("Error"), wx.OK|wx.ICON_ERROR)
+ message = wx.MessageDialog(self, message % texts, _("Error"), wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
return
--- a/ConfigTreeNode.py Mon Aug 14 21:31:01 2017 +0300
+++ b/ConfigTreeNode.py Mon Aug 14 22:23:17 2017 +0300
@@ -215,7 +215,7 @@
# Call the confnode specific OnCTNSave method
result = self.OnCTNSave(from_project_path)
if not result:
- return _("Error while saving \"%s\"\n")%self.CTNPath()
+ return _("Error while saving \"%s\"\n") % self.CTNPath()
# mark confnode as saved
self.ChangesToSave = False
@@ -409,7 +409,7 @@
BaseDesiredName = DesiredName
suffix = 1
while res in AllNames:
- res = "%s_%d"%(BaseDesiredName, suffix)
+ res = "%s_%d" % (BaseDesiredName, suffix)
suffix += 1
# Get old path
@@ -453,7 +453,7 @@
if res < CurrentChannel: # Want to go down ?
res -= 1 # Test for n-1
if res < 0 :
- self.GetCTRoot().logger.write_warning(_("Cannot find lower free IEC channel than %d\n")%CurrentChannel)
+ self.GetCTRoot().logger.write_warning(_("Cannot find lower free IEC channel than %d\n") % CurrentChannel)
return CurrentChannel # Can't go bellow 0, do nothing
else : # Want to go up ?
res += 1 # Test for n-1
--- a/IDEFrame.py Mon Aug 14 21:31:01 2017 +0300
+++ b/IDEFrame.py Mon Aug 14 22:23:17 2017 +0300
@@ -1593,9 +1593,9 @@
new_name = event.GetLabel()
if new_name != "":
if not TestIdentifier(new_name):
- message = _("\"%s\" is not a valid identifier!")%new_name
+ message = _("\"%s\" is not a valid identifier!") % new_name
elif new_name.upper() in IEC_KEYWORDS:
- message = _("\"%s\" is a keyword. It can't be used!")%new_name
+ message = _("\"%s\" is a keyword. It can't be used!") % new_name
else:
item = event.GetItem()
old_name = self.ProjectTree.GetItemText(item)
@@ -1604,7 +1604,7 @@
self.Controler.SetProjectProperties(name = new_name)
elif item_infos["type"] == ITEM_DATATYPE:
if new_name.upper() in [name.upper() for name in self.Controler.GetProjectDataTypeNames() if name != old_name]:
- message = _("\"%s\" data type already exists!")%new_name
+ message = _("\"%s\" data type already exists!") % new_name
abort = True
if not abort:
self.Controler.ChangeDataTypeName(old_name, new_name)
@@ -1613,10 +1613,10 @@
self.RefreshPageTitles()
elif item_infos["type"] == ITEM_POU:
if new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames() if name != old_name]:
- message = _("\"%s\" pou already exists!")%new_name
+ message = _("\"%s\" pou already exists!") % new_name
abort = True
elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouVariableNames()]:
- messageDialog = wx.MessageDialog(self, _("A POU has an element named \"%s\". This could cause a conflict. Do you wish to continue?")%new_name, _("Error"), wx.YES_NO|wx.ICON_QUESTION)
+ messageDialog = wx.MessageDialog(self, _("A POU has an element named \"%s\". This could cause a conflict. Do you wish to continue?") % new_name, _("Error"), wx.YES_NO|wx.ICON_QUESTION)
if messageDialog.ShowModal() == wx.ID_NO:
abort = True
messageDialog.Destroy()
@@ -1630,9 +1630,9 @@
pou_item = self.ProjectTree.GetItemParent(event.GetItem())
pou_name = self.ProjectTree.GetItemText(pou_item)
if new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames()]:
- message = _("A POU named \"%s\" already exists!")%new_name
+ message = _("A POU named \"%s\" already exists!") % new_name
elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouVariableNames(pou_name) if name != old_name]:
- message = _("A variable with \"%s\" as name already exists in this pou!")%new_name
+ message = _("A variable with \"%s\" as name already exists in this pou!") % new_name
else:
words = item_infos["tagname"].split("::")
self.Controler.ChangePouTransitionName(words[1], old_name, new_name)
@@ -1643,9 +1643,9 @@
pou_item = self.ProjectTree.GetItemParent(event.GetItem())
pou_name = self.ProjectTree.GetItemText(pou_item)
if new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames()]:
- message = _("A POU named \"%s\" already exists!")%new_name
+ message = _("A POU named \"%s\" already exists!") % new_name
elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouVariableNames(pou_name) if name != old_name]:
- message = _("A variable with \"%s\" as name already exists in this pou!")%new_name
+ message = _("A variable with \"%s\" as name already exists in this pou!") % new_name
else:
words = item_infos["tagname"].split("::")
self.Controler.ChangePouActionName(words[1], old_name, new_name)
@@ -1654,15 +1654,15 @@
self.RefreshPageTitles()
elif item_infos["type"] == ITEM_CONFIGURATION:
if new_name.upper() in [name.upper() for name in self.Controler.GetProjectConfigNames() if name != old_name]:
- message = _("\"%s\" config already exists!")%new_name
+ message = _("\"%s\" config already exists!") % new_name
abort = True
elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames()]:
- messageDialog = wx.MessageDialog(self, _("There is a POU named \"%s\". This could cause a conflict. Do you wish to continue?")%new_name, _("Error"), wx.YES_NO|wx.ICON_QUESTION)
+ messageDialog = wx.MessageDialog(self, _("There is a POU named \"%s\". This could cause a conflict. Do you wish to continue?") % new_name, _("Error"), wx.YES_NO|wx.ICON_QUESTION)
if messageDialog.ShowModal() == wx.ID_NO:
abort = True
messageDialog.Destroy()
elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouVariableNames()]:
- messageDialog = wx.MessageDialog(self, _("A POU has an element named \"%s\". This could cause a conflict. Do you wish to continue?")%new_name, _("Error"), wx.YES_NO|wx.ICON_QUESTION)
+ messageDialog = wx.MessageDialog(self, _("A POU has an element named \"%s\". This could cause a conflict. Do you wish to continue?") % new_name, _("Error"), wx.YES_NO|wx.ICON_QUESTION)
if messageDialog.ShowModal() == wx.ID_NO:
abort = True
messageDialog.Destroy()
@@ -1673,15 +1673,15 @@
self.RefreshPageTitles()
elif item_infos["type"] == ITEM_RESOURCE:
if new_name.upper() in [name.upper() for name in self.Controler.GetProjectConfigNames()]:
- message = _("\"%s\" config already exists!")%new_name
+ message = _("\"%s\" config already exists!") % new_name
abort = True
elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames()]:
- messageDialog = wx.MessageDialog(self, _("There is a POU named \"%s\". This could cause a conflict. Do you wish to continue?")%new_name, _("Error"), wx.YES_NO|wx.ICON_QUESTION)
+ messageDialog = wx.MessageDialog(self, _("There is a POU named \"%s\". This could cause a conflict. Do you wish to continue?") % new_name, _("Error"), wx.YES_NO|wx.ICON_QUESTION)
if messageDialog.ShowModal() == wx.ID_NO:
abort = True
messageDialog.Destroy()
elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouVariableNames()]:
- messageDialog = wx.MessageDialog(self, _("A POU has an element named \"%s\". This could cause a conflict. Do you wish to continue?")%new_name, _("Error"), wx.YES_NO|wx.ICON_QUESTION)
+ messageDialog = wx.MessageDialog(self, _("A POU has an element named \"%s\". This could cause a conflict. Do you wish to continue?") % new_name, _("Error"), wx.YES_NO|wx.ICON_QUESTION)
if messageDialog.ShowModal() == wx.ID_NO:
abort = True
messageDialog.Destroy()
--- a/PLCControler.py Mon Aug 14 21:31:01 2017 +0300
+++ b/PLCControler.py Mon Aug 14 22:23:17 2017 +0300
@@ -629,7 +629,7 @@
if self.ProjectIsSaved():
return self.FileName
else:
- return "~%s~"%self.FileName
+ return "~%s~" % self.FileName
return ""
# Change file path and save file name or create a default one if file path not defined
@@ -637,7 +637,7 @@
self.FilePath = filepath
if filepath == "":
self.LastNewIndex += 1
- self.FileName = _("Unnamed%d")%self.LastNewIndex
+ self.FileName = _("Unnamed%d") % self.LastNewIndex
else:
self.FileName = os.path.splitext(os.path.basename(filepath))[0]
@@ -2304,7 +2304,7 @@
i = start_idx
while name is None or names.get(name.upper(), False):
- name = (format%i)
+ name = (format % i)
i += 1
return name
@@ -2342,10 +2342,10 @@
blockname = instance.getinstanceName()
if blocktype_infos["type"] != "function" and blockname is not None:
if element_type == "function":
- return _("FunctionBlock \"%s\" can't be pasted in a Function!!!")%blocktype
+ return _("FunctionBlock \"%s\" can't be pasted in a Function!!!") % blocktype
blockname = self.GenerateNewName(tagname,
blockname,
- "%s%%d"%blocktype,
+ "%s%%d" % blocktype,
debug=debug)
exclude[blockname] = True
instance.setinstanceName(blockname)
--- a/PLCGenerator.py Mon Aug 14 21:31:01 2017 +0300
+++ b/PLCGenerator.py Mon Aug 14 22:23:17 2017 +0300
@@ -62,7 +62,7 @@
indent += " "
for line in lines:
if line != "":
- compute += "%s%s\n"%(indent, line)
+ compute += "%s%s\n" % (indent, line)
else:
compute += "\n"
return compute
@@ -114,9 +114,9 @@
def ComputeValue(self, value, var_type):
base_type = self.Controler.GetBaseType(var_type)
if base_type == "STRING" and not value.startswith("'") and not value.endswith("'"):
- return "'%s'"%value
+ return "'%s'" % value
elif base_type == "WSTRING" and not value.startswith('"') and not value.endswith('"'):
- return "\"%s\""%value
+ return "\"%s\"" % value
return value
# Generate a data type from its name
@@ -154,9 +154,9 @@
max_value = basetype_content.range.getupper()
datatype_def += [(basetype_name, (tagname, "base")),
(" (", ()),
- ("%s"%min_value, (tagname, "lower")),
+ ("%s" % min_value, (tagname, "lower")),
("..", ()),
- ("%s"%max_value, (tagname, "upper")),
+ ("%s" % max_value, (tagname, "upper")),
(")",())]
# Data type is an enumerated type
elif basetype_content_type == "enum":
@@ -178,9 +178,9 @@
# Array derived directly from an elementary type
else:
basetype_name = base_type_type.upper()
- dimensions = [[("%s"%dimension.getlower(), (tagname, "range", i, "lower")),
+ dimensions = [[("%s" % dimension.getlower(), (tagname, "range", i, "lower")),
("..", ()),
- ("%s"%dimension.getupper(), (tagname, "range", i, "upper"))]
+ ("%s" % dimension.getupper(), (tagname, "range", i, "upper"))]
for i, dimension in enumerate(basetype_content.getdimension())]
datatype_def += [("ARRAY [", ())]
datatype_def += JoinList([(",", ())], dimensions)
@@ -251,12 +251,12 @@
program = pou_program.GenerateProgram(pou)
self.Program += program
else:
- raise PLCGenException, _("Undefined pou type \"%s\"")%pou_type
+ raise PLCGenException, _("Undefined pou type \"%s\"") % pou_type
# Generate a POU defined and used in text
def GeneratePouProgramInText(self, text):
for pou_name in self.PouComputed.keys():
- model = re.compile("(?:^|[^0-9^A-Z])%s(?:$|[^0-9^A-Z])"%pou_name.upper())
+ model = re.compile("(?:^|[^0-9^A-Z])%s(?:$|[^0-9^A-Z])" % pou_name.upper())
if model.search(text) is not None:
self.GeneratePouProgram(pou_name)
@@ -423,7 +423,7 @@
## resrce += [(",", ())]
# Priority argument
resrce += [("PRIORITY := ", ()),
- ("%d"%task.getpriority(), (tagname, "task", task_number, "priority")),
+ ("%d" % task.getpriority(), (tagname, "task", task_number, "priority")),
(");\n", ())]
task_number += 1
instance_number = 0
@@ -826,7 +826,7 @@
if block_infos is not None:
self.ComputeBlockInputTypes(instance, block_infos, body)
else:
- raise PLCGenException, _("No informations found for \"%s\" block")%(instance.gettypeName())
+ raise PLCGenException, _("No informations found for \"%s\" block") % (instance.gettypeName())
if body_type == "SFC":
previous_tagname = self.TagName
for action in pou.getactionList():
@@ -1075,9 +1075,9 @@
parameter = variable.getformalParameter()
if not inout_variables.has_key(parameter) and parameter in output_names + ["", "ENO"]:
if variable.getformalParameter() == "":
- variable_name = "%s%d"%(type, block.getlocalId())
+ variable_name = "%s%d" % (type, block.getlocalId())
else:
- variable_name = "%s%d_%s"%(type, block.getlocalId(), parameter)
+ variable_name = "%s%d_%s" % (type, block.getlocalId(), parameter)
if self.Interface[-1][0] != "VAR" or self.Interface[-1][1] is not None or self.Interface[-1][2]:
self.Interface.append(("VAR", None, False, []))
if variable.connectionPointOut in self.ConnectionTypes:
@@ -1086,7 +1086,7 @@
self.Interface[-1][3].append(("ANY", variable_name, None, None))
if len(output_variables) > 1 and parameter not in ["", "OUT"]:
vars.append([(parameter, (self.TagName, "block", block.getlocalId(), "output", i)),
- (" => %s"%variable_name, ())])
+ (" => %s" % variable_name, ())])
else:
output_info = (self.TagName, "block", block.getlocalId(), "output", i)
output_name = variable_name
@@ -1159,17 +1159,17 @@
output_value = inout_variables[output_parameter]
else:
if output_parameter == "":
- output_name = "%s%d"%(type, block.getlocalId())
+ output_name = "%s%d" % (type, block.getlocalId())
else:
- output_name = "%s%d_%s"%(type, block.getlocalId(), output_parameter)
+ output_name = "%s%d_%s" % (type, block.getlocalId(), output_parameter)
output_value = [(output_name, output_info)]
return self.ExtractModifier(output_variable, output_value, output_info)
if block_infos["type"] == "functionBlock":
output_info = (self.TagName, "block", block.getlocalId(), "output", output_idx)
- output_name = self.ExtractModifier(output_variable, [("%s.%s"%(name, output_parameter), output_info)], output_info)
+ output_name = self.ExtractModifier(output_variable, [("%s.%s" % (name, output_parameter), output_info)], output_info)
if to_inout:
- variable_name = "%s_%s"%(name, output_parameter)
+ variable_name = "%s_%s" % (name, output_parameter)
if not self.IsAlreadyDefined(variable_name):
if self.Interface[-1][0] != "VAR" or self.Interface[-1][1] is not None or self.Interface[-1][2]:
self.Interface.append(("VAR", None, False, []))
@@ -1179,7 +1179,7 @@
else:
self.Interface[-1][3].append(("ANY", variable_name, None, None))
self.Program += [(self.CurrentIndent, ()),
- ("%s := "%variable_name, ())]
+ ("%s := " % variable_name, ())]
self.Program += output_name
self.Program += [(";\n", ())]
return [(variable_name, ())]
@@ -1315,15 +1315,15 @@
if self.Interface[-1][0] != "VAR" or self.Interface[-1][1] is not None or self.Interface[-1][2]:
self.Interface.append(("VAR", None, False, []))
i = 1
- name = "%s%d"%(edge, i)
+ name = "%s%d" % (edge, i)
while self.IsAlreadyDefined(name):
i += 1
- name = "%s%d"%(edge, i)
+ name = "%s%d" % (edge, i)
self.Interface[-1][3].append((edge, name, None, None))
self.Program += [(self.CurrentIndent, ()), (name, var_info), ("(CLK := ", ())]
self.Program += expression
self.Program += [(");\n", ())]
- return [("%s.Q"%name, var_info)]
+ return [("%s.Q" % name, var_info)]
def ExtractDivergenceInput(self, divergence, pou):
connectionPointIn = divergence.getconnectionPointIn()
@@ -1441,7 +1441,7 @@
if action["type"] == "reference":
self.GenerateSFCAction(action["value"], pou)
else:
- action_name = "%s_INLINE%d"%(step_name.upper(), self.GetActionNumber())
+ action_name = "%s_INLINE%d" % (step_name.upper(), self.GetActionNumber())
self.SFCNetworks["Actions"][action_name] = ([(self.CurrentIndent, ()),
(action["value"], (self.TagName, "action_block", action_infos["id"], "action", i, "inline")),
("\n", ())], ())
@@ -1488,7 +1488,7 @@
self.SFCNetworks["Transitions"][transition] = transition_infos
transitionValues = transition.getconditionContent()
if transitionValues["type"] == "inline":
- transition_infos["content"] = [("\n%s:= "%self.CurrentIndent, ()),
+ transition_infos["content"] = [("\n%s:= " % self.CurrentIndent, ()),
(transitionValues["value"], (self.TagName, "transition", transition.getlocalId(), "inline")),
(";\n", ())]
elif transitionValues["type"] == "reference":
@@ -1511,7 +1511,7 @@
if connections is not None:
expression = self.ComputeExpression(transitionBody, connections)
if expression is not None:
- transition_infos["content"] = [("\n%s:= "%self.CurrentIndent, ())] + expression + [(";\n", ())]
+ transition_infos["content"] = [("\n%s:= " % self.CurrentIndent, ())] + expression + [(";\n", ())]
self.SFCComputedBlocks += self.Program
self.Program = []
if not transition_infos.has_key("content"):
@@ -1525,7 +1525,7 @@
if connections is not None:
expression = self.ComputeExpression(body, connections)
if expression is not None:
- transition_infos["content"] = [("\n%s:= "%self.CurrentIndent, ())] + expression + [(";\n", ())]
+ transition_infos["content"] = [("\n%s:= " % self.CurrentIndent, ())] + expression + [(";\n", ())]
self.SFCComputedBlocks += self.Program
self.Program = []
for step in steps:
@@ -1564,7 +1564,7 @@
(action_infos["indicator"], action_info + ("indicator",))]
self.Program += [(");\n", ())]
self.IndentLeft()
- self.Program += [("%sEND_STEP\n\n"%self.CurrentIndent, ())]
+ self.Program += [("%sEND_STEP\n\n" % self.CurrentIndent, ())]
for action in actions:
self.ComputeSFCAction(action)
for transition in step_infos["transitions"]:
@@ -1573,19 +1573,19 @@
def ComputeSFCAction(self, action_name):
if action_name in self.SFCNetworks["Actions"].keys():
action_content, action_info = self.SFCNetworks["Actions"].pop(action_name)
- self.Program += [("%sACTION "%self.CurrentIndent, ()),
+ self.Program += [("%sACTION " % self.CurrentIndent, ()),
(action_name, action_info),
(":\n", ())]
self.Program += action_content
- self.Program += [("%sEND_ACTION\n\n"%self.CurrentIndent, ())]
+ self.Program += [("%sEND_ACTION\n\n" % self.CurrentIndent, ())]
def ComputeSFCTransition(self, transition):
if transition in self.SFCNetworks["Transitions"].keys():
transition_infos = self.SFCNetworks["Transitions"].pop(transition)
- self.Program += [("%sTRANSITION"%self.CurrentIndent, ())]
+ self.Program += [("%sTRANSITION" % self.CurrentIndent, ())]
if transition_infos["priority"] != None:
self.Program += [(" (PRIORITY := ", ()),
- ("%d"%transition_infos["priority"], (self.TagName, "transition", transition_infos["id"], "priority")),
+ ("%d" % transition_infos["priority"], (self.TagName, "transition", transition_infos["id"], "priority")),
(")", ())]
self.Program += [(" FROM ", ())]
if len(transition_infos["from"]) > 1:
@@ -1610,7 +1610,7 @@
format(a1 = transition_infos["content"], a2 = self.Name)
raise PLCGenException, msg
self.Program += transition_infos["content"]
- self.Program += [("%sEND_TRANSITION\n\n"%self.CurrentIndent, ())]
+ self.Program += [("%sEND_TRANSITION\n\n" % self.CurrentIndent, ())]
for [(step_name, step_infos)] in transition_infos["to"]:
self.ComputeSFCStep(step_name)
@@ -1619,22 +1619,22 @@
self.ComputeConnectionTypes(pou)
self.ComputeProgram(pou)
- program = [("%s "%self.Type, ()),
+ program = [("%s " % self.Type, ()),
(self.Name, (self.TagName, "name"))]
if self.ReturnType is not None:
program += [(" : ", ()),
(self.ReturnType, (self.TagName, "return"))]
program += [("\n", ())]
if len(self.Interface) == 0:
- raise PLCGenException, _("No variable defined in \"%s\" POU")%self.Name
+ raise PLCGenException, _("No variable defined in \"%s\" POU") % self.Name
if len(self.Program) == 0 :
- raise PLCGenException, _("No body defined in \"%s\" POU")%self.Name
+ raise PLCGenException, _("No body defined in \"%s\" POU") % self.Name
var_number = 0
for list_type, option, located, variables in self.Interface:
variable_type = errorVarTypes.get(list_type, "var_local")
- program += [(" %s"%list_type, ())]
+ program += [(" %s" % list_type, ())]
if option is not None:
- program += [(" %s"%option, (self.TagName, variable_type, (var_number, var_number + len(variables)), option.lower()))]
+ program += [(" %s" % option, (self.TagName, variable_type, (var_number, var_number + len(variables)), option.lower()))]
program += [("\n", ())]
for var_type, var_name, var_address, var_initial in variables:
program += [(" ", ())]
@@ -1655,7 +1655,7 @@
program += [(" END_VAR\n", ())]
program += [("\n", ())]
program += self.Program
- program += [("END_%s\n\n"%self.Type, ())]
+ program += [("END_%s\n\n" % self.Type, ())]
return program
def GenerateCurrentProgram(controler, project, errors, warnings):
--- a/PLCOpenEditor.py Mon Aug 14 21:31:01 2017 +0300
+++ b/PLCOpenEditor.py Mon Aug 14 22:23:17 2017 +0300
@@ -42,7 +42,7 @@
# command line
def usage():
print "\nUsage of PLCOpenEditor.py :"
- print "\n %s [Filepath]\n"%sys.argv[0]
+ print "\n %s [Filepath]\n" % sys.argv[0]
# Parse options given to PLCOpenEditor in command line
try:
@@ -223,7 +223,7 @@
def RefreshTitle(self):
name = _("PLCOpenEditor")
if self.Controler is not None:
- self.SetTitle("%s - %s"%(name, self.Controler.GetFilename()))
+ self.SetTitle("%s - %s" % (name, self.Controler.GetFilename()))
else:
self.SetTitle(name)
@@ -346,12 +346,12 @@
message_text += "".join([_("warning: %s\n") % warning for warning in warnings])
if len(errors) > 0:
message_text += "".join([_("error: %s\n") % error for error in errors])
- message_text += _("Can't generate program to file %s!")%filepath
+ message_text += _("Can't generate program to file %s!") % filepath
header, icon = _("Error"), wx.ICON_ERROR
else:
message_text += _("Program was successfully generated!")
else:
- message_text += _("\"%s\" is not a valid folder!")%os.path.dirname(filepath)
+ message_text += _("\"%s\" is not a valid folder!") % os.path.dirname(filepath)
header, icon = _("Error"), wx.ICON_ERROR
message = wx.MessageDialog(self, message_text, header, wx.OK|icon)
message.ShowModal()
@@ -384,16 +384,16 @@
if filepath != "":
directory, filename = os.path.split(filepath)
else:
- directory, filename = os.getcwd(), "%(projectName)s.xml"%self.Controler.GetProjectProperties()
+ directory, filename = os.getcwd(), "%(projectName)s.xml" % self.Controler.GetProjectProperties()
dialog = wx.FileDialog(self, _("Choose a file"), directory, filename, _("PLCOpen files (*.xml)|*.xml|All files|*.*"), wx.SAVE|wx.OVERWRITE_PROMPT)
if dialog.ShowModal() == wx.ID_OK:
filepath = dialog.GetPath()
if os.path.isdir(os.path.dirname(filepath)):
result = self.Controler.SaveXMLFile(filepath)
if not result:
- self.ShowErrorMessage(_("Can't save project to file %s!")%filepath)
+ self.ShowErrorMessage(_("Can't save project to file %s!") % filepath)
else:
- self.ShowErrorMessage(_("\"%s\" is not a valid folder!")%os.path.dirname(filepath))
+ self.ShowErrorMessage(_("\"%s\" is not a valid folder!") % os.path.dirname(filepath))
self._Refresh(TITLE, FILEMENU, PAGETITLES)
dialog.Destroy()
--- a/ProjectController.py Mon Aug 14 21:31:01 2017 +0300
+++ b/ProjectController.py Mon Aug 14 22:23:17 2017 +0300
@@ -134,7 +134,7 @@
return path
def findSupportedOptions(self):
- buildcmd = "\"%s\" -h"%(self.getCmd())
+ buildcmd = "\"%s\" -h" % (self.getCmd())
options =["-f", "-l", "-p"]
buildopt = ""
@@ -566,7 +566,7 @@
if len(self.Libraries)==0:
return [],[],()
self.GetIECProgramsAndVariables()
- LibIECCflags = '"-I%s" -Wno-unused-function'%os.path.abspath(self.GetIECLibPath())
+ LibIECCflags = '"-I%s" -Wno-unused-function' % os.path.abspath(self.GetIECLibPath())
LocatedCCodeAndFlags=[]
Extras=[]
for lib in self.Libraries:
@@ -709,10 +709,10 @@
if len(warnings) > 0:
self.logger.write_warning(_("Warnings in ST/IL/SFC code generator :\n"))
for warning in warnings:
- self.logger.write_warning("%s\n"%warning)
+ self.logger.write_warning("%s\n" % warning)
if len(errors) > 0:
# Failed !
- self.logger.write_error(_("Error in ST/IL/SFC code generator :\n%s\n")%errors[0])
+ self.logger.write_error(_("Error in ST/IL/SFC code generator :\n%s\n") % errors[0])
return False
plc_file = open(self._getIECcodepath(), "w")
# Add ST Library from confnodes
@@ -736,7 +736,7 @@
def _Compile_ST_to_SoftPLC(self):
self.logger.write(_("Compiling IEC Program into C code...\n"))
buildpath = self._getBuildPath()
- buildcmd = "\"%s\" %s -I \"%s\" -T \"%s\" \"%s\""%(
+ buildcmd = "\"%s\" %s -I \"%s\" -T \"%s\" \"%s\"" % (
iec2c_cfg.getCmd(),
iec2c_cfg.getOptions(),
iec2c_cfg.getLibPath(),
@@ -781,7 +781,7 @@
f.close()
- self.logger.write_error(_("Error : IEC to C compiler returned %d\n")%status)
+ self.logger.write_error(_("Error : IEC to C compiler returned %d\n") % status)
return False
# Now extract C files of stdout
@@ -808,7 +808,7 @@
# Keep track of generated C files for later use by self.CTNGenerate_C
self.PLCGeneratedCFiles = C_files
# compute CFLAGS for plc
- self.plcCFLAGS = '"-I%s" -Wno-unused-function'%iec2c_cfg.getLibCPath()
+ self.plcCFLAGS = '"-I%s" -Wno-unused-function' % iec2c_cfg.getLibCPath()
return True
def GetBuilder(self):
@@ -962,25 +962,25 @@
for v in self._DbgVariablesList :
sz = DebugTypesSize.get(v["type"], 0)
variable_decl_array += [
- "{&(%(C_path)s), "%v+
+ "{&(%(C_path)s), " % v+
{"EXT":"%(type)s_P_ENUM",
"IN":"%(type)s_P_ENUM",
"MEM":"%(type)s_O_ENUM",
"OUT":"%(type)s_O_ENUM",
- "VAR":"%(type)s_ENUM"}[v["vartype"]]%v +
+ "VAR":"%(type)s_ENUM"}[v["vartype"]] % v +
"}"]
bofs += sz
debug_code = targets.GetCode("plc_debug.c") % {
"buffer_size":bofs,
"programs_declarations":
- "\n".join(["extern %(type)s %(C_path)s;"%p for p in self._ProgramList]),
+ "\n".join(["extern %(type)s %(C_path)s;" % p for p in self._ProgramList]),
"extern_variables_declarations":"\n".join([
{"EXT":"extern __IEC_%(type)s_p %(C_path)s;",
"IN":"extern __IEC_%(type)s_p %(C_path)s;",
"MEM":"extern __IEC_%(type)s_p %(C_path)s;",
"OUT":"extern __IEC_%(type)s_p %(C_path)s;",
"VAR":"extern __IEC_%(type)s_t %(C_path)s;",
- "FB":"extern %(type)s %(C_path)s;"}[v["vartype"]]%v
+ "FB":"extern %(type)s %(C_path)s;"}[v["vartype"]] % v
for v in self._VariablesList if v["C_path"].find('.')<0]),
"variable_decl_array": ",\n".join(variable_decl_array)
}
@@ -1004,19 +1004,19 @@
"int __init_%(s)s(int argc,char **argv);\n"+
"void __cleanup_%(s)s(void);\n"+
"void __retrieve_%(s)s(void);\n"+
- "void __publish_%(s)s(void);")%{'s':locstr} for locstr in locstrs]),
+ "void __publish_%(s)s(void);") % {'s':locstr} for locstr in locstrs]),
"retrieve_calls":"\n ".join([
- "__retrieve_%s();"%locstr for locstr in locstrs]),
+ "__retrieve_%s();" % locstr for locstr in locstrs]),
"publish_calls":"\n ".join([ #Call publish in reverse order
- "__publish_%s();"%locstrs[i-1] for i in xrange(len(locstrs), 0, -1)]),
+ "__publish_%s();" % locstrs[i-1] for i in xrange(len(locstrs), 0, -1)]),
"init_calls":"\n ".join([
- "init_level=%d; "%(i+1)+
- "if((res = __init_%s(argc,argv))){"%locstr +
+ "init_level=%d; " % (i+1)+
+ "if((res = __init_%s(argc,argv))){" % locstr +
#"printf(\"%s\"); "%locstr + #for debug
"return res;}" for i,locstr in enumerate(locstrs)]),
"cleanup_calls":"\n ".join([
- "if(init_level >= %d) "%i+
- "__cleanup_%s();"%locstrs[i-1] for i in xrange(len(locstrs), 0, -1)])
+ "if(init_level >= %d) " % i+
+ "__cleanup_%s();" % locstrs[i-1] for i in xrange(len(locstrs), 0, -1)])
}
else:
plc_main_code = targets.GetCode("plc_main_head.c") % {
@@ -1410,9 +1410,9 @@
if IEC_Type in DebugTypesSize:
Idxs.append((Idx, IEC_Type, fvalue, IECPath))
else:
- self.logger.write_warning(_("Debug: Unsupported type to debug '%s'\n")%IEC_Type)
+ self.logger.write_warning(_("Debug: Unsupported type to debug '%s'\n") % IEC_Type)
else:
- self.logger.write_warning(_("Debug: Unknown variable '%s'\n")%IECPath)
+ self.logger.write_warning(_("Debug: Unknown variable '%s'\n") % IECPath)
for IECPathToPop in IECPathsToPop:
self.IECdebug_datas.pop(IECPathToPop)
@@ -1728,13 +1728,13 @@
try:
self._SetConnector(connectors.ConnectorFactory(uri, self))
except Exception, msg:
- self.logger.write_error(_("Exception while connecting %s!\n")%uri)
+ self.logger.write_error(_("Exception while connecting %s!\n") % uri)
self.logger.write_error(traceback.format_exc())
# Did connection success ?
if self._connector is None:
# Oups.
- self.logger.write_error(_("Connection failed to %s!\n")%uri)
+ self.logger.write_error(_("Connection failed to %s!\n") % uri)
else:
self.ShowMethod("_Connect", False)
self.ShowMethod("_Disconnect", True)
--- a/c_ext/c_ext.py Mon Aug 14 21:31:01 2017 +0300
+++ b/c_ext/c_ext.py Mon Aug 14 22:23:17 2017 +0300
@@ -101,28 +101,28 @@
# Adding Beremiz confnode functions
text += "/* Beremiz confnode functions */\n"
- text += "int __init_%s(int argc,char **argv)\n{\n"%location_str
+ text += "int __init_%s(int argc,char **argv)\n{\n" % location_str
text += self.CodeFile.initFunction.getanyText().strip()
text += " return 0;\n}\n\n"
- text += "void __cleanup_%s(void)\n{\n"%location_str
+ text += "void __cleanup_%s(void)\n{\n" % location_str
text += self.CodeFile.cleanUpFunction.getanyText().strip()
text += "\n}\n\n"
- text += "void __retrieve_%s(void)\n{\n"%location_str
+ text += "void __retrieve_%s(void)\n{\n" % location_str
text += self.CodeFile.retrieveFunction.getanyText().strip()
text += "\n}\n\n"
- text += "void __publish_%s(void)\n{\n"%location_str
+ text += "void __publish_%s(void)\n{\n" % location_str
text += self.CodeFile.publishFunction.getanyText().strip()
text += "\n}\n\n"
- Gen_Cfile_path = os.path.join(buildpath, "CFile_%s.c"%location_str)
+ Gen_Cfile_path = os.path.join(buildpath, "CFile_%s.c" % location_str)
cfile = open(Gen_Cfile_path,'w')
cfile.write(text)
cfile.close()
- matiec_CFLAGS = '"-I%s"'%os.path.abspath(self.GetCTRoot().GetIECLibPath())
+ matiec_CFLAGS = '"-I%s"' % os.path.abspath(self.GetCTRoot().GetIECLibPath())
return [(Gen_Cfile_path, str(self.CExtension.getCFLAGS() + matiec_CFLAGS))],str(self.CExtension.getLDFLAGS()),True
--- a/canfestival/canfestival.py Mon Aug 14 21:31:01 2017 +0300
+++ b/canfestival/canfestival.py Mon Aug 14 22:23:17 2017 +0300
@@ -72,7 +72,7 @@
"size": size,
"IEC_type": IECTypeConversion.get(typeinfos["name"]),
"var_name": "%s_%4.4x_%2.2x" % ("_".join(name.split()), index, subindex),
- "location": "%s%s"%(SizeConversion[size], ".".join(map(str, current_location +
+ "location": "%s%s" % (SizeConversion[size], ".".join(map(str, current_location +
(index, subindex)))),
"description": "",
"children": []})
@@ -219,16 +219,16 @@
current_location = self.GetCurrentLocation()
# define a unique name for the generated C file
prefix = "_".join(map(str, current_location))
- Gen_OD_path = os.path.join(buildpath, "OD_%s.c"%prefix )
+ Gen_OD_path = os.path.join(buildpath, "OD_%s.c" % prefix )
# Create a new copy of the model
slave = self.GetCurrentNodeCopy()
- slave.SetNodeName("OD_%s"%prefix)
+ slave.SetNodeName("OD_%s" % prefix)
# allow access to local OD from Slave PLC
pointers = config_utils.LocalODPointers(locations, current_location, slave)
res = gen_cfile.GenerateFile(Gen_OD_path, slave, pointers)
if res :
raise Exception, res
- res = eds_utils.GenerateEDSFile(os.path.join(buildpath, "Slave_%s.eds"%prefix), slave)
+ res = eds_utils.GenerateEDSFile(os.path.join(buildpath, "Slave_%s.eds" % prefix), slave)
if res :
raise Exception, res
return [(Gen_OD_path,local_canfestival_config.getCFLAGS(CanFestivalPath))],"",False
@@ -433,10 +433,10 @@
current_location = self.GetCurrentLocation()
# define a unique name for the generated C file
prefix = "_".join(map(str, current_location))
- Gen_OD_path = os.path.join(buildpath, "OD_%s.c"%prefix )
+ Gen_OD_path = os.path.join(buildpath, "OD_%s.c" % prefix )
# Create a new copy of the model with DCF loaded with PDO mappings for desired location
try:
- master, pointers = config_utils.GenerateConciseDCF(locations, current_location, self, self.CanFestivalNode.getSync_TPDOs(),"OD_%s"%prefix)
+ master, pointers = config_utils.GenerateConciseDCF(locations, current_location, self, self.CanFestivalNode.getSync_TPDOs(),"OD_%s" % prefix)
except config_utils.PDOmappingException, e:
raise Exception, e.message
# Do generate C file.
@@ -527,68 +527,68 @@
# Not a slave -> master
child_data = getattr(child, "CanFestivalNode")
# Apply sync setting
- format_dict["nodes_init"] += 'NODE_MASTER_INIT(%s, %s)\n '%(
+ format_dict["nodes_init"] += 'NODE_MASTER_INIT(%s, %s)\n ' % (
nodename,
child_data.getNodeId())
if child_data.getSync_TPDOs():
- format_dict["nodes_send_sync"] += 'NODE_SEND_SYNC(%s)\n '%(nodename)
- format_dict["nodes_proceed_sync"] += 'NODE_PROCEED_SYNC(%s)\n '%(nodename)
+ format_dict["nodes_send_sync"] += 'NODE_SEND_SYNC(%s)\n ' % (nodename)
+ format_dict["nodes_proceed_sync"] += 'NODE_PROCEED_SYNC(%s)\n ' % (nodename)
# initialize and declare node boot status variables for post_SlaveBootup lookup
SlaveIDs = child.GetSlaveIDs()
if len(SlaveIDs) == 0:
# define post_SlaveBootup lookup functions
format_dict["slavebootups"] += (
- "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){}\n"%(nodename))
+ "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){}\n" % (nodename))
else:
format_dict["slavebootups"] += (
- "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){\n"%(nodename)+
+ "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){\n" % (nodename)+
" check_and_start_node(d, nodeId);\n"+
"}\n")
# register previously declared func as post_SlaveBootup callback for that node
format_dict["slavebootup_register"] += (
- "%s_Data.post_SlaveBootup = %s_post_SlaveBootup;\n"%(nodename,nodename))
+ "%s_Data.post_SlaveBootup = %s_post_SlaveBootup;\n" % (nodename,nodename))
format_dict["pre_op"] += (
- "static void %s_preOperational(CO_Data* d){\n "%(nodename)+
- "".join([" masterSendNMTstateChange(d, %d, NMT_Reset_Comunication);\n"%NdId for NdId in SlaveIDs])+
+ "static void %s_preOperational(CO_Data* d){\n " % (nodename)+
+ "".join([" masterSendNMTstateChange(d, %d, NMT_Reset_Comunication);\n" % NdId for NdId in SlaveIDs])+
"}\n")
format_dict["pre_op_register"] += (
- "%s_Data.preOperational = %s_preOperational;\n"%(nodename,nodename))
+ "%s_Data.preOperational = %s_preOperational;\n" % (nodename,nodename))
else:
# Slave node
align = child_data.getSync_Align()
align_ratio=child_data.getSync_Align_Ratio()
if align > 0:
format_dict["post_sync"] += (
- "static int %s_CalCount = 0;\n"%(nodename)+
- "static void %s_post_sync(CO_Data* d){\n"%(nodename)+
- " if(%s_CalCount < %d){\n"%(nodename, align)+
- " %s_CalCount++;\n"%(nodename)+
+ "static int %s_CalCount = 0;\n" % (nodename)+
+ "static void %s_post_sync(CO_Data* d){\n" % (nodename)+
+ " if(%s_CalCount < %d){\n" % (nodename, align)+
+ " %s_CalCount++;\n" % (nodename)+
" align_tick(-1);\n"+
" }else{\n"+
- " align_tick(%d);\n"%(align_ratio)+
+ " align_tick(%d);\n" % (align_ratio)+
" }\n"+
"}\n")
format_dict["post_sync_register"] += (
- "%s_Data.post_sync = %s_post_sync;\n"%(nodename,nodename))
- format_dict["nodes_init"] += 'NODE_SLAVE_INIT(%s, %s)\n '%(
+ "%s_Data.post_sync = %s_post_sync;\n" % (nodename,nodename))
+ format_dict["nodes_init"] += 'NODE_SLAVE_INIT(%s, %s)\n ' % (
nodename,
child_data.getNodeId())
# Include generated OD headers
- format_dict["nodes_includes"] += '#include "%s.h"\n'%(nodename)
+ format_dict["nodes_includes"] += '#include "%s.h"\n' % (nodename)
# Declare CAN channels according user filled config
- format_dict["board_decls"] += 'BOARD_DECL(%s, "%s", "%s")\n'%(
+ format_dict["board_decls"] += 'BOARD_DECL(%s, "%s", "%s")\n' % (
nodename,
child.GetCanDevice(),
child_data.getCAN_Baudrate())
- format_dict["nodes_open"] += 'NODE_OPEN(%s)\n '%(nodename)
- format_dict["nodes_close"] += 'NODE_CLOSE(%s)\n '%(nodename)
- format_dict["nodes_stop"] += 'NODE_STOP(%s)\n '%(nodename)
+ format_dict["nodes_open"] += 'NODE_OPEN(%s)\n ' % (nodename)
+ format_dict["nodes_close"] += 'NODE_CLOSE(%s)\n ' % (nodename)
+ format_dict["nodes_stop"] += 'NODE_STOP(%s)\n ' % (nodename)
filename = paths.AbsNeighbourFile(__file__,"cf_runtime.c")
cf_main = open(filename).read() % format_dict
- cf_main_path = os.path.join(buildpath, "CF_%(locstr)s.c"%format_dict)
+ cf_main_path = os.path.join(buildpath, "CF_%(locstr)s.c" % format_dict)
f = open(cf_main_path,'w')
f.write(cf_main)
f.close()
--- a/canfestival/config_utils.py Mon Aug 14 21:31:01 2017 +0300
+++ b/canfestival/config_utils.py Mon Aug 14 22:23:17 2017 +0300
@@ -254,7 +254,7 @@
if nodeDCF != None and nodeDCF != '':
tmpnbparams = [i for i in nodeDCF[:4]]
tmpnbparams.reverse()
- nbparams += int(''.join(["%2.2x"%ord(i) for i in tmpnbparams]), 16)
+ nbparams += int(''.join(["%2.2x" % ord(i) for i in tmpnbparams]), 16)
data = nodeDCF[4:] + data
# Build new DCF
@@ -546,7 +546,7 @@
variable_infos["nodeid"]
# Generate entry name
- indexname = "%s%s%s_%d"%(VariableDirText[variable_infos["pdotype"]],
+ indexname = "%s%s%s_%d" % (VariableDirText[variable_infos["pdotype"]],
variable_infos["sizelocation"],
'_'.join(map(str,current_location)),
variable_infos["nodeid"])
@@ -572,9 +572,9 @@
if mapvariableidx < VariableStartIndex[variable_infos["pdotype"]] + 0x2000:
# Generate subentry name
if variable_infos["bit"] != None:
- subindexname = "%(index)d_%(subindex)d_%(bit)d"%variable_infos
+ subindexname = "%(index)d_%(subindex)d_%(bit)d" % variable_infos
else:
- subindexname = "%(index)d_%(subindex)d"%variable_infos
+ subindexname = "%(index)d_%(subindex)d" % variable_infos
# If entry have just been created, no subentry have to be added
if not new_index:
self.Manager.AddSubentriesToCurrent(mapvariableidx, 1, self.MasterNode)
@@ -590,7 +590,7 @@
self.MasterNode.SetEntry(current_idx + 0x200, subindex, value)
# Add variable to pointed variables
- self.PointedVariables[(mapvariableidx, nbsubentries)] = "%s_%s"%(indexname, subindexname)
+ self.PointedVariables[(mapvariableidx, nbsubentries)] = "%s_%s" % (indexname, subindexname)
def GenerateConciseDCF(locations, current_location, nodelist, sync_TPDOs, nodename):
"""
@@ -668,7 +668,7 @@
Reset the reference result of config_utils test.
Use with caution. Be sure that config_utils
is currently working properly.
-"""%sys.argv[0]
+""" % sys.argv[0]
# Boolean that indicate if reference result must be redefined
reset = False
@@ -720,7 +720,7 @@
try:
masternode, pointedvariables = GenerateConciseDCF(locations, (0, 1), nodelist, True, "TestNode")
except ValueError, message:
- print "%s\nTest Failed!"%message
+ print "%s\nTest Failed!" % message
sys.exit()
import pprint
--- a/connectors/WAMP/__init__.py Mon Aug 14 21:31:01 2017 +0300
+++ b/connectors/WAMP/__init__.py Mon Aug 14 22:23:17 2017 +0300
@@ -90,7 +90,7 @@
# start the client from a Twisted endpoint
conn = connectWS(transport_factory)
- confnodesroot.logger.write(_("WAMP connecting to URL : %s\n")%url)
+ confnodesroot.logger.write(_("WAMP connecting to URL : %s\n") % url)
return conn
AddToDoBeforeQuit = confnodesroot.AppFrame.AddToDoBeforeQuit
@@ -149,7 +149,7 @@
try :
return WampPLCObjectProxy()
except Exception, msg:
- confnodesroot.logger.write_error(_("WAMP connection to '%s' failed.\n")%location)
+ confnodesroot.logger.write_error(_("WAMP connection to '%s' failed.\n") % location)
confnodesroot.logger.write_error(traceback.format_exc())
return None
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Mon Aug 14 21:31:01 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Mon Aug 14 22:23:17 2017 +0300
@@ -163,7 +163,7 @@
if not isinstance(values, TupleType):
raise ValueError
except:
- message = _("Invalid value \"%s\" for debug variable")%data
+ message = _("Invalid value \"%s\" for debug variable") % data
values = None
# Display message if data is invalid
--- a/controls/DebugVariablePanel/DebugVariablePanel.py Mon Aug 14 21:31:01 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariablePanel.py Mon Aug 14 22:23:17 2017 +0300
@@ -129,7 +129,7 @@
if not isinstance(values, TupleType):
raise ValueError
except:
- message = _("Invalid value \"%s\" for debug variable")%data
+ message = _("Invalid value \"%s\" for debug variable") % data
values = None
# Display message if data is invalid
--- a/controls/VariablePanel.py Mon Aug 14 21:31:01 2017 +0300
+++ b/controls/VariablePanel.py Mon Aug 14 22:23:17 2017 +0300
@@ -252,10 +252,10 @@
try:
values = eval(data)
except:
- message = _("Invalid value \"%s\" for variable grid element")%data
+ message = _("Invalid value \"%s\" for variable grid element") % data
values = None
if not isinstance(values, TupleType):
- message = _("Invalid value \"%s\" for variable grid element")%data
+ message = _("Invalid value \"%s\" for variable grid element") % data
values = None
if values is not None:
if col != wx.NOT_FOUND and row != wx.NOT_FOUND:
@@ -279,9 +279,9 @@
if message is None:
if not location.startswith("%"):
if location[0].isdigit() and base_type != "BOOL":
- message = _("Incompatible size of data between \"%s\" and \"BOOL\"")%location
+ message = _("Incompatible size of data between \"%s\" and \"BOOL\"") % location
elif location[0] not in LOCATIONDATATYPES:
- message = _("Unrecognized data size \"%s\"")%location[0]
+ message = _("Unrecognized data size \"%s\"") % location[0]
elif base_type not in LOCATIONDATATYPES[location[0]]:
message = _("Incompatible size of data between \"{a1}\" and \"{a2}\"").\
format(a1 = location, a2 = variable_type)
@@ -335,7 +335,7 @@
elif var_name.upper() in [name.upper()
for name in self.ParentWindow.Controler.\
GetProjectPouNames(self.ParentWindow.Debug)]:
- message = _("\"%s\" pou already exists!")%var_name
+ message = _("\"%s\" pou already exists!") % var_name
elif not var_name.upper() in [name.upper()
for name in self.ParentWindow.Controler.\
GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
@@ -393,7 +393,7 @@
self.ParentWindow.SaveValues()
self.ParentWindow.RefreshValues()
else:
- message = _("\"%s\" element for this pou already exists!")%var_name
+ message = _("\"%s\" element for this pou already exists!") % var_name
if message is not None:
wx.CallAfter(self.ShowMessage, message)
--- a/dialogs/ArrayTypeDialog.py Mon Aug 14 21:31:01 2017 +0300
+++ b/dialogs/ArrayTypeDialog.py Mon Aug 14 22:23:17 2017 +0300
@@ -99,11 +99,11 @@
for dimensions in dimension_strings:
result = DIMENSION_MODEL.match(dimensions)
if result is None:
- message = _("\"%s\" value isn't a valid array dimension!")%dimensions
+ message = _("\"%s\" value isn't a valid array dimension!") % dimensions
break
bounds = result.groups()
if int(bounds[0]) >= int(bounds[1]):
- message = _("\"%s\" value isn't a valid array dimension!\nRight value must be greater than left value.")%dimensions
+ message = _("\"%s\" value isn't a valid array dimension!\nRight value must be greater than left value.") % dimensions
break
dimensions_list.append(bounds)
--- a/dialogs/DiscoveryDialog.py Mon Aug 14 21:31:01 2017 +0300
+++ b/dialogs/DiscoveryDialog.py Mon Aug 14 22:23:17 2017 +0300
@@ -156,7 +156,7 @@
def OnIpButton(self, event):
if self.LatestSelection is not None:
l = lambda col : self.getColumnText(self.LatestSelection,col)
- self.URI = "%s://%s:%s"%tuple(map(l,(1,2,3)))
+ self.URI = "%s://%s:%s" % tuple(map(l,(1,2,3)))
self.EndModal(wx.ID_OK)
event.Skip()
@@ -188,7 +188,7 @@
self.LatestSelection = idx
svcname = self.getColumnText(idx, 0)
connect_type = self.getColumnText(idx, 1)
- self.URI = "%s://%s"%(connect_type, svcname + '.' + service_type)
+ self.URI = "%s://%s" % (connect_type, svcname + '.' + service_type)
def GetURI(self):
return self.URI
--- a/dialogs/PouActionDialog.py Mon Aug 14 21:31:01 2017 +0300
+++ b/dialogs/PouActionDialog.py Mon Aug 14 22:23:17 2017 +0300
@@ -89,9 +89,9 @@
if i == 0:
text += item
elif i == len(error) - 1:
- text += _(" and %s")%item
+ text += _(" and %s") % item
else:
- text += _(", %s")%item
+ text += _(", %s") % item
message = _("Form isn't complete. %s must be filled!") % text
elif not TestIdentifier(action_name):
message = _("\"%s\" is not a valid identifier!") % action_name
--- a/dialogs/PouDialog.py Mon Aug 14 21:31:01 2017 +0300
+++ b/dialogs/PouDialog.py Mon Aug 14 22:23:17 2017 +0300
@@ -111,9 +111,9 @@
if i == 0:
text += item
elif i == len(error) - 1:
- text += _(" and %s")%item
+ text += _(" and %s") % item
else:
- text += _(", %s")%item
+ text += _(", %s") % item
message = _("Form isn't complete. %s must be filled!") % text
elif not TestIdentifier(pou_name):
message = _("\"%s\" is not a valid identifier!") % pou_name
--- a/dialogs/PouTransitionDialog.py Mon Aug 14 21:31:01 2017 +0300
+++ b/dialogs/PouTransitionDialog.py Mon Aug 14 22:23:17 2017 +0300
@@ -91,9 +91,9 @@
if i == 0:
text += item
elif i == len(error) - 1:
- text += _(" and %s")%item
+ text += _(" and %s") % item
else:
- text += _(", %s")%item
+ text += _(", %s") % item
message = _("Form isn't complete. %s must be filled!") % text
elif not TestIdentifier(transition_name):
message = _("\"%s\" is not a valid identifier!") % transition_name
--- a/dialogs/ProjectDialog.py Mon Aug 14 21:31:01 2017 +0300
+++ b/dialogs/ProjectDialog.py Mon Aug 14 22:23:17 2017 +0300
@@ -66,9 +66,9 @@
if i == 0:
text += item
elif i == len(error) - 1:
- text += _(" and %s")%item
+ text += _(" and %s") % item
else:
- text += ", %s"%item
+ text += ", %s" % item
dialog = wx.MessageDialog(self,
_("Form isn't complete. %s must be filled!") % text,
_("Error"), wx.OK|wx.ICON_ERROR)
--- a/docutil/dochtml.py Mon Aug 14 21:31:01 2017 +0300
+++ b/docutil/dochtml.py Mon Aug 14 22:23:17 2017 +0300
@@ -94,7 +94,7 @@
if wx.Platform == '__WXMSW__':
import webbrowser
webbrowser.open(url)
- elif subprocess.call("firefox %s"%url, shell=True) != 0:
+ elif subprocess.call("firefox %s" % url, shell=True) != 0:
wx.MessageBox("""Firefox browser not found.\nPlease point your browser at :\n%s""" % url)
except ImportError:
wx.MessageBox('Please point your browser at: %s' % url)
--- a/docutil/docpdf.py Mon Aug 14 21:31:01 2017 +0300
+++ b/docutil/docpdf.py Mon Aug 14 22:23:17 2017 +0300
@@ -47,16 +47,16 @@
def open_win_pdf(readerexepath, pdffile, pagenum = None):
if pagenum != None :
- os.spawnl(os.P_DETACH, readerexepath, "AcroRd32.exe", "/A", "page=%d=OpenActions" % pagenum, '"%s"'%pdffile)
+ os.spawnl(os.P_DETACH, readerexepath, "AcroRd32.exe", "/A", "page=%d=OpenActions" % pagenum, '"%s"' % pdffile)
else:
- os.spawnl(os.P_DETACH, readerexepath, "AcroRd32.exe", '"%s"'%pdffile)
+ os.spawnl(os.P_DETACH, readerexepath, "AcroRd32.exe", '"%s"' % pdffile)
def open_lin_pdf(readerexepath, pdffile, pagenum = None):
if pagenum == None :
- os.system("%s -remote DS301 %s &"%(readerexepath, pdffile))
+ os.system("%s -remote DS301 %s &" % (readerexepath, pdffile))
else:
- print "Open pdf %s at page %d"%(pdffile, pagenum)
- os.system("%s -remote DS301 %s %d &"%(readerexepath, pdffile, pagenum))
+ print "Open pdf %s at page %d" % (pdffile, pagenum)
+ os.system("%s -remote DS301 %s %d &" % (readerexepath, pdffile, pagenum))
def open_pdf(pdffile, pagenum = None):
if wx.Platform == '__WXMSW__' :
--- a/docutil/docsvg.py Mon Aug 14 21:31:01 2017 +0300
+++ b/docutil/docsvg.py Mon Aug 14 22:23:17 2017 +0300
@@ -44,7 +44,7 @@
def open_lin_svg(svgexepath, svgfile):
""" Open Inkscape on Linux platform """
if os.path.isfile("/usr/bin/inkscape"):
- os.system("%s %s &"%(svgexepath , svgfile))
+ os.system("%s %s &" % (svgexepath , svgfile))
def open_svg(svgfile):
""" Generic function to open SVG file """
--- a/editors/ConfTreeNodeEditor.py Mon Aug 14 21:31:01 2017 +0300
+++ b/editors/ConfTreeNodeEditor.py Mon Aug 14 22:23:17 2017 +0300
@@ -331,7 +331,7 @@
first = True
for element_infos in elements:
if path:
- element_path = "%s.%s"%(path, element_infos["name"])
+ element_path = "%s.%s" % (path, element_infos["name"])
else:
element_path = element_infos["name"]
if element_infos["type"] == "element":
@@ -358,12 +358,12 @@
flags |= wx.TOP
sizer.AddSizer(boxsizer, border=5, flag=flags)
staticbitmap = GenStaticBitmap(ID=-1, bitmapname=element_infos["name"],
- name="%s_bitmap"%element_infos["name"], parent=self.ParamsEditor,
+ name="%s_bitmap" % element_infos["name"], parent=self.ParamsEditor,
pos=wx.Point(0, 0), size=wx.Size(24, 24), style=0)
boxsizer.AddWindow(staticbitmap, border=5, flag=wx.RIGHT)
statictext = wx.StaticText(self.ParamsEditor,
- label="%s:"%_(element_infos["name"]))
+ label="%s:" % _(element_infos["name"]))
boxsizer.AddWindow(statictext, border=5,
flag=wx.ALIGN_CENTER_VERTICAL|wx.RIGHT)
@@ -401,7 +401,7 @@
value = element_infos["value"]
staticbox = wx.StaticBox(self.ParamsEditor,
- label="%s - %s"%(_(name), _(value)), size=wx.Size(10, 0))
+ label="%s - %s" % (_(name), _(value)), size=wx.Size(10, 0))
staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL)
sizer.AddSizer(staticboxsizer, border=5, flag=wx.GROW | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.GenerateSizerElements(staticboxsizer, element_infos["children"], element_path)
--- a/editors/DataTypeEditor.py Mon Aug 14 21:31:01 2017 +0300
+++ b/editors/DataTypeEditor.py Mon Aug 14 22:23:17 2017 +0300
@@ -547,12 +547,12 @@
index = event.GetIndex()
if index >= len(values) or values[index].upper() != text.upper():
if text.upper() in [value.upper() for value in values]:
- message = wx.MessageDialog(self, _("\"%s\" value already defined!")%text, _("Error"), wx.OK|wx.ICON_ERROR)
+ message = wx.MessageDialog(self, _("\"%s\" value already defined!") % text, _("Error"), wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
event.Veto()
elif text.upper() in IEC_KEYWORDS:
- message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!")%text, _("Error"), wx.OK|wx.ICON_ERROR)
+ message = wx.MessageDialog(self, _("\"%s\" is a keyword. It can't be used!") % text, _("Error"), wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
else:
@@ -582,13 +582,13 @@
if colname == "Name":
message = None
if not TestIdentifier(value):
- message = _("\"%s\" is not a valid identifier!")%value
+ message = _("\"%s\" is not a valid identifier!") % value
elif value.upper() in IEC_KEYWORDS:
- message = _("\"%s\" is a keyword. It can't be used!")%value
+ message = _("\"%s\" is a keyword. It can't be used!") % value
## elif value.upper() in self.PouNames:
## message = _("A pou with \"%s\" as name exists!")%value
elif value.upper() in [var["Name"].upper() for idx, var in enumerate(self.StructureElementsTable.GetData()) if idx != row]:
- message = _("An element named \"%s\" already exists in this structure!")%value
+ message = _("An element named \"%s\" already exists in this structure!") % value
else:
self.RefreshTypeInfos()
wx.CallAfter(self.StructureElementsTable.ResetView, self.StructureElementsGrid)
@@ -740,14 +740,14 @@
for dimensions in self.ArrayDimensions.GetStrings():
result = DIMENSION_MODEL.match(dimensions)
if result is None:
- message = wx.MessageDialog(self, _("\"%s\" value isn't a valid array dimension!")%dimensions, _("Error"), wx.OK|wx.ICON_ERROR)
+ message = wx.MessageDialog(self, _("\"%s\" value isn't a valid array dimension!") % dimensions, _("Error"), wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
self.RefreshView()
return
bounds = result.groups()
if int(bounds[0]) >= int(bounds[1]):
- message = wx.MessageDialog(self, _("\"%s\" value isn't a valid array dimension!\nRight value must be greater than left value.")%dimensions, _("Error"), wx.OK|wx.ICON_ERROR)
+ message = wx.MessageDialog(self, _("\"%s\" value isn't a valid array dimension!\nRight value must be greater than left value.") % dimensions, _("Error"), wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
self.RefreshView()
--- a/editors/LDViewer.py Mon Aug 14 21:31:01 2017 +0300
+++ b/editors/LDViewer.py Mon Aug 14 22:23:17 2017 +0300
@@ -211,7 +211,7 @@
if rung not in rungs:
rungs.append(rung)
if len(rungs) > 1:
- raise ValueError, _("Ladder element with id %d is on more than one rung.")%instance["id"]
+ raise ValueError, _("Ladder element with id %d is on more than one rung.") % instance["id"]
element = self.FindElementById(instance["id"])
element_connectors = element.GetConnectors()
self.Rungs[rungs[0]].SelectElement(element)
@@ -227,7 +227,7 @@
if rung not in rungs:
rungs.append(rung)
if len(rungs) > 1:
- raise ValueError, _("Ladder element with id %d is on more than one rung.")%instance["id"]
+ raise ValueError, _("Ladder element with id %d is on more than one rung.") % instance["id"]
element = self.FindElementById(instance["id"])
element_connectors = element.GetConnectors()
self.Rungs[rungs[0]].SelectElement(element)
--- a/editors/ResourceEditor.py Mon Aug 14 21:31:01 2017 +0300
+++ b/editors/ResourceEditor.py Mon Aug 14 22:23:17 2017 +0300
@@ -381,17 +381,17 @@
self.TypeList = ""
blocktypes = self.Controler.GetBlockResource()
for blocktype in blocktypes:
- self.TypeList += ",%s"%blocktype
+ self.TypeList += ",%s" % blocktype
def RefreshTaskList(self):
self.TaskList = ""
for row in xrange(self.TasksTable.GetNumberRows()):
- self.TaskList += ",%s"%self.TasksTable.GetValueByName(row, "Name")
+ self.TaskList += ",%s" % self.TasksTable.GetValueByName(row, "Name")
def RefreshVariableList(self):
self.VariableList = ""
for variable in self.Controler.GetEditedResourceVariables(self.TagName):
- self.VariableList += ",%s"%variable
+ self.VariableList += ",%s" % variable
def RefreshModel(self):
self.Controler.SetEditedResourceInfos(self.TagName, self.TasksTable.GetData(), self.InstancesTable.GetData())
--- a/editors/TextViewer.py Mon Aug 14 21:31:01 2017 +0300
+++ b/editors/TextViewer.py Mon Aug 14 22:23:17 2017 +0300
@@ -57,9 +57,9 @@
re_texts = {}
re_texts["letter"] = "[A-Za-z]"
re_texts["digit"] = "[0-9]"
-re_texts["identifier"] = "((?:%(letter)s|(?:_(?:%(letter)s|%(digit)s)))(?:_?(?:%(letter)s|%(digit)s))*)"%re_texts
+re_texts["identifier"] = "((?:%(letter)s|(?:_(?:%(letter)s|%(digit)s)))(?:_?(?:%(letter)s|%(digit)s))*)" % re_texts
IDENTIFIER_MODEL = re.compile(re_texts["identifier"])
-LABEL_MODEL = re.compile("[ \t\n]%(identifier)s:[ \t\n]"%re_texts)
+LABEL_MODEL = re.compile("[ \t\n]%(identifier)s:[ \t\n]" % re_texts)
EXTENSIBLE_PARAMETER = re.compile("IN[1-9][0-9]*$")
HIGHLIGHT_TYPES = {
@@ -267,9 +267,9 @@
return
dialog.Destroy()
if blockname.upper() in [name.upper() for name in self.Controler.GetProjectPouNames(self.Debug)]:
- message = _("\"%s\" pou already exists!")%blockname
+ message = _("\"%s\" pou already exists!") % blockname
elif blockname.upper() in [name.upper() for name in self.Controler.GetEditedElementVariables(self.TagName, self.Debug)]:
- message = _("\"%s\" element for this pou already exists!")%blockname
+ message = _("\"%s\" element for this pou already exists!") % blockname
else:
self.Controler.AddEditedElementPouVar(self.TagName, values[0], blockname)
self.RefreshVariablePanel()
@@ -296,9 +296,9 @@
if var_name is None:
return
elif var_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames(self.Debug)]:
- message = _("\"%s\" pou already exists!")%var_name
+ message = _("\"%s\" pou already exists!") % var_name
elif var_name.upper() in [name.upper() for name in self.Controler.GetEditedElementVariables(self.TagName, self.Debug)]:
- message = _("\"%s\" element for this pou already exists!")%var_name
+ message = _("\"%s\" element for this pou already exists!") % var_name
else:
location = values[0]
if not location.startswith("%"):
@@ -347,7 +347,7 @@
if var_name is None:
return
elif var_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames(self.Debug)]:
- message = _("\"%s\" pou already exists!")%var_name
+ message = _("\"%s\" pou already exists!") % var_name
else:
var_type = values[2]
if not var_name.upper() in [name.upper() for name in self.Controler.GetEditedElementVariables(self.TagName, self.Debug)]:
@@ -370,7 +370,7 @@
if var_name is None:
return
elif var_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames(self.Debug)]:
- message = _("\"%s\" pou already exists!")%var_name
+ message = _("\"%s\" pou already exists!") % var_name
else:
if not var_name.upper() in [name.upper() for name in self.Controler.GetEditedElementVariables(self.TagName, self.Debug)]:
self.Controler.AddEditedElementPouExternalVar(self.TagName, values[2], var_name)
--- a/editors/Viewer.py Mon Aug 14 21:31:01 2017 +0300
+++ b/editors/Viewer.py Mon Aug 14 22:23:17 2017 +0300
@@ -231,10 +231,10 @@
try:
values = eval(data)
except:
- message = _("Invalid value \"%s\" for viewer block")%data
+ message = _("Invalid value \"%s\" for viewer block") % data
values = None
if not isinstance(values, TupleType):
- message = _("Invalid value \"%s\" for viewer block")%data
+ message = _("Invalid value \"%s\" for viewer block") % data
values = None
if values is not None:
if values[1] == "debug":
@@ -244,7 +244,7 @@
elif values[1] in ["function", "functionBlock"]:
words = tagname.split("::")
if pou_name == values[0]:
- message = _("\"%s\" can't use itself!")%pou_name
+ message = _("\"%s\" can't use itself!") % pou_name
elif pou_type == "function" and values[1] != "function":
message = _("Function Blocks can't be used in Functions!")
elif self.ParentWindow.Controler.PouIsUsedBy(pou_name, values[0], self.ParentWindow.Debug):
@@ -258,9 +258,9 @@
if values[1] != "function" and blockname == "":
blockname = self.ParentWindow.GenerateNewName(blocktype=values[0])
if blockname.upper() in [name.upper() for name in self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]:
- message = _("\"%s\" pou already exists!")%blockname
+ message = _("\"%s\" pou already exists!") % blockname
elif blockname.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
- message = _("\"%s\" element for this pou already exists!")%blockname
+ message = _("\"%s\" element for this pou already exists!") % blockname
else:
id = self.ParentWindow.GetNewId()
block = FBD_Block(self.ParentWindow, values[0], blockname, id, inputs = blockinputs)
@@ -313,7 +313,7 @@
if var_name is None:
return
elif var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]:
- message = _("\"%s\" pou already exists!")%var_name
+ message = _("\"%s\" pou already exists!") % var_name
elif not var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
if location[1] == "Q":
var_class = OUTPUT
@@ -328,7 +328,7 @@
self.ParentWindow.ParentWindow.RefreshPouInstanceVariablesPanel()
self.ParentWindow.AddVariableBlock(x, y, scaling, var_class, var_name, var_type)
else:
- message = _("\"%s\" element for this pou already exists!")%var_name
+ message = _("\"%s\" element for this pou already exists!") % var_name
elif values[1] == "NamedConstant":
if pou_type == "program":
initval = values[0]
@@ -343,7 +343,7 @@
if var_name is None:
return
elif var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]:
- message = _("\"%s\" pou already exists!")%var_name
+ message = _("\"%s\" pou already exists!") % var_name
elif not var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
var_class = INPUT
var_type = values[2]
@@ -352,7 +352,7 @@
self.ParentWindow.ParentWindow.RefreshPouInstanceVariablesPanel()
self.ParentWindow.AddVariableBlock(x, y, scaling, var_class, var_name, var_type)
else:
- message = _("\"%s\" element for this pou already exists!")%var_name
+ message = _("\"%s\" element for this pou already exists!") % var_name
elif values[1] == "Global":
var_name = values[0]
dlg = wx.TextEntryDialog(
@@ -365,14 +365,14 @@
if var_name is None:
return
elif var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]:
- message = _("\"%s\" pou already exists!")%var_name
+ message = _("\"%s\" pou already exists!") % var_name
elif not var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
self.ParentWindow.Controler.AddEditedElementPouExternalVar(tagname, values[2], var_name)
self.ParentWindow.RefreshVariablePanel()
self.ParentWindow.ParentWindow.RefreshPouInstanceVariablesPanel()
self.ParentWindow.AddVariableBlock(x, y, scaling, INPUT, var_name, values[2])
else:
- message = _("\"%s\" element for this pou already exists!")%var_name
+ message = _("\"%s\" element for this pou already exists!") % var_name
elif values[1] == "Constant":
self.ParentWindow.AddVariableBlock(x, y, scaling, INPUT, values[0], None)
elif values[3] == tagname:
@@ -991,14 +991,14 @@
blockname = block.GetName()
connectorname = element.GetName()
if blockname != "":
- iec_path = "%s.%s.%s"%(instance_path, blockname, connectorname)
+ iec_path = "%s.%s.%s" % (instance_path, blockname, connectorname)
else:
if connectorname == "":
- iec_path = "%s.%s%d"%(instance_path, block.GetType(), block.GetId())
+ iec_path = "%s.%s%d" % (instance_path, block.GetType(), block.GetId())
else:
- iec_path = "%s.%s%d_%s"%(instance_path, block.GetType(), block.GetId(), connectorname)
+ iec_path = "%s.%s%d_%s" % (instance_path, block.GetType(), block.GetId(), connectorname)
elif isinstance(block, FBD_Variable):
- iec_path = "%s.%s"%(instance_path, block.GetName())
+ iec_path = "%s.%s" % (instance_path, block.GetName())
elif isinstance(block, FBD_Connector):
connection = self.GetConnectorByName(block.GetName())
if connection is not None:
@@ -1006,14 +1006,14 @@
if len(connector.Wires) == 1:
iec_path = self.GetElementIECPath(connector.Wires[0][0])
elif isinstance(element, LD_Contact):
- iec_path = "%s.%s"%(instance_path, element.GetName())
+ iec_path = "%s.%s" % (instance_path, element.GetName())
elif isinstance(element, SFC_Step):
- iec_path = "%s.%s.X"%(instance_path, element.GetName())
+ iec_path = "%s.%s.X" % (instance_path, element.GetName())
elif isinstance(element, SFC_Transition):
connectors = element.GetConnectors()
previous_steps = self.GetPreviousSteps(connectors["inputs"])
next_steps = self.GetNextSteps(connectors["outputs"])
- iec_path = "%s.%s->%s"%(instance_path, ",".join(previous_steps), ",".join(next_steps))
+ iec_path = "%s.%s->%s" % (instance_path, ",".join(previous_steps), ",".join(next_steps))
return iec_path
def GetWireModifier(self, wire):
@@ -1883,7 +1883,7 @@
def OnEditBlockMenu(self, event):
if self.SelectedElement is not None:
- self.ParentWindow.EditProjectElement(ITEM_POU, "P::%s"%self.SelectedElement.GetType())
+ self.ParentWindow.EditProjectElement(ITEM_POU, "P::%s" % self.SelectedElement.GetType())
def OnAdjustBlockSizeMenu(self, event):
if self.SelectedElement is not None:
@@ -2238,7 +2238,7 @@
}.get(self.Controler.GetPouType(instance_type))
if pou_type is not None and instance_type in self.Controler.GetProjectPouNames(self.Debug):
self.ParentWindow.OpenDebugViewer(pou_type,
- "%s.%s"%(self.GetInstancePath(True), self.SelectedElement.GetName()),
+ "%s.%s" % (self.GetInstancePath(True), self.SelectedElement.GetName()),
self.Controler.ComputePouName(instance_type))
else:
iec_path = self.GetElementIECPath(self.SelectedElement)
--- a/graphics/FBD_Objects.py Mon Aug 14 21:31:01 2017 +0300
+++ b/graphics/FBD_Objects.py Mon Aug 14 22:23:17 2017 +0300
@@ -252,7 +252,7 @@
start = int(inputs[-1][0].replace("IN", ""))
for i in xrange(self.Extension - len(blocktype["inputs"])):
start += 1
- inputs.append(("IN%d"%start, inputs[-1][1], inputs[-1][2]))
+ inputs.append(("IN%d" % start, inputs[-1][1], inputs[-1][2]))
comment = blocktype["comment"]
self.Description = _(comment) + blocktype.get("usage", "")
else:
--- a/i18n/mki18n.py Mon Aug 14 21:31:01 2017 +0300
+++ b/i18n/mki18n.py Mon Aug 14 22:23:17 2017 +0300
@@ -128,7 +128,7 @@
if not words_found.get(word, False) and messages.find("msgid \"%s\"\nmsgstr \"\"" % word) == -1:
words_found[word] = True
messages_file.write('\n')
- messages_file.write("msgid \"%s\"\n"%word)
+ messages_file.write("msgid \"%s\"\n" % word)
messages_file.write("msgstr \"\"\n")
code_file.close()
--- a/plcopen/plcopen.py Mon Aug 14 21:31:01 2017 +0300
+++ b/plcopen/plcopen.py Mon Aug 14 22:23:17 2017 +0300
@@ -219,16 +219,16 @@
time_values.extend([int(seconds), int((seconds % 1) * 1000000)])
text = "T#"
if time_values[0] != 0:
- text += "%dh"%time_values[0]
+ text += "%dh" % time_values[0]
if time_values[1] != 0:
- text += "%dm"%time_values[1]
+ text += "%dm" % time_values[1]
if time_values[2] != 0:
- text += "%ds"%time_values[2]
+ text += "%ds" % time_values[2]
if time_values[3] != 0:
if time_values[3] % 1000 != 0:
- text += "%.3fms"%(float(time_values[3]) / 1000)
+ text += "%.3fms" % (float(time_values[3]) / 1000)
else:
- text += "%dms"%(time_values[3] / 1000)
+ text += "%dms" % (time_values[3] / 1000)
task.set("interval", text)
# Update resources pou instance attributes
@@ -417,7 +417,7 @@
def appenddataType(self, name):
if self.getdataType(name) is not None:
- raise ValueError, "\"%s\" Data Type already exists !!!"%name
+ raise ValueError, "\"%s\" Data Type already exists !!!" % name
self.types.appenddataTypeElement(name)
setattr(cls, "appenddataType", appenddataType)
@@ -884,7 +884,7 @@
found = True
break
if not found:
- raise ValueError, _("\"%s\" Data Type doesn't exist !!!")%name
+ raise ValueError, _("\"%s\" Data Type doesn't exist !!!") % name
setattr(cls, "removedataTypeElement", removedataTypeElement)
def getpouElements(self):
@@ -902,7 +902,7 @@
def appendpouElement(self, name, pou_type, body_type):
for element in self.pous.getpou():
if TextMatched(element.getname(), name):
- raise ValueError, _("\"%s\" POU already exists !!!")%name
+ raise ValueError, _("\"%s\" POU already exists !!!") % name
new_pou = PLCOpenParser.CreateElement("pou", "pous")
self.pous.appendpou(new_pou)
new_pou.setname(name)
@@ -923,7 +923,7 @@
found = True
break
if not found:
- raise ValueError, _("\"%s\" POU doesn't exist !!!")%name
+ raise ValueError, _("\"%s\" POU doesn't exist !!!") % name
setattr(cls, "removepouElement", removepouElement)
def Search(self, criteria, parent_infos=[]):
@@ -1101,7 +1101,7 @@
if body_type in ["IL", "ST", "LD", "FBD", "SFC"]:
self.body[0].setcontent(PLCOpenParser.CreateElement(body_type, "body"))
else:
- raise ValueError, "%s isn't a valid body type!"%type
+ raise ValueError, "%s isn't a valid body type!" % type
setattr(cls, "setbodyType", setbodyType)
def getbodyType(self):
@@ -1321,7 +1321,7 @@
removed = True
break
if not removed:
- raise ValueError, _("Transition with name %s doesn't exist!")%name
+ raise ValueError, _("Transition with name %s doesn't exist!") % name
setattr(cls, "removetransition", removetransition)
def addaction(self, name, body_type):
@@ -1362,7 +1362,7 @@
removed = True
break
if not removed:
- raise ValueError, _("Action with name %s doesn't exist!")%name
+ raise ValueError, _("Action with name %s doesn't exist!") % name
setattr(cls, "removeaction", removeaction)
def updateElementName(self, old_name, new_name):
@@ -1454,7 +1454,7 @@
if body_type in ["IL", "ST", "LD", "FBD", "SFC"]:
self.body.setcontent(PLCOpenParser.CreateElement(body_type, "body"))
else:
- raise ValueError, "%s isn't a valid body type!"%type
+ raise ValueError, "%s isn't a valid body type!" % type
def getbodyType(self):
return self.body.getcontent().getLocalTag()
@@ -1648,14 +1648,14 @@
if self.content.getLocalTag() in ["LD","FBD","SFC"]:
self.content.appendcontent(instance)
else:
- raise TypeError, _("%s body don't have instances!")%self.content.getLocalTag()
+ raise TypeError, _("%s body don't have instances!") % self.content.getLocalTag()
setattr(cls, "appendcontentInstance", appendcontentInstance)
def getcontentInstances(self):
if self.content.getLocalTag() in ["LD","FBD","SFC"]:
return self.content.getcontent()
else:
- raise TypeError, _("%s body don't have instances!")%self.content.getLocalTag()
+ raise TypeError, _("%s body don't have instances!") % self.content.getLocalTag()
setattr(cls, "getcontentInstances", getcontentInstances)
instance_by_id_xpath = PLCOpen_XPath("*[@localId=$localId]")
@@ -1667,7 +1667,7 @@
return instance[0]
return None
else:
- raise TypeError, _("%s body don't have instances!")%self.content.getLocalTag()
+ raise TypeError, _("%s body don't have instances!") % self.content.getLocalTag()
setattr(cls, "getcontentInstance", getcontentInstance)
def getcontentInstancesIds(self):
@@ -1675,7 +1675,7 @@
return OrderedDict([(instance.getlocalId(), True)
for instance in self.content])
else:
- raise TypeError, _("%s body don't have instances!")%self.content.getLocalTag()
+ raise TypeError, _("%s body don't have instances!") % self.content.getLocalTag()
setattr(cls, "getcontentInstancesIds", getcontentInstancesIds)
def getcontentInstanceByName(self, name):
@@ -1685,7 +1685,7 @@
return instance[0]
return None
else:
- raise TypeError, _("%s body don't have instances!")%self.content.getLocalTag()
+ raise TypeError, _("%s body don't have instances!") % self.content.getLocalTag()
setattr(cls, "getcontentInstanceByName", getcontentInstanceByName)
def removecontentInstance(self, local_id):
@@ -1694,30 +1694,30 @@
if len(instance) > 0:
self.content.remove(instance[0])
else:
- raise ValueError, _("Instance with id %d doesn't exist!")%id
+ raise ValueError, _("Instance with id %d doesn't exist!") % id
else:
- raise TypeError, "%s body don't have instances!"%self.content.getLocalTag()
+ raise TypeError, "%s body don't have instances!" % self.content.getLocalTag()
setattr(cls, "removecontentInstance", removecontentInstance)
def settext(self, text):
if self.content.getLocalTag() in ["IL","ST"]:
self.content.setanyText(text)
else:
- raise TypeError, _("%s body don't have text!")%self.content.getLocalTag()
+ raise TypeError, _("%s body don't have text!") % self.content.getLocalTag()
setattr(cls, "settext", settext)
def gettext(self):
if self.content.getLocalTag() in ["IL","ST"]:
return self.content.getanyText()
else:
- raise TypeError, _("%s body don't have text!")%self.content.getLocalTag()
+ raise TypeError, _("%s body don't have text!") % self.content.getLocalTag()
setattr(cls, "gettext", gettext)
def hasblock(self, block_type):
if self.content.getLocalTag() in ["IL","ST"]:
return self.content.hasblock(block_type)
else:
- raise TypeError, _("%s body don't have text!")%self.content.getLocalTag()
+ raise TypeError, _("%s body don't have text!") % self.content.getLocalTag()
setattr(cls, "hasblock", hasblock)
def updateElementName(self, old_name, new_name):
@@ -2415,7 +2415,7 @@
elif opened == closed:
i += 1
else:
- raise ValueError, _("\"%s\" is an invalid value!")%value
+ raise ValueError, _("\"%s\" is an invalid value!") % value
return items
cls = PLCOpenParser.GetElementClass("arrayValue", "value")
@@ -2449,10 +2449,10 @@
value = element.getvalue()
if value is None:
value = ""
- values.append("%s(%s)"%(repetition, value))
+ values.append("%s(%s)" % (repetition, value))
else:
values.append(element.getvalue())
- return "[%s]"%", ".join(values)
+ return "[%s]" % ", ".join(values)
setattr(cls, "getvalue", getvalue)
cls = PLCOpenParser.GetElementClass("structValue", "value")
@@ -2475,6 +2475,6 @@
def getvalue(self):
values = []
for element in self.value:
- values.append("%s := %s"%(element.getmember(), element.getvalue()))
- return "(%s)"%", ".join(values)
+ values.append("%s := %s" % (element.getmember(), element.getvalue()))
+ return "(%s)" % ", ".join(values)
setattr(cls, "getvalue", getvalue)
--- a/plcopen/structures.py Mon Aug 14 21:31:01 2017 +0300
+++ b/plcopen/structures.py Mon Aug 14 22:23:17 2017 +0300
@@ -137,7 +137,7 @@
param_name = param_type
param_type = variables[param_type]
elif len_of_not_predifined_variable > 1:
- param_name = "IN%d"%base
+ param_name = "IN%d" % base
base += 1
else:
param_name = "IN"
--- a/py_ext/PythonFileCTNMixin.py Mon Aug 14 21:31:01 2017 +0300
+++ b/py_ext/PythonFileCTNMixin.py Mon Aug 14 22:23:17 2017 +0300
@@ -171,7 +171,7 @@
# write generated content to python file
runtimefile_path = os.path.join(buildpath,
- "runtime_%s.py"%location_str)
+ "runtime_%s.py" % location_str)
runtimefile = open(runtimefile_path, 'w')
runtimefile.write(PyFileContent.encode('utf-8'))
runtimefile.close()
@@ -279,16 +279,16 @@
}
""" % locals()
- Gen_PyCfile_path = os.path.join(buildpath, "PyCFile_%s.c"%location_str)
+ Gen_PyCfile_path = os.path.join(buildpath, "PyCFile_%s.c" % location_str)
pycfile = open(Gen_PyCfile_path,'w')
pycfile.write(PyCFileContent)
pycfile.close()
- matiec_CFLAGS = '"-I%s"'%os.path.abspath(
+ matiec_CFLAGS = '"-I%s"' % os.path.abspath(
self.GetCTRoot().GetIECLibPath())
return ([(Gen_PyCfile_path, matiec_CFLAGS)],
"",
True,
- ("runtime_%s.py"%location_str, file(runtimefile_path,"rb")))
-
+ ("runtime_%s.py" % location_str, file(runtimefile_path,"rb")))
+
--- a/runtime/PLCObject.py Mon Aug 14 21:31:01 2017 +0300
+++ b/runtime/PLCObject.py Mon Aug 14 22:23:17 2017 +0300
@@ -264,7 +264,7 @@
Calls init, start, stop or cleanup method provided by
runtime python files, loaded when new PLC uploaded
"""
- for method in self.python_runtime_vars.get("_runtime_%s"%methodname, []):
+ for method in self.python_runtime_vars.get("_runtime_%s" % methodname, []):
res,exp = self.evaluator(method)
if exp is not None:
self.LogMessage(0,'\n'.join(traceback.format_exception(*exp)))
@@ -279,7 +279,7 @@
try :
t = self.python_runtime_vars["_"+name+"_ctype"]
except KeyError:
- raise KeyError("Try to get unknown shared global variable : %s"%name)
+ raise KeyError("Try to get unknown shared global variable : %s" % name)
v = t()
r = self.python_runtime_vars["_PySafeGetPLCGlob_"+name](ctypes.byref(v))
return self.python_runtime_vars["_"+name+"_unpack"](v)
@@ -287,7 +287,7 @@
try :
t = self.python_runtime_vars["_"+name+"_ctype"]
except KeyError:
- raise KeyError("Try to set unknown shared global variable : %s"%name)
+ raise KeyError("Try to set unknown shared global variable : %s" % name)
v = self.python_runtime_vars["_"+name+"_pack"](t,value)
self.python_runtime_vars["_PySafeSetPLCGlob_"+name](ctypes.byref(v))
@@ -299,7 +299,7 @@
"PLCGlobalsDesc" : []})
for methodname in MethodNames :
- self.python_runtime_vars["_runtime_%s"%methodname] = []
+ self.python_runtime_vars["_runtime_%s" % methodname] = []
try:
filenames = os.listdir(self.workingdir)
@@ -311,7 +311,7 @@
for methodname in MethodNames:
method = self.python_runtime_vars.get("_%s_%s" % (name, methodname), None)
if method is not None:
- self.python_runtime_vars["_runtime_%s"%methodname].append(method)
+ self.python_runtime_vars["_runtime_%s" % methodname].append(method)
except:
self.LogMessage(0,traceback.format_exc())
raise
@@ -346,14 +346,14 @@
result,exp = self.evaluator(eval,AST,self.python_runtime_vars)
if exp is not None:
res = "#EXCEPTION : "+str(exp[1])
- self.LogMessage(1,('PyEval@0x%x(Code="%s") Exception "%s"')%(FBID,cmd,
+ self.LogMessage(1,('PyEval@0x%x(Code="%s") Exception "%s"') % (FBID,cmd,
'\n'.join(traceback.format_exception(*exp))))
else:
res=str(result)
self.python_runtime_vars["FBID"]=None
except Exception,e:
res = "#EXCEPTION : "+str(e)
- self.LogMessage(1,('PyEval@0x%x(Code="%s") Exception "%s"')%(FBID,cmd,str(e)))
+ self.LogMessage(1,('PyEval@0x%x(Code="%s") Exception "%s"') % (FBID,cmd,str(e)))
def StartPLC(self):
if self.CurrentPLCFilename is not None and self.PLCStatus == "Stopped":
@@ -411,7 +411,7 @@
self.UnLoadPLC()
- self.LogMessage("NewPLC (%s)"%md5sum)
+ self.LogMessage("NewPLC (%s)" % md5sum)
self.PLCStatus = "Empty"
try:
--- a/runtime/ServicePublisher.py Mon Aug 14 21:31:01 2017 +0300
+++ b/runtime/ServicePublisher.py Mon Aug 14 22:23:17 2017 +0300
@@ -48,7 +48,7 @@
def _RegisterService(self, name, ip, port):
# name: fully qualified service name
- self.service_name = 'Beremiz_%s.%s'%(name,service_type)
+ self.service_name = 'Beremiz_%s.%s' % (name,service_type)
self.name = name
self.port = port
--- a/svgui/pyjs/build.py Mon Aug 14 21:31:01 2017 +0300
+++ b/svgui/pyjs/build.py Mon Aug 14 22:23:17 2017 +0300
@@ -287,7 +287,7 @@
tmpl = read_boilerplate(data_dir, "all.cache.html")
parser = pyjs.PlatformParser("platform")
app_headers = ''
- scripts = ['<script type="text/javascript" src="%s"></script>'%script \
+ scripts = ['<script type="text/javascript" src="%s"></script>' % script \
for script in js_includes]
app_body = '\n'.join(scripts)
--- a/svgui/pyjs/pyjs.py Mon Aug 14 21:31:01 2017 +0300
+++ b/svgui/pyjs/pyjs.py Mon Aug 14 22:23:17 2017 +0300
@@ -396,7 +396,7 @@
# raise TranslationError("unsupported type (in _method)", default_node)
default_name = arg_names[default_pos]
- print >>self.output, " if (typeof %s == 'undefined')"%(default_name)
+ print >>self.output, " if (typeof %s == 'undefined')" % (default_name)
print >>self.output, " %s=__kwargs.%s;"% (default_name, default_name)
default_pos += 1
--- a/svgui/svgui.py Mon Aug 14 21:31:01 2017 +0300
+++ b/svgui/svgui.py Mon Aug 14 22:23:17 2017 +0300
@@ -106,7 +106,7 @@
jsmodules = {"LiveSVGPage": "svguilib.js"}
res += (("svguilib.js", file(svguilibpath,"rb")),)
- runtimefile_path = os.path.join(buildpath, "runtime_%s.py"%location_str)
+ runtimefile_path = os.path.join(buildpath, "runtime_%s.py" % location_str)
runtimefile = open(runtimefile_path, 'w')
runtimefile.write(svguiservercode % {"svgfile" : "gui.svg"})
runtimefile.write("""
@@ -122,7 +122,7 @@
})
runtimefile.close()
- res += (("runtime_%s.py"%location_str, file(runtimefile_path,"rb")),)
+ res += (("runtime_%s.py" % location_str, file(runtimefile_path,"rb")),)
return res
@@ -133,7 +133,7 @@
if os.path.isfile(svgpath):
shutil.copy(svgpath, self._getSVGpath())
else:
- self.GetCTRoot().logger.write_error(_("No such SVG file: %s\n")%svgpath)
+ self.GetCTRoot().logger.write_error(_("No such SVG file: %s\n") % svgpath)
dialog.Destroy()
def _StartInkscape(self):
--- a/targets/Xenomai/__init__.py Mon Aug 14 21:31:01 2017 +0300
+++ b/targets/Xenomai/__init__.py Mon Aug 14 22:23:17 2017 +0300
@@ -36,7 +36,7 @@
xeno_config + " --skin=native --"+flagsname,
no_stdout=True).spin()
if status:
- self.CTRInstance.logger.write_error(_("Unable to get Xenomai's %s \n")%flagsname)
+ self.CTRInstance.logger.write_error(_("Unable to get Xenomai's %s \n") % flagsname)
return [result.strip()]
return []
--- a/targets/__init__.py Mon Aug 14 21:31:01 2017 +0300
+++ b/targets/__init__.py Mon Aug 14 22:23:17 2017 +0300
@@ -45,7 +45,7 @@
"class":_GetLocalTargetClassFactory(name),
"code": { fname: path.join(_base_path, name, fname)
for fname in listdir(path.join(_base_path, name))
- if fname.startswith("plc_%s_main"%name) and
+ if fname.startswith("plc_%s_main" % name) and
fname.endswith(".c")}})
for name in listdir(_base_path)
if path.isdir(path.join(_base_path, name))
@@ -70,7 +70,7 @@
# Get all xsd targets
for targetname,nfo in targets.iteritems():
xsd_string = open(nfo["xsd"]).read()
- targetchoices += xsd_string%DictXSD_toolchain
+ targetchoices += xsd_string % DictXSD_toolchain
return targetchoices
--- a/targets/toolchain_gcc.py Mon Aug 14 21:31:01 2017 +0300
+++ b/targets/toolchain_gcc.py Mon Aug 14 22:23:17 2017 +0300
@@ -191,7 +191,7 @@
if status :
self.srcmd5.pop(bn)
- self.CTRInstance.logger.write_error(_("C compilation of %s failed.\n")%bn)
+ self.CTRInstance.logger.write_error(_("C compilation of %s failed.\n") % bn)
return False
obns.append(obn)
objs.append(objectfilename)
--- a/wxglade_hmi/wxglade_hmi.py Mon Aug 14 21:31:01 2017 +0300
+++ b/wxglade_hmi/wxglade_hmi.py Mon Aug 14 22:23:17 2017 +0300
@@ -73,9 +73,9 @@
path = self.GetWxGladePath()
glade = os.path.join(path, 'wxglade.py')
if wx.Platform == '__WXMSW__':
- glade = "\"%s\""%glade
+ glade = "\"%s\"" % glade
mode = {False:os.P_NOWAIT, True:os.P_WAIT}[wait]
- os.spawnv(mode, sys.executable, ["\"%s\""%sys.executable] + [glade] + options)
+ os.spawnv(mode, sys.executable, ["\"%s\"" % sys.executable] + [glade] + options)
def OnCTNSave(self, from_project_path=None):
if from_project_path is not None:
@@ -104,8 +104,8 @@
hmipyfile_path=os.path.join(self._getBuildPath(), "hmi.py")
if wx.Platform == '__WXMSW__':
- wxgfile_path = "\"%s\""%wxgfile_path
- wxghmipyfile_path = "\"%s\""%hmipyfile_path
+ wxgfile_path = "\"%s\"" % wxgfile_path
+ wxghmipyfile_path = "\"%s\"" % hmipyfile_path
else:
wxghmipyfile_path = hmipyfile_path
self.launch_wxglade(['-o', wxghmipyfile_path, '-g', 'python', wxgfile_path], wait=True)
@@ -121,7 +121,7 @@
"\n".join(["%(class)s.%(h)s = %(h)s"%
dict(x,h=h) for h in x['handlers']])
for x in hmi_frames])
- global_hmi = ("global %s\n"%",".join(
+ global_hmi = ("global %s\n" % ",".join(
[x["name"] for x in hmi_frames])
if len(hmi_frames) > 0 else "")
init_hmi = "\n".join(["""\
@@ -174,5 +174,5 @@
</application>
""" % {"name": hmi_name, "class": "Class_%s" % hmi_name})
if wx.Platform == '__WXMSW__':
- wxg_filename = "\"%s\""%wxg_filename
+ wxg_filename = "\"%s\"" % wxg_filename
self.launch_wxglade([wxg_filename])
--- a/xmlclass/xmlclass.py Mon Aug 14 21:31:01 2017 +0300
+++ b/xmlclass/xmlclass.py Mon Aug 14 22:23:17 2017 +0300
@@ -710,7 +710,7 @@
for child in node.childNodes:
if child.nodeName not in ["#comment", "#text"]:
namespace, childname = DecomposeQualifiedName(child.nodeName)
- children_structure += "%s "%childname
+ children_structure += "%s " % childname
result = elements_model.match(children_structure)
if not result:
raise ValueError("Invalid structure for \"%s\" children!. First element invalid." % node.nodeName)
@@ -1099,10 +1099,10 @@
raise ValueError("\"%s\" type is not a simple type!" % attribute["attr_type"])
attrname = attribute["name"]
if attribute["use"] == "optional":
- classmembers["add%s"%attrname] = generateAddMethod(attrname, self, attribute)
- classmembers["delete%s"%attrname] = generateDeleteMethod(attrname)
- classmembers["set%s"%attrname] = generateSetMethod(attrname)
- classmembers["get%s"%attrname] = generateGetMethod(attrname)
+ classmembers["add%s" % attrname] = generateAddMethod(attrname, self, attribute)
+ classmembers["delete%s" % attrname] = generateDeleteMethod(attrname)
+ classmembers["set%s" % attrname] = generateSetMethod(attrname)
+ classmembers["get%s" % attrname] = generateGetMethod(attrname)
else:
raise ValueError("\"%s\" type unrecognized!" % attribute["attr_type"])
attribute["attr_type"] = infos
@@ -1111,7 +1111,7 @@
if element["type"] == CHOICE:
elmtname = element["name"]
choices = ComputeContentChoices(self, name, element)
- classmembers["get%schoices"%elmtname] = generateGetChoicesMethod(element["choices"])
+ classmembers["get%schoices" % elmtname] = generateGetChoicesMethod(element["choices"])
if element["maxOccurs"] == "unbounded" or element["maxOccurs"] > 1:
classmembers["append%sbytype" % elmtname] = generateAppendChoiceByTypeMethod(element["maxOccurs"], self, element["choices"])
classmembers["insert%sbytype" % elmtname] = generateInsertChoiceByTypeMethod(element["maxOccurs"], self, element["choices"])
--- a/xmlclass/xsdschema.py Mon Aug 14 21:31:01 2017 +0300
+++ b/xmlclass/xsdschema.py Mon Aug 14 22:23:17 2017 +0300
@@ -99,7 +99,7 @@
annotation["appinfo"].append((child["source"], child["content"]))
elif child["type"] == "documentation":
if child["source"] is not None:
- text = "(source: %(source)s):\n%(content)s\n\n"%child
+ text = "(source: %(source)s):\n%(content)s\n\n" % child
else:
text = child["content"] + "\n\n"
if not annotation["documentation"].has_key(child["language"]):
@@ -836,7 +836,7 @@
elements_tmp = []
for element in elmtgroup["elements"]:
if not isinstance(element["elmt_type"], (UnicodeType, StringType)) and element["elmt_type"]["type"] == COMPLEXTYPE:
- elmt_type = "%s_%s"%(elmtgroup["name"], element["name"])
+ elmt_type = "%s_%s" % (elmtgroup["name"], element["name"])
if factory.TargetNamespace is not None:
elmt_type = "%s:%s" % (factory.TargetNamespace, elmt_type)
new_element = element.copy()
@@ -2134,7 +2134,7 @@
"basename": "hexBinary",
"extract": GetHexInteger,
"facets": STRING_FACETS,
- "generate": GenerateSimpleTypeXMLText(lambda x: ("%."+str(int(round(len("%X"%x)/2.)*2))+"X")%x),
+ "generate": GenerateSimpleTypeXMLText(lambda x: ("%."+str(int(round(len("%X" % x)/2.)*2))+"X") % x),
"initial": lambda: 0,
"check": lambda x: isinstance(x, (IntType, LongType))
},