cleanup etherlab: pep8, E231 missing whitespace after ','
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 28 Sep 2018 19:02:49 +0300
changeset 2363 9c7da6ff6a34
parent 2362 6d31ef14f396
child 2364 4ea781f30555
cleanup etherlab: pep8, E231 missing whitespace after ','
etherlab/CommonEtherCATFunction.py
etherlab/ConfigEditor.py
etherlab/EtherCATManagementEditor.py
etherlab/EthercatCIA402Slave.py
etherlab/EthercatMaster.py
etherlab/EthercatSlave.py
etherlab/etherlab.py
etherlab/runtime_etherlab.py
--- a/etherlab/CommonEtherCATFunction.py	Fri Sep 28 18:12:18 2018 +0300
+++ b/etherlab/CommonEtherCATFunction.py	Fri Sep 28 19:02:49 2018 +0300
@@ -491,7 +491,7 @@
             mb = device.getMailbox()
             if mb is not None:
                 for mailbox_protocol in mailbox_protocols:
-                    if getattr(mb,"get%s" % mailbox_protocol)() is not None:
+                    if getattr(mb, "get%s" % mailbox_protocol)() is not None:
                         smartview_infos["supported_mailbox"] += "%s,  " % mailbox_protocol
             smartview_infos["supported_mailbox"] = smartview_infos["supported_mailbox"].strip(",  ")
 
@@ -785,8 +785,8 @@
             data = 0
             mb = device.getMailbox()
             if mb is not None :
-                for bit,mbprot in enumerate(mailbox_protocols):
-                    if getattr(mb,"get%s" % mbprot)() is not None:
+                for bit, mbprot in enumerate(mailbox_protocols):
+                    if getattr(mb, "get%s" % mbprot)() is not None:
                         data += 1<<bit
             data = "{:0>4x}".format(data)
             eeprom.append(data[2:4])
@@ -1181,9 +1181,9 @@
         if mb is not None :
             coe = mb.getCoE()
             if coe is not None:
-                for bit,flag in enumerate(["SdoInfo", "PdoAssign", "PdoConfig",
+                for bit, flag in enumerate(["SdoInfo", "PdoAssign", "PdoConfig",
                                            "PdoUpload", "CompleteAccess"]):
-                    if getattr(coe,"get%s" % flag)() is not None:
+                    if getattr(coe, "get%s" % flag)() is not None:
                         coe_details += 1<<bit
         eeprom.append("{:0>2x}".format(coe_details))
 
@@ -1211,7 +1211,7 @@
             coe = mb.getCoE()
             if coe is not None :
                 ds402ch = coe.getDS402Channels()
-        eeprom.append("01" if ds402ch in [True,1] else "00")
+        eeprom.append("01" if ds402ch in [True, 1] else "00")
 
         # word 6 : SysmanClass(reserved) and Flags
         eeprom.append("00")  # reserved
@@ -1306,7 +1306,7 @@
         """
         eeprom = []
         data = ""
-        number = {"MBoxOut":"01", "MBoxIn":"02", "Outputs":"03", "Inputs":"04"}
+        number = {"MBoxOut": "01", "MBoxIn": "02", "Outputs": "03", "Inputs": "04"}
 
         for sm in device.getSm():
             for attr in [sm.getStartAddress(),
--- a/etherlab/ConfigEditor.py	Fri Sep 28 18:12:18 2018 +0300
+++ b/etherlab/ConfigEditor.py	Fri Sep 28 19:02:49 2018 +0300
@@ -237,7 +237,7 @@
                     else:
                         dir = "%Q"
                     location = "%s%s" % (dir, data_size) + \
-                               ".".join(map(lambda x:str(x), location + (entry_index, entry_subindex)))
+                               ".".join(map(lambda x: str(x), location + (entry_index, entry_subindex)))
 
                     data = wx.TextDataObject(str((location, "location", data_type, var_name, "", access)))
                     dragSource = wx.DropSource(self.VariablesGrid)
@@ -995,7 +995,7 @@
             data_size = self.Controler.GetSizeOfType(var_type)
             number = self.ProcessVariablesTable.GetValueByName(row, "Number")
             location = "%%M%s" % data_size + \
-                       ".".join(map(lambda x:str(x), self.Controler.GetCurrentLocation() + (number,)))
+                       ".".join(map(lambda x: str(x), self.Controler.GetCurrentLocation() + (number,)))
 
             data = wx.TextDataObject(str((location, "location", var_type, var_name, "")))
             dragSource = wx.DropSource(self.ProcessVariablesGrid)
--- a/etherlab/EtherCATManagementEditor.py	Fri Sep 28 18:12:18 2018 +0300
+++ b/etherlab/EtherCATManagementEditor.py	Fri Sep 28 19:02:49 2018 +0300
@@ -145,7 +145,7 @@
 
         self.SizerDic["SlaveInfosDetailsBox"].AddSizer(self.SizerDic["SlaveInfosDetailsInnerSizer"])
 
-        self.SyncManagersGrid = CustomGrid(self, size=wx.Size(605,155), style=wx.VSCROLL)
+        self.SyncManagersGrid = CustomGrid(self, size=wx.Size(605, 155), style=wx.VSCROLL)
 
         self.SizerDic["SyncManagerInnerSizer"].Add(self.SyncManagersGrid)
         self.SizerDic["SyncManagerBox"].Add(self.SizerDic["SyncManagerInnerSizer"])
@@ -157,7 +157,7 @@
                 ("SafeOPButton", 2, "SAFEOP", "State Transition to \"SafeOP\" State", self.OnButtonClick, []),
                 ("OPButton",     3, "OP",  "State Transition to \"OP\" State",        self.OnButtonClick, [
                         ("CurrentStateLabel", "Current State:", "CurrentState")])]:
-            self.ButtonDic[button_name] = wx.Button(self, id=button_id ,label=_(button_label))
+            self.ButtonDic[button_name] = wx.Button(self, id=button_id, label=_(button_label))
             self.ButtonDic[button_name].Bind(wx.EVT_BUTTON, event_method)
             self.ButtonDic[button_name].SetToolTipString(button_tooltipstring)
             self.SizerDic["SlaveState_up_sizer"].Add(self.ButtonDic[button_name])
@@ -419,9 +419,9 @@
                     hex_val = ' ---- '
 
                 # SResult of SlaveSDO data parsing. (data type : dictionary)
-                self.Data = {'idx':idx.strip(), 'subIdx':sub_idx.strip(), 'access':access.strip(),
-                             'type':type.strip(), 'size':size.strip(),  'name':name_after_check.strip("\""),
-                             'value':hex_val.strip(), "category":title_name.strip("\"")}
+                self.Data = {'idx': idx.strip(), 'subIdx': sub_idx.strip(), 'access': access.strip(),
+                             'type': type.strip(), 'size': size.strip(),  'name': name_after_check.strip("\""),
+                             'value': hex_val.strip(), "category": title_name.strip("\"")}
 
                 category_divide_value = [0x1000, 0x2000, 0x6000, 0xa000, 0xffff]
 
@@ -473,7 +473,7 @@
         @param parent: Reference to the parent SDOPanelClass class
         @param controler: _EthercatSlaveCTN class in EthercatSlave.py
         """
-        wx.Notebook.__init__(self, parent, id = -1, size=(850,500))
+        wx.Notebook.__init__(self, parent, id = -1, size=(850, 500))
         self.Controler = controler
         self.parent = parent
 
@@ -534,7 +534,7 @@
         @param parent: Reference to the parent SDOPanelClass class
         @param data: SDO data after parsing "SDOParser" method
         """
-        wx.grid.Grid.__init__(self, parent, -1, size=(830,490),
+        wx.grid.Grid.__init__(self, parent, -1, size=(830, 490),
                               style=wx.EXPAND|wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
 
         self.Controler = parent.Controler
@@ -568,7 +568,7 @@
         self.Bind(gridlib.EVT_GRID_CELL_LEFT_DCLICK, self.SDOModifyDialog)
 
         for i in range(7):
-            self.SetColAttr(i,attr)
+            self.SetColAttr(i, attr)
 
         self.SetColLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER)
 
@@ -808,7 +808,7 @@
         @param entry : data structure including index, name, entry number
         @param count : page number
         """
-        wx.grid.Grid.__init__(self, parent, -1, size=(500, 400), pos=wx.Point(0,0),
+        wx.grid.Grid.__init__(self, parent, -1, size=(500, 400), pos=wx.Point(0, 0),
                               style=wx.EXPAND|wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
 
         self.Controler = parent.Controler
@@ -880,7 +880,7 @@
         @param controler: _EthercatSlaveCTN class in EthercatSlave.py
         """
         wx.Panel.__init__(self, parent, -1)
-        sizer = wx.FlexGridSizer(cols=1, hgap=20,rows=3, vgap=20)
+        sizer = wx.FlexGridSizer(cols=1, hgap=20, rows=3, vgap=20)
 
         line = wx.StaticText(self, -1, "\n  EEPROM Access is composed to SmartView and HexView. \
                                               \n\n   - SmartView shows Config Data, Device Identity, Mailbox settings, etc. \
@@ -905,21 +905,22 @@
         self.parent = parent
         self.Controler = controler
 
-        self.PDIType = {0  :['none', '00000000'],
-                        4  :['Digital I/O', '00000100'],
-                        5  :['SPI Slave', '00000101'],
-                        7  :['EtherCAT Bridge (port3)', '00000111'],
-                        8  :['uC async. 16bit', '00001000'],
-                        9  :['uC async. 8bit', '00001001'],
-                        10 :['uC sync. 16bit', '00001010'],
-                        11 :['uC sync. 8bit', '00001011'],
-                        16 :['32 Digtal Input and 0 Digital Output', '00010000'],
-                        17 :['24 Digtal Input and 8 Digital Output', '00010001'],
-                        18 :['16 Digtal Input and 16 Digital Output','00010010'],
-                        19 :['8 Digtal Input and 24 Digital Output', '00010011'],
-                        20 :['0 Digtal Input and 32 Digital Output', '00010100'],
-                        128:['On-chip bus', '11111111']
-                        }
+        self.PDIType = {
+            0  : ['none', '00000000'],
+            4  : ['Digital I/O', '00000100'],
+            5  : ['SPI Slave', '00000101'],
+            7  : ['EtherCAT Bridge (port3)', '00000111'],
+            8  : ['uC async. 16bit', '00001000'],
+            9  : ['uC async. 8bit', '00001001'],
+            10 : ['uC sync. 16bit', '00001010'],
+            11 : ['uC sync. 8bit', '00001011'],
+            16 : ['32 Digtal Input and 0 Digital Output', '00010000'],
+            17 : ['24 Digtal Input and 8 Digital Output', '00010001'],
+            18 : ['16 Digtal Input and 16 Digital Output', '00010010'],
+            19 : ['8 Digtal Input and 24 Digital Output', '00010011'],
+            20 : ['0 Digtal Input and 32 Digital Output', '00010100'],
+            128: ['On-chip bus', '11111111']
+        }
 
         sizer = wx.FlexGridSizer(cols=1, hgap=5, rows=2, vgap=5)
         button_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=1, vgap=5)
@@ -960,7 +961,7 @@
                 if dialog.ShowModal() == wx.ID_OK:
                     filepath = dialog.GetPath()
                     try:
-                        binfile = open(filepath,"rb")
+                        binfile = open(filepath, "rb")
                         self.SiiBinary = binfile.read()
                         dialog.Destroy()
 
@@ -991,7 +992,7 @@
 
             if dialog.ShowModal() == wx.ID_OK:
                 filepath = dialog.GetPath()
-                binfile = open(filepath,"wb")
+                binfile = open(filepath, "wb")
                 binfile.write(self.SiiBinary)
                 binfile.close()
 
@@ -1080,15 +1081,15 @@
 
         # Config Data: EEPROM Size, PDI Type, Device Emulation
         # EEPROM's data in address '0x003f' is Size of EEPROM in KBit-1
-        eeprom_size = str((int(self.GetWordAddressData( sii_dict.get('Size'),10 ))+1)/8*1024)
+        eeprom_size = str((int(self.GetWordAddressData( sii_dict.get('Size'), 10 ))+1)/8*1024)
         # Find PDI Type in pdiType dictionary
-        cnt_pdi_type = int(self.GetWordAddressData( sii_dict.get('PDIControl'),16 ).split('x')[1][2:4], 16)
+        cnt_pdi_type = int(self.GetWordAddressData( sii_dict.get('PDIControl'), 16 ).split('x')[1][2:4], 16)
         for i in self.PDIType.keys():
             if cnt_pdi_type == i:
                 cnt_pdi_type = self.PDIType[i][0]
                 break
         #  Get Device Emulation
-        device_emulation = str(bool(int("{:0>16b}".format(int(self.GetWordAddressData( sii_dict.get('PDIControl'),16 ), 16))[7])))
+        device_emulation = str(bool(int("{:0>16b}".format(int(self.GetWordAddressData( sii_dict.get('PDIControl'), 16 ), 16))[7])))
         #  Set Config Data
         for treelist, data in [("EEPROM Size (Bytes)", eeprom_size),
                                ("PDI Type", cnt_pdi_type),
@@ -1097,10 +1098,11 @@
 
         # Device Identity: Vendor ID, Product Code, Revision No., Serial No.
         #  Set Device Identity
-        for treelist, data in [("Vendor ID", self.GetWordAddressData( sii_dict.get('VendorID'),16 )),
-                               ("Product Code", self.GetWordAddressData( sii_dict.get('ProductCode'),16 )),
-                               ("Revision No.", self.GetWordAddressData( sii_dict.get('RevisionNumber'),16 )),
-                               ("Serial No.", self.GetWordAddressData( sii_dict.get('SerialNumber'),16 ))]:
+        for treelist, data in [
+                ("Vendor ID", self.GetWordAddressData( sii_dict.get('VendorID'), 16 )),
+                ("Product Code", self.GetWordAddressData( sii_dict.get('ProductCode'), 16 )),
+                ("Revision No.", self.GetWordAddressData( sii_dict.get('RevisionNumber'), 16 )),
+                ("Serial No.", self.GetWordAddressData( sii_dict.get('SerialNumber'), 16 ))]:
             self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.DeviceIdentity[treelist], data, 1)
 
         # Mailbox
@@ -1109,7 +1111,7 @@
         # VoE(0x0020), SoE(0x0010), FoE(0x0008), CoE(0x0004), EoE(0x0002), AoE(0x0001)
         supported_mailbox = ""
         mailbox_protocol=["VoE,  ", "SoE,  ", "FoE,  ", "CoE,  ", "EoE,  ", "AoE,  "]
-        mailbox_data = "{:0>8b}".format(int(self.GetWordAddressData( sii_dict.get('MailboxProtocol'),16 ), 16))
+        mailbox_data = "{:0>8b}".format(int(self.GetWordAddressData( sii_dict.get('MailboxProtocol'), 16 ), 16))
         for protocol in range(6):
             if mailbox_data[protocol+2] == '1':
                 supported_mailbox += mailbox_protocol[protocol]
@@ -1120,16 +1122,18 @@
                                ("Standard Configuration", "")]:
             self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.Mailbox[treelist], data, 1)
         #  Set Bootstrap Configuration: Receive Offset, Receive Size, Send Offset, Send Size
-        for treelist, data in [("Receive Offset", self.GetWordAddressData( sii_dict.get('BootstrapReceiveMailboxOffset'),10 )),
-                               ("Receive Size", self.GetWordAddressData( sii_dict.get('BootstrapReceiveMailboxSize'),10 )),
-                               ("Send Offset", self.GetWordAddressData( sii_dict.get('BootstrapSendMailboxOffset'),10 )),
-                               ("Send Size", self.GetWordAddressData( sii_dict.get('BootstrapSendMailboxSize'),10 ))]:
+        for treelist, data in [
+                ("Receive Offset", self.GetWordAddressData( sii_dict.get('BootstrapReceiveMailboxOffset'), 10 )),
+                ("Receive Size", self.GetWordAddressData( sii_dict.get('BootstrapReceiveMailboxSize'), 10 )),
+                ("Send Offset", self.GetWordAddressData( sii_dict.get('BootstrapSendMailboxOffset'), 10 )),
+                ("Send Size", self.GetWordAddressData( sii_dict.get('BootstrapSendMailboxSize'), 10 ))]:
             self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.BootstrapConfig[treelist], data, 1)
         #  Set Standard Configuration: Receive Offset, Receive Size, Send Offset, Send Size
-        for treelist, data in [("Receive Offset", self.GetWordAddressData( sii_dict.get('StandardReceiveMailboxOffset'),10 )),
-                               ("Receive Size", self.GetWordAddressData( sii_dict.get('StandardReceiveMailboxSize'),10 )),
-                               ("Send Offset", self.GetWordAddressData( sii_dict.get('StandardSendMailboxOffset'),10 )),
-                               ("Send Size", self.GetWordAddressData( sii_dict.get('StandardSendMailboxSize'),10 ))]:
+        for treelist, data in [
+                ("Receive Offset", self.GetWordAddressData( sii_dict.get('StandardReceiveMailboxOffset'), 10 )),
+                ("Receive Size", self.GetWordAddressData( sii_dict.get('StandardReceiveMailboxSize'), 10 )),
+                ("Send Offset", self.GetWordAddressData( sii_dict.get('StandardSendMailboxOffset'), 10 )),
+                ("Send Size", self.GetWordAddressData( sii_dict.get('StandardSendMailboxSize'), 10 ))]:
             self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.StandardConfig[treelist], data, 1)
 
     def MakeStaticBoxSizer(self, boxlabel):
@@ -1333,7 +1337,7 @@
 
         if dialog.ShowModal() == wx.ID_OK:
             filepath = dialog.GetPath()
-            binfile = open(filepath,"wb")
+            binfile = open(filepath, "wb")
             binfile.write(self.SiiBinary)
             binfile.close()
 
@@ -1392,7 +1396,7 @@
         self.Row = row
         self.Col = col
 
-        wx.grid.Grid.__init__(self, parent, -1, size=(830,450),
+        wx.grid.Grid.__init__(self, parent, -1, size=(830, 450),
                               style=wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
 
     def SetValue(self, value):
@@ -1508,7 +1512,7 @@
 
         # store previous value
         # (ESC type, port number of FMMU, port number of SM, and PDI type))
-        for reg_spec in ["ESCType","FMMUNumber","SMNumber", "PDIType"]:
+        for reg_spec in ["ESCType", "FMMUNumber", "SMNumber", "PDIType"]:
             self.PreRegSpec[reg_spec] = self.Controler.CommonMethod.CrtRegSpec[reg_spec]
 
         # update registers' description
@@ -1918,7 +1922,7 @@
         self.Controler = controler
         self.RegisterAccessPanel = self.parent.parent.parent
 
-        wx.grid.Grid.__init__(self, parent, -1, size=(820,300),
+        wx.grid.Grid.__init__(self, parent, -1, size=(820, 300),
                               style=wx.EXPAND|wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
 
         for evt, mapping_method in [(gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell),
@@ -2066,7 +2070,7 @@
         self.Row = row
         self.Col = col
 
-        wx.grid.Grid.__init__(self, parent, -1, size=(820,150),
+        wx.grid.Grid.__init__(self, parent, -1, size=(820, 150),
                               style=wx.EXPAND|wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
 
     def SetValue(self, parent, data):
--- a/etherlab/EthercatCIA402Slave.py	Fri Sep 28 18:12:18 2018 +0300
+++ b/etherlab/EthercatCIA402Slave.py	Fri Sep 28 19:02:49 2018 +0300
@@ -192,7 +192,7 @@
     def CTNGenerate_C(self, buildpath, locations):
         current_location = self.GetCurrentLocation()
 
-        location_str = "_".join(map(lambda x:str(x), current_location))
+        location_str = "_".join(map(lambda x: str(x), current_location))
         slave_pos = self.GetSlavePos()
         MCL_headers = Headers
 
@@ -331,4 +331,4 @@
         cia402nodefile.write(plc_cia402node_code % locals())
         cia402nodefile.close()
 
-        return [(Gen_CIA402Nodefile_path, '"-I%s"' % os.path.abspath(self.GetCTRoot().GetIECLibPath()))],"",True
+        return [(Gen_CIA402Nodefile_path, '"-I%s"' % os.path.abspath(self.GetCTRoot().GetIECLibPath()))], "", True
--- a/etherlab/EthercatMaster.py	Fri Sep 28 18:12:18 2018 +0300
+++ b/etherlab/EthercatMaster.py	Fri Sep 28 19:02:49 2018 +0300
@@ -83,7 +83,7 @@
         etherlab_ext_file.close()
 
         Gen_etherlabfile_path = os.path.join(buildpath, "etherlab_ext.c")
-        ethelabfile = open(Gen_etherlabfile_path,'w')
+        ethelabfile = open(Gen_etherlabfile_path, 'w')
         ethelabfile.write(etherlab_ext_code)
         ethelabfile.close()
 
@@ -462,7 +462,7 @@
                     type_infos = {
                         "vendor": slave["vendor_id"],
                         "product_code": slave["product_code"],
-                        "revision_number":slave["revision_number"],
+                        "revision_number": slave["revision_number"],
                     }
                     device, module_extra_params = self.GetModuleInfos(type_infos)
                     if device is not None:
@@ -678,7 +678,7 @@
     def OnCTNSave(self, from_project_path=None):
         config_filepath = self.ConfigFileName()
 
-        config_xmlfile = open(config_filepath,"w")
+        config_xmlfile = open(config_filepath, "w")
         config_xmlfile.write(etree.tostring(
             self.Config,
             pretty_print=True,
@@ -688,7 +688,7 @@
 
         process_filepath = self.ProcessVariablesFileName()
 
-        process_xmlfile = open(process_filepath,"w")
+        process_xmlfile = open(process_filepath, "w")
         process_xmlfile.write(etree.tostring(
             self.ProcessVariables,
             pretty_print=True,
@@ -705,7 +705,7 @@
     def _Generate_C(self, buildpath, locations):
         current_location = self.GetCurrentLocation()
         # define a unique name for the generated C file
-        location_str = "_".join(map(lambda x:str(x), current_location))
+        location_str = "_".join(map(lambda x: str(x), current_location))
 
         Gen_Ethercatfile_path = os.path.join(buildpath, "ethercat_%s.c" % location_str)
 
@@ -771,7 +771,7 @@
                 self.FileGenerator.DeclareVariable(
                     slave_pos, loc[1], loc[2], location["IEC_TYPE"], location["DIR"], location["NAME"])
 
-        return [],"",False
+        return [], "", False
 
 # -------------------------------------------------------------------------------
 #                      Current Buffering Management Functions
--- a/etherlab/EthercatSlave.py	Fri Sep 28 18:12:18 2018 +0300
+++ b/etherlab/EthercatSlave.py	Fri Sep 28 19:02:49 2018 +0300
@@ -160,4 +160,4 @@
         }
 
     def CTNGenerate_C(self, buildpath, locations):
-        return [],"",False
+        return [], "", False
--- a/etherlab/etherlab.py	Fri Sep 28 18:12:18 2018 +0300
+++ b/etherlab/etherlab.py	Fri Sep 28 19:02:49 2018 +0300
@@ -393,7 +393,7 @@
 
 class RootClass:
 
-    CTNChildrenTypes = [("EthercatNode",_EthercatCTN,"Ethercat Master")]
+    CTNChildrenTypes = [("EthercatNode", _EthercatCTN, "Ethercat Master")]
     EditorType = LibraryEditor
 
 
@@ -416,7 +416,7 @@
         return True
 
     def CTNGenerate_C(self, buildpath, locations):
-        return [],"",False
+        return [], "", False
 
     def LoadModulesLibrary(self):
         if self.ModulesLibrary is None:
--- a/etherlab/runtime_etherlab.py	Fri Sep 28 18:12:18 2018 +0300
+++ b/etherlab/runtime_etherlab.py	Fri Sep 28 19:02:49 2018 +0300
@@ -47,7 +47,7 @@
     if res != 0 :
         PLCObject.LogMessage(
             LogLevelsDict["WARNING"],
-            "%s : %s" % (command,output))
+            "%s : %s" % (command, output))
 
 
 def EthercatSDOUpload(pos, index, subindex, var_type):
@@ -85,19 +85,19 @@
     s=ctypes.create_string_buffer(4*1024)
     last = None
     while not StopKMSGThread:
-        l = klog(3,s,len(s)-1)
+        l = klog(3, s, len(s)-1)
         log = s.value[:l-1]
         if last :
             log = log.rpartition(last)[2]
         if log :
             last = log.rpartition('\n')[2]
-            for lvl,msg in re.findall(
+            for lvl, msg in re.findall(
                             r'<(\d)>\[\s*\d*\.\d*\]\s*(EtherCAT\s*.*)$',
                             log, re.MULTILINE):
                 PLCObject.LogMessage(
                     LogLevelsDict[{
-                        "4":"WARNING",
-                        "3":"CRITICAL"}.get(lvl,"DEBUG")],
+                        "4": "WARNING",
+                        "3": "CRITICAL"}.get(lvl, "DEBUG")],
                     msg)
         time.sleep(0.5)