cleanup etherlab: pep8, E251 unexpected spaces around keyword / parameter equals
--- a/etherlab/CommonEtherCATFunction.py Fri Sep 28 19:12:26 2018 +0300
+++ b/etherlab/CommonEtherCATFunction.py Fri Sep 28 19:16:12 2018 +0300
@@ -194,7 +194,7 @@
"""
# exectute "ethercat master" command
- error, return_val = self.Controler.RemoteExec(MASTER_STATE, return_val = None)
+ error, return_val = self.Controler.RemoteExec(MASTER_STATE, return_val=None)
master_state = {}
# parse the reslut
for each_line in return_val.splitlines():
@@ -219,7 +219,7 @@
Command example : "ethercat states -p 0 PREOP" (target slave position and target state are given.)
@param command : target slave state
"""
- error, return_val = self.Controler.RemoteExec(SLAVE_STATE % (self.Controler.GetSlavePos(), command), return_val = None)
+ error, return_val = self.Controler.RemoteExec(SLAVE_STATE % (self.Controler.GetSlavePos(), command), return_val=None)
def GetSlaveStateFromSlave(self):
"""
@@ -227,7 +227,7 @@
(self.SlaveState) for "Slave State"
return_val example : 0 0:0 PREOP + EL9800 (V4.30) (PIC24, SPI, ET1100)
"""
- error, return_val = self.Controler.RemoteExec(GET_SLAVE, return_val = None)
+ error, return_val = self.Controler.RemoteExec(GET_SLAVE, return_val=None)
self.SlaveState = return_val
return return_val
@@ -240,7 +240,7 @@
Command example : "ethercat sdos -p 0"
@return return_val : execution results of "ethercat sdos" command (need to be parsed later)
"""
- error, return_val = self.Controler.RemoteExec(SLAVE_SDO % (self.Controler.GetSlavePos()), return_val = None)
+ error, return_val = self.Controler.RemoteExec(SLAVE_SDO % (self.Controler.GetSlavePos()), return_val=None)
return return_val
def SDODownload(self, data_type, idx, sub_idx, value):
@@ -252,7 +252,7 @@
@param sub_idx : subindex of the SDO entry
@param value : value of SDO entry
"""
- error, return_val = self.Controler.RemoteExec(SDO_DOWNLOAD % (data_type, self.Controler.GetSlavePos(), idx, sub_idx, value), return_val = None)
+ error, return_val = self.Controler.RemoteExec(SDO_DOWNLOAD % (data_type, self.Controler.GetSlavePos(), idx, sub_idx, value), return_val=None)
def BackupSDODataSet(self):
"""
@@ -557,7 +557,7 @@
Command example : "ethercat sii_read -p 0"
@return return_val : result of "ethercat sii_read" (binary data)
"""
- error, return_val = self.Controler.RemoteExec(SII_READ % (self.Controler.GetSlavePos()), return_val = None)
+ error, return_val = self.Controler.RemoteExec(SII_READ % (self.Controler.GetSlavePos()), return_val=None)
self.SiiData = return_val
return return_val
@@ -568,7 +568,7 @@
@param binary : EEPROM contents in binary data format
@return return_val : result of "ethercat sii_write" (If it succeeds, the return value is NULL.)
"""
- error, return_val = self.Controler.RemoteExec(SII_WRITE % (self.Controler.GetSlavePos()), return_val = None, sii_data = binary)
+ error, return_val = self.Controler.RemoteExec(SII_WRITE % (self.Controler.GetSlavePos()), return_val=None, sii_data=binary)
return return_val
def LoadData(self):
@@ -1533,7 +1533,7 @@
@param length : register length
@return return_val : register data
"""
- error, return_val = self.Controler.RemoteExec(REG_READ % (self.Controler.GetSlavePos(), offset, length), return_val = None)
+ error, return_val = self.Controler.RemoteExec(REG_READ % (self.Controler.GetSlavePos(), offset, length), return_val=None)
return return_val
def RegWrite(self, address, data):
@@ -1544,7 +1544,7 @@
@param data : data to write
@return return_val : the execution result of "ethercat reg_write" (for error check)
"""
- error, return_val = self.Controler.RemoteExec(REG_WRITE % (self.Controler.GetSlavePos(), address, data), return_val = None)
+ error, return_val = self.Controler.RemoteExec(REG_WRITE % (self.Controler.GetSlavePos(), address, data), return_val=None)
return return_val
def Rescan(self):
@@ -1552,7 +1552,7 @@
Synchronize EEPROM data in master controller with the data in slave device after EEPROM write.
Command example : "ethercat rescan -p 0"
"""
- error, return_val = self.Controler.RemoteExec(RESCAN % (self.Controler.GetSlavePos()), return_val = None)
+ error, return_val = self.Controler.RemoteExec(RESCAN % (self.Controler.GetSlavePos()), return_val=None)
# -------------------------------------------------------------------------------
# Common Use Methods
@@ -1566,7 +1566,7 @@
if self.Controler.GetCTRoot()._connector is not None:
# Check connection between the master and the slave.
# Command example : "ethercat xml -p 0"
- error, return_val = self.Controler.RemoteExec(SLAVE_XML % (self.Controler.GetSlavePos()), return_val = None)
+ error, return_val = self.Controler.RemoteExec(SLAVE_XML % (self.Controler.GetSlavePos()), return_val=None)
number_of_lines = return_val.split("\n")
if len(number_of_lines) <= 2 : # No slave connected to the master controller
if not cyclic_flag :
--- a/etherlab/EtherCATManagementEditor.py Fri Sep 28 19:12:26 2018 +0300
+++ b/etherlab/EtherCATManagementEditor.py Fri Sep 28 19:16:12 2018 +0300
@@ -105,7 +105,7 @@
@param parent: Reference to the parent EtherCATManagementTreebook class
@param controler: _EthercatSlaveCTN class in EthercatSlave.py
"""
- wx.Panel.__init__(self, parent, -1, (0, 0), size=wx.DefaultSize, style = wx.SUNKEN_BORDER)
+ wx.Panel.__init__(self, parent, -1, (0, 0), size=wx.DefaultSize, style=wx.SUNKEN_BORDER)
self.Controler = controler
self.parent = parent
@@ -370,10 +370,10 @@
"""
slaveSDO_progress = wx.ProgressDialog("Slave SDO Monitoring", "Now Uploading...",
- maximum = len(self.SDOs.splitlines()), parent=self,
- style = wx.PD_CAN_ABORT | wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME |
- wx.PD_ESTIMATED_TIME | wx.PD_REMAINING_TIME |
- wx.PD_AUTO_HIDE | wx.PD_SMOOTH)
+ maximum=len(self.SDOs.splitlines()), parent=self,
+ style=wx.PD_CAN_ABORT | wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME |
+ wx.PD_ESTIMATED_TIME | wx.PD_REMAINING_TIME |
+ wx.PD_AUTO_HIDE | wx.PD_SMOOTH)
# If keep_going flag is False, SDOParser method is stop and return "False".
keep_going = True
@@ -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
@@ -648,7 +648,7 @@
# CheckSDODataAccess is checking that OD(Object Dictionary) has "w"
if event.GetCol() == 7 and self.CheckSDODataAccess(event.GetRow()) :
dlg = wx.TextEntryDialog (self, "Enter hex or dec value (if enter dec value, it automatically conversed hex value)",
- "SDOModifyDialog", style = wx.OK | wx.CANCEL)
+ "SDOModifyDialog", style=wx.OK | wx.CANCEL)
start_value = self.GetCellValue(event.GetRow(), event.GetCol())
dlg.SetValue(start_value)
@@ -1804,7 +1804,7 @@
@param parent: RegisterAccessPanel object
@param controler: _EthercatSlaveCTN class in EthercatSlave.py
"""
- wx.Notebook.__init__(self, parent, id = -1)
+ wx.Notebook.__init__(self, parent, id=-1)
self.parent = parent
self.Controler = controler
@@ -2016,7 +2016,7 @@
# user can enter a value in case that user double-clicked 'Dec' or 'Hex' value.
if event.GetCol() == 1 or event.GetCol() == 2:
dlg = wx.TextEntryDialog(self, "Enter hex(0xnnnn) or dec(n) value",
- "Register Modify Dialog", style = wx.OK|wx.CANCEL)
+ "Register Modify Dialog", style=wx.OK|wx.CANCEL)
# Setting value in initial dialog value
start_value = self.GetCellValue(event.GetRow(), event.GetCol())
@@ -2113,7 +2113,7 @@
@Param controler: _EthercatSlaveCTN class in EthercatSlave.py
"""
wx.Panel.__init__(self, parent, -1, (0, 0),
- size=wx.DefaultSize, style = wx.SUNKEN_BORDER)
+ size=wx.DefaultSize, style=wx.SUNKEN_BORDER)
self.Controler = controler
self.parent = parent
self.StaticBox = {}
--- a/etherlab/EthercatMaster.py Fri Sep 28 19:12:26 2018 +0300
+++ b/etherlab/EthercatMaster.py Fri Sep 28 19:16:12 2018 +0300
@@ -449,7 +449,7 @@
dialog.Destroy()
if execute:
- error, returnVal = self.RemoteExec(SCAN_COMMAND, returnVal = None)
+ error, returnVal = self.RemoteExec(SCAN_COMMAND, returnVal=None)
if error != 0:
dialog = wx.MessageDialog(app_frame, returnVal, "Error", wx.OK|wx.ICON_ERROR)
dialog.ShowModal()
--- a/etherlab/EthercatSlave.py Fri Sep 28 19:12:26 2018 +0300
+++ b/etherlab/EthercatSlave.py Fri Sep 28 19:16:12 2018 +0300
@@ -86,7 +86,7 @@
def GetSlavePos(self):
return self.BaseParams.getIEC_Channel()
- def GetParamsAttributes(self, path = None):
+ def GetParamsAttributes(self, path=None):
if path:
parts = path.split(".", 1)
if self.MandatoryParams and parts[0] == self.MandatoryParams[0]:
--- a/etherlab/etherlab.py Fri Sep 28 19:12:26 2018 +0300
+++ b/etherlab/etherlab.py Fri Sep 28 19:16:12 2018 +0300
@@ -102,7 +102,7 @@
factory = EntryListFactory(entries)
entries_list_xslt_tree = etree.XSLT(
- entries_list_xslt, extensions = {
+ entries_list_xslt, extensions={
("entries_list_ns", "AddEntry"): factory.AddEntry,
("entries_list_ns", "HexDecValue"): HexDecValue,
("entries_list_ns", "EntryName"): EntryName})
--- a/etherlab/runtime_etherlab.py Fri Sep 28 19:12:26 2018 +0300
+++ b/etherlab/runtime_etherlab.py Fri Sep 28 19:16:12 2018 +0300
@@ -105,7 +105,7 @@
def _runtime_etherlab_init():
global KMSGPollThread, StopKMSGThread
StopKMSGThread = False
- KMSGPollThread = Thread(target = KMSGPollThreadProc)
+ KMSGPollThread = Thread(target=KMSGPollThreadProc)
KMSGPollThread.start()