# HG changeset patch # User Andrey Skvortsov # Date 1502875265 -10800 # Node ID 6046ffa2280fdba32db152c73f04a8dd0031555e # Parent 45d6f5fba0165e0b1709b68cbe143c47a4a79109 clean-up: fix PEP8 E201 whitespace after '{' diff -r 45d6f5fba016 -r 6046ffa2280f Beremiz_service.py --- a/Beremiz_service.py Wed Aug 16 12:03:46 2017 +0300 +++ b/Beremiz_service.py Wed Aug 16 12:21:05 2017 +0300 @@ -310,7 +310,7 @@ ip_addr = '' if ip_addr is None else ip_addr dlg = ParamsEntryDialog(None, _("Enter the IP of the interface to bind"), defaultValue=ip_addr) dlg.SetTests([(re.compile('\d{1,3}(?:\.\d{1,3}){3}$').match, _("IP is not valid!")), - ( lambda x:len([x for x in x.split(".") if 0 <= int(x) <= 255]) == 4, _("IP is not valid!")) + (lambda x:len([x for x in x.split(".") if 0 <= int(x) <= 255]) == 4, _("IP is not valid!")) ]) if dlg.ShowModal() == wx.ID_OK: self.pyroserver.ip_addr = dlg.GetValue() diff -r 45d6f5fba016 -r 6046ffa2280f ConfigTreeNode.py --- a/ConfigTreeNode.py Wed Aug 16 12:03:46 2017 +0300 +++ b/ConfigTreeNode.py Wed Aug 16 12:21:05 2017 +0300 @@ -323,7 +323,7 @@ # if Name have other components if len(toks) >= 2: # Recurse in order to find the latest object - return CTNInstance._GetChildBySomething( something, toks[1:]) + return CTNInstance._GetChildBySomething(something, toks[1:]) # No sub name -> found return CTNInstance # Not found diff -r 45d6f5fba016 -r 6046ffa2280f PLCGenerator.py --- a/PLCGenerator.py Wed Aug 16 12:03:46 2017 +0300 +++ b/PLCGenerator.py Wed Aug 16 12:21:05 2017 +0300 @@ -1393,7 +1393,7 @@ jump_target = jump.gettargetName() if not pou.hasstep(jump_target): pname = pou.getname() - msg = _("SFC jump in pou \"{a1}\" refers to non-existent SFC step \"{a2}\"").format( a1=pname, a2=jump_target) + msg = _("SFC jump in pou \"{a1}\" refers to non-existent SFC step \"{a2}\"").format(a1=pname, a2=jump_target) raise PLCGenException, msg if jump.connectionPointIn is not None: instances = [] diff -r 45d6f5fba016 -r 6046ffa2280f canfestival/config_utils.py --- a/canfestival/config_utils.py Wed Aug 16 12:03:46 2017 +0300 +++ b/canfestival/config_utils.py Wed Aug 16 12:21:05 2017 +0300 @@ -667,7 +667,7 @@ subentry_infos = slave.GetSubentryInfos(index, subindex) if subentry_infos["type"] != COlocationtype: raise PDOmappingException, _("Invalid type \"{a1}\"-> {a2} != {a3} for location \"{a4}\"").\ - format( a1=location["IEC_TYPE"], a2=COlocationtype, a3=subentry_infos["type"], a4=name) + format(a1=location["IEC_TYPE"], a2=COlocationtype, a3=subentry_infos["type"], a4=name) IECLocations[name] = COlocationtype pointers[(index, subindex)] = name diff -r 45d6f5fba016 -r 6046ffa2280f connectors/WAMP/__init__.py --- a/connectors/WAMP/__init__.py Wed Aug 16 12:03:46 2017 +0300 +++ b/connectors/WAMP/__init__.py Wed Aug 16 12:21:05 2017 +0300 @@ -52,10 +52,12 @@ _WampSession = None print 'WAMP session left' -PLCObjDefaults = { "StartPLC": False, - "GetTraceVariables": ("Broken", None), - "GetPLCstatus": ("Broken", None), - "RemoteExec": (-1, "RemoteExec script failed!")} +PLCObjDefaults = { + "StartPLC": False, + "GetTraceVariables": ("Broken", None), + "GetPLCstatus": ("Broken", None), + "RemoteExec": (-1, "RemoteExec script failed!") +} def WAMP_connector_factory(uri, confnodesroot): diff -r 45d6f5fba016 -r 6046ffa2280f controls/CustomStyledTextCtrl.py --- a/controls/CustomStyledTextCtrl.py Wed Aug 16 12:03:46 2017 +0300 +++ b/controls/CustomStyledTextCtrl.py Wed Aug 16 12:21:05 2017 +0300 @@ -26,19 +26,21 @@ import wx.stc if wx.Platform == '__WXMSW__': - faces = { 'times': 'Times New Roman', - 'mono': 'Courier New', - 'helv': 'Arial', - 'other': 'Comic Sans MS', - 'size': 10, - } + faces = { + 'times': 'Times New Roman', + 'mono': 'Courier New', + 'helv': 'Arial', + 'other': 'Comic Sans MS', + 'size': 10, + } else: - faces = { 'times': 'Times', - 'mono': 'Courier', - 'helv': 'Helvetica', - 'other': 'new century schoolbook', - 'size': 12, - } + faces = { + 'times': 'Times', + 'mono': 'Courier', + 'helv': 'Helvetica', + 'other': 'new century schoolbook', + 'size': 12, + } NAVIGATION_KEYS = [ wx.WXK_END, diff -r 45d6f5fba016 -r 6046ffa2280f editors/ConfTreeNodeEditor.py --- a/editors/ConfTreeNodeEditor.py Wed Aug 16 12:03:46 2017 +0300 +++ b/editors/ConfTreeNodeEditor.py Wed Aug 16 12:21:05 2017 +0300 @@ -37,19 +37,21 @@ from util.BitmapLibrary import GetBitmap if wx.Platform == '__WXMSW__': - faces = { 'times': 'Times New Roman', - 'mono': 'Courier New', - 'helv': 'Arial', - 'other': 'Comic Sans MS', - 'size': 16, - } + faces = { + 'times': 'Times New Roman', + 'mono': 'Courier New', + 'helv': 'Arial', + 'other': 'Comic Sans MS', + 'size': 16, + } else: - faces = { 'times': 'Times', - 'mono': 'Courier', - 'helv': 'Helvetica', - 'other': 'new century schoolbook', - 'size': 18, - } + faces = { + 'times': 'Times', + 'mono': 'Courier', + 'helv': 'Helvetica', + 'other': 'new century schoolbook', + 'size': 18, + } SCROLLBAR_UNIT = 10 diff -r 45d6f5fba016 -r 6046ffa2280f editors/TextViewer.py --- a/editors/TextViewer.py Wed Aug 16 12:03:46 2017 +0300 +++ b/editors/TextViewer.py Wed Aug 16 12:21:05 2017 +0300 @@ -278,8 +278,8 @@ self.RefreshVariableTree() blockinfo = self.Controler.GetBlockType(blocktype, blockinputs, self.Debug) hint = ',\n '.join( - [ " " + fctdecl[0]+" := (*"+fctdecl[1]+"*)" for fctdecl in blockinfo["inputs"]] + - [ " " + fctdecl[0]+" => (*"+fctdecl[1]+"*)" for fctdecl in blockinfo["outputs"]]) + [" " + fctdecl[0]+" := (*"+fctdecl[1]+"*)" for fctdecl in blockinfo["inputs"]] + + [" " + fctdecl[0]+" => (*"+fctdecl[1]+"*)" for fctdecl in blockinfo["outputs"]]) if values[1] == "function": event.SetDragText(blocktype+"(\n "+hint+")") else: diff -r 45d6f5fba016 -r 6046ffa2280f editors/Viewer.py --- a/editors/Viewer.py Wed Aug 16 12:03:46 2017 +0300 +++ b/editors/Viewer.py Wed Aug 16 12:21:05 2017 +0300 @@ -65,19 +65,21 @@ parent.Append(helpString=help, id=id, kind=kind, item=text) if wx.Platform == '__WXMSW__': - faces = { 'times': 'Times New Roman', - 'mono': 'Courier New', - 'helv': 'Arial', - 'other': 'Comic Sans MS', - 'size': 10, - } + faces = { + 'times': 'Times New Roman', + 'mono': 'Courier New', + 'helv': 'Arial', + 'other': 'Comic Sans MS', + 'size': 10, + } else: - faces = { 'times': 'Times', - 'mono': 'Courier', - 'helv': 'Helvetica', - 'other': 'new century schoolbook', - 'size': 12, - } + faces = { + 'times': 'Times', + 'mono': 'Courier', + 'helv': 'Helvetica', + 'other': 'new century schoolbook', + 'size': 12, + } if wx.Platform == '__WXMSW__': MAX_ZOOMIN = 4 diff -r 45d6f5fba016 -r 6046ffa2280f plcopen/structures.py --- a/plcopen/structures.py Wed Aug 16 12:03:46 2017 +0300 +++ b/plcopen/structures.py Wed Aug 16 12:21:05 2017 +0300 @@ -100,7 +100,7 @@ """ take a .csv file and translate it it a "csv_table" """ - return [ map(string.strip, line.split(';')) for line in file.xreadlines()] + return [map(string.strip, line.split(';')) for line in file.xreadlines()] def find_section(section_name, table): @@ -230,7 +230,7 @@ for outype in output_types: if outype is not None: decl_tpl = Function_decl["outputs"][0] - Function_decl["outputs"] = [ (decl_tpl[0], outype, decl_tpl[2])] + Function_decl["outputs"] = [(decl_tpl[0], outype, decl_tpl[2])] if funcdeclname_orig.endswith('*'): funcdeclout = funcdeclin + '_' + outype else: diff -r 45d6f5fba016 -r 6046ffa2280f svgui/svgui_server.py --- a/svgui/svgui_server.py Wed Aug 16 12:03:46 2017 +0300 +++ b/svgui/svgui_server.py Wed Aug 16 12:21:05 2017 +0300 @@ -91,19 +91,21 @@ # Convert objects to a dictionary of their representation attrs = obj.attrs.copy() attrs.update(obj.inputs) - d = { '__class__': obj.classname, - 'id': obj.id, - 'kwargs': json.dumps(attrs), - } + d = { + '__class__': obj.classname, + 'id': obj.id, + 'kwargs': json.dumps(attrs), + } return d def get_object_current_state(obj): # Convert objects to a dictionary of their representation - d = { '__class__': obj.classname, - 'id': obj.id, - 'kwargs': json.dumps(obj.outputs), - } + d = { + '__class__': obj.classname, + 'id': obj.id, + 'kwargs': json.dumps(obj.outputs), + } return d diff -r 45d6f5fba016 -r 6046ffa2280f targets/__init__.py --- a/targets/__init__.py Wed Aug 16 12:03:46 2017 +0300 +++ b/targets/__init__.py Wed Aug 16 12:21:05 2017 +0300 @@ -45,7 +45,7 @@ targets = dict([(name, {"xsd": path.join(_base_path, name, "XSD"), "class": _GetLocalTargetClassFactory(name), - "code": { fname: path.join(_base_path, name, fname) + "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 fname.endswith(".c")}}) diff -r 45d6f5fba016 -r 6046ffa2280f targets/toolchain_makefile.py --- a/targets/toolchain_makefile.py Wed Aug 16 12:03:46 2017 +0300 +++ b/targets/toolchain_makefile.py Wed Aug 16 12:21:05 2017 +0300 @@ -115,7 +115,7 @@ # clean sequence of multiple whitespaces cmd = re.sub(r"[ ]+", " ", target.getCommand().strip()) - command = [ token % beremizcommand for token in cmd.split(' ')] + command = [token % beremizcommand for token in cmd.split(' ')] # Call Makefile to build PLC code and link it with target specific code status, result, err_result = ProcessLogger(self.CTRInstance.logger, diff -r 45d6f5fba016 -r 6046ffa2280f targets/typemapping.py --- a/targets/typemapping.py Wed Aug 16 12:03:46 2017 +0300 +++ b/targets/typemapping.py Wed Aug 16 12:21:05 2017 +0300 @@ -102,8 +102,8 @@ TypeTranslator.get(iectype, (None, None, None)) if c_type is not None and buffoffset < buffsize: - cursor = c_void_p( buffptr + buffoffset) - value = unpack_func( cast(cursor, + cursor = c_void_p(buffptr + buffoffset) + value = unpack_func(cast(cursor, POINTER(c_type)).contents) buffoffset += sizeof(c_type) if iectype != "STRING" else len(value)+1 res.append(value) diff -r 45d6f5fba016 -r 6046ffa2280f util/Zeroconf.py --- a/util/Zeroconf.py Wed Aug 16 12:03:46 2017 +0300 +++ b/util/Zeroconf.py Wed Aug 16 12:21:05 2017 +0300 @@ -154,32 +154,36 @@ # Mapping constants to names -_CLASSES = { _CLASS_IN: "in", - _CLASS_CS: "cs", - _CLASS_CH: "ch", - _CLASS_HS: "hs", - _CLASS_NONE: "none", - _CLASS_ANY: "any"} - -_TYPES = { _TYPE_A: "a", - _TYPE_NS: "ns", - _TYPE_MD: "md", - _TYPE_MF: "mf", - _TYPE_CNAME: "cname", - _TYPE_SOA: "soa", - _TYPE_MB: "mb", - _TYPE_MG: "mg", - _TYPE_MR: "mr", - _TYPE_NULL: "null", - _TYPE_WKS: "wks", - _TYPE_PTR: "ptr", - _TYPE_HINFO: "hinfo", - _TYPE_MINFO: "minfo", - _TYPE_MX: "mx", - _TYPE_TXT: "txt", - _TYPE_AAAA: "quada", - _TYPE_SRV: "srv", - _TYPE_ANY: "any"} +_CLASSES = { + _CLASS_IN: "in", + _CLASS_CS: "cs", + _CLASS_CH: "ch", + _CLASS_HS: "hs", + _CLASS_NONE: "none", + _CLASS_ANY: "any" +} + +_TYPES = { + _TYPE_A: "a", + _TYPE_NS: "ns", + _TYPE_MD: "md", + _TYPE_MF: "mf", + _TYPE_CNAME: "cname", + _TYPE_SOA: "soa", + _TYPE_MB: "mb", + _TYPE_MG: "mg", + _TYPE_MR: "mr", + _TYPE_NULL: "null", + _TYPE_WKS: "wks", + _TYPE_PTR: "ptr", + _TYPE_HINFO: "hinfo", + _TYPE_MINFO: "minfo", + _TYPE_MX: "mx", + _TYPE_TXT: "txt", + _TYPE_AAAA: "quada", + _TYPE_SRV: "srv", + _TYPE_ANY: "any" +} # utility functions