# HG changeset patch # User Andrey Skvortsov # Date 1503151471 -10800 # Node ID c46ec818bdd7ad95d8a2bbf0704ae13a3480acfb # Parent 81aa8aaccdd41176398433477ad1b55650c41699 clean-up: fix PEP8 E131 continuation line unaligned for hanging indent diff -r 81aa8aaccdd4 -r c46ec818bdd7 PLCControler.py --- a/PLCControler.py Sat Aug 19 16:45:37 2017 +0300 +++ b/PLCControler.py Sat Aug 19 17:04:31 2017 +0300 @@ -1753,9 +1753,9 @@ datatypes.extend([ datatype.getname() for datatype in project.getdataTypes(name) - if (not only_locatables or self.IsLocatableDataType(datatype, debug)) + if ((not only_locatables or self.IsLocatableDataType(datatype, debug)) and (name is None or - len(self.GetInstanceList(datatype, name, debug)) == 0)]) + len(self.GetInstanceList(datatype, name, debug)) == 0))]) if confnodetypes: for category in self.GetConfNodeDataTypes(name, only_locatables): datatypes.extend(category["list"]) diff -r 81aa8aaccdd4 -r c46ec818bdd7 ProjectController.py --- a/ProjectController.py Sat Aug 19 16:45:37 2017 +0300 +++ b/ProjectController.py Sat Aug 19 17:04:31 2017 +0300 @@ -983,21 +983,21 @@ "}"] 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]), - "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 - for v in self._VariablesList if v["C_path"].find('.') < 0]), - "variable_decl_array": ",\n".join(variable_decl_array) - } + "buffer_size": bofs, + "programs_declarations": "\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 + for v in self._VariablesList if v["C_path"].find('.') < 0]), + "variable_decl_array": ",\n".join(variable_decl_array) + } return debug_code diff -r 81aa8aaccdd4 -r c46ec818bdd7 controls/DebugVariablePanel/DebugVariableGraphicViewer.py --- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Sat Aug 19 16:45:37 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Sat Aug 19 17:04:31 2017 +0300 @@ -1089,7 +1089,7 @@ canvas_ratio = 1. / height # Divide by canvas height in pixel graph_ratio = 1. / ( (1.0 - (CANVAS_BORDER[0] + CANVAS_BORDER[1]) * canvas_ratio) - * height) # Divide by figure height in pixel + * height) # Divide by figure height in pixel # Update position of figure (keeping up and bottom border the same # size) diff -r 81aa8aaccdd4 -r c46ec818bdd7 graphics/GraphicCommons.py --- a/graphics/GraphicCommons.py Sat Aug 19 16:45:37 2017 +0300 +++ b/graphics/GraphicCommons.py Sat Aug 19 17:04:31 2017 +0300 @@ -1088,11 +1088,12 @@ self.ValueSize = self.ParentBlock.Parent.GetMiniTextExtent(self.ComputedValue) if self.ValueSize is not None: width, height = self.ValueSize - rect = rect.Union(wx.Rect( + rect = rect.Union( + wx.Rect( parent_pos[0] + self.Pos.x + CONNECTOR_SIZE * self.Direction[0] + - width * (self.Direction[0] - 1) / 2, + width * (self.Direction[0] - 1) / 2, parent_pos[1] + self.Pos.y + CONNECTOR_SIZE * self.Direction[1] + - height * (self.Direction[1] - 1), + height * (self.Direction[1] - 1), width, height)) return rect diff -r 81aa8aaccdd4 -r c46ec818bdd7 plcopen/plcopen.py --- a/plcopen/plcopen.py Sat Aug 19 16:45:37 2017 +0300 +++ b/plcopen/plcopen.py Sat Aug 19 17:04:31 2017 +0300 @@ -466,10 +466,10 @@ def getpous(self, exclude=None, filter=[]): return self.xpath( "ppx:types/ppx:pous/ppx:pou%s%s" % - (("[@name!='%s']" % exclude) if exclude is not None else '', - ("[%s]" % " or ".join( - map(lambda x: "@pouType='%s'" % x, filter))) - if len(filter) > 0 else ""), + (("[@name!='%s']" % exclude) if exclude is not None else '', + ("[%s]" % " or ".join( + map(lambda x: "@pouType='%s'" % x, filter))) + if len(filter) > 0 else ""), namespaces=PLCOpenParser.NSMAP) setattr(cls, "getpous", getpous) diff -r 81aa8aaccdd4 -r c46ec818bdd7 py_ext/PythonFileCTNMixin.py --- a/py_ext/PythonFileCTNMixin.py Sat Aug 19 16:45:37 2017 +0300 +++ b/py_ext/PythonFileCTNMixin.py Sat Aug 19 17:04:31 2017 +0300 @@ -101,19 +101,19 @@ pyextname = self.CTNName() varinfos = map(lambda variable: { - "name": variable.getname(), - "desc": repr(variable.getdesc()), - "onchangecode": '"' + variable.getonchange() + - "('" + variable.getname() + "')\"" - if variable.getonchange() else '""', - "onchange": repr(variable.getonchange()) - if variable.getonchange() else None, - "opts": repr(variable.getopts()), - "configname": configname.upper(), - "uppername": variable.getname().upper(), - "IECtype": variable.gettype(), - "pyextname": pyextname}, - self.CodeFile.variables.variable) + "name": variable.getname(), + "desc": repr(variable.getdesc()), + "onchangecode": '"' + variable.getonchange() + + "('" + variable.getname() + "')\"" + if variable.getonchange() else '""', + "onchange": repr(variable.getonchange()) + if variable.getonchange() else None, + "opts": repr(variable.getopts()), + "configname": configname.upper(), + "uppername": variable.getname().upper(), + "IECtype": variable.gettype(), + "pyextname": pyextname}, + self.CodeFile.variables.variable) # python side PLC global variables access stub globalstubs = "\n".join([ """\ diff -r 81aa8aaccdd4 -r c46ec818bdd7 targets/toolchain_gcc.py --- a/targets/toolchain_gcc.py Sat Aug 19 16:45:37 2017 +0300 +++ b/targets/toolchain_gcc.py Sat Aug 19 17:04:31 2017 +0300 @@ -185,10 +185,10 @@ self.CTRInstance.logger.write(" [CC] "+bn+" -> "+obn+"\n") status, result, err_result = ProcessLogger( - self.CTRInstance.logger, - "\"%s\" -c \"%s\" -o \"%s\" %s %s" % - (self.compiler, CFile, objectfilename, Builder_CFLAGS, CFLAGS) - ).spin() + self.CTRInstance.logger, + "\"%s\" -c \"%s\" -o \"%s\" %s %s" % + (self.compiler, CFile, objectfilename, Builder_CFLAGS, CFLAGS) + ).spin() if status: self.srcmd5.pop(bn) @@ -214,13 +214,13 @@ self.CTRInstance.logger.write(" [CC] " + ' '.join(obns)+" -> " + self.exe + "\n") status, result, err_result = ProcessLogger( - self.CTRInstance.logger, - "\"%s\" %s -o \"%s\" %s" % - (self.linker, - listobjstring, - self.exe_path, - ALLldflags) - ).spin() + self.CTRInstance.logger, + "\"%s\" %s -o \"%s\" %s" % + (self.linker, + listobjstring, + self.exe_path, + ALLldflags) + ).spin() if status: return False diff -r 81aa8aaccdd4 -r c46ec818bdd7 xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Sat Aug 19 16:45:37 2017 +0300 +++ b/xmlclass/xmlclass.py Sat Aug 19 17:04:31 2017 +0300 @@ -1371,8 +1371,8 @@ if element_idx > 0: previous_elements_xpath = "|".join(map( lambda x: prefix + x - if x != "content" - else elements["content"]["elmt_type"]["choices_xpath"].path, + if x != "content" + else elements["content"]["elmt_type"]["choices_xpath"].path, elements.keys()[:element_idx])) insertion_point = len(self.xpath(previous_elements_xpath, namespaces=factory.NSMAP))