clean etherlab: pep8, E712 comparison to True should be 'if cond is True:' or 'if cond:'
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Sat, 29 Sep 2018 13:04:33 +0300
changeset 2374 aed3ca79a10a
parent 2373 73d35ba8f982
child 2375 cfa68a06a24d
clean etherlab: pep8, E712 comparison to True should be 'if cond is True:' or 'if cond:'
etherlab/CommonEtherCATFunction.py
etherlab/EtherCATManagementEditor.py
etherlab/EthercatCFileGenerator.py
--- a/etherlab/CommonEtherCATFunction.py	Sat Sep 29 12:55:56 2018 +0300
+++ b/etherlab/CommonEtherCATFunction.py	Sat Sep 29 13:04:33 2018 +0300
@@ -1219,10 +1219,10 @@
         #  Flags
         en_safeop = False
         en_lrw = False
-        if device.getType().getTcCfgModeSafeOp() == True \
+        if device.getType().getTcCfgModeSafeOp() is True \
         or device.getType().getTcCfgModeSafeOp() == 1:
             en_safeop = True
-        if device.getType().getUseLrdLwr() == True \
+        if device.getType().getUseLrdLwr() is True \
         or device.getType().getUseLrdLwr() == 1:
             en_lrw = True
 
@@ -1318,7 +1318,7 @@
                     data += "{:0>4x}".format(ExtractHexDecValue(attr))[0:2]
                 else:
                     data += "0000"
-            if sm.getEnable() == "1" or sm.getEnable() == True:
+            if sm.getEnable() == "1" or sm.getEnable() is True:
                 data += "01"
             else:
                 data += "00"
@@ -1381,11 +1381,11 @@
                 data += "{:0>2x}".format(count)
             count = 0
             #  Flags; by Fixed, Mandatory, Virtual attributes ?
-            if element.getFixed() == True or 1:
+            if element.getFixed() is True or 1:
                 en_fixed = True
-            if element.getMandatory() == True or 1:
+            if element.getMandatory() is True or 1:
                 en_mandatory = True
-            if element.getVirtual() == True or element.getVirtual():
+            if element.getVirtual() is True or element.getVirtual():
                 en_virtual = True
             data += str(int(en_fixed)) + str(int(en_mandatory)) + str(int(en_virtual)) + "0"
 
@@ -1423,7 +1423,7 @@
                     data += "00"
                 #   Flags; by Fixed attributes ?
                 en_fixed = False
-                if entry.getFixed() == True or entry.getFixed() == 1:
+                if entry.getFixed() is True or entry.getFixed() == 1:
                     en_fixed = True
                 data += str(int(en_fixed)) + "000"
 
--- a/etherlab/EtherCATManagementEditor.py	Sat Sep 29 12:55:56 2018 +0300
+++ b/etherlab/EtherCATManagementEditor.py	Sat Sep 29 13:04:33 2018 +0300
@@ -438,7 +438,7 @@
                 (keep_going, skip) = slaveSDO_progress.Update(count)
 
             # If user click "Cancel" loop suspend immediately
-            if (keep_going == False):
+            if not keep_going:
                 break
 
         slaveSDO_progress.Destroy()
@@ -1744,7 +1744,7 @@
 
         # If "Compact View" Checkbox is True
         ## 'event' is argument of this method or event of checkbox.
-        if event == True or event.GetEventObject().GetValue():
+        if event is True or event.GetEventObject().GetValue():
             self.CompactFlag = True
 
             reg_compact_data = []
--- a/etherlab/EthercatCFileGenerator.py	Sat Sep 29 12:55:56 2018 +0300
+++ b/etherlab/EthercatCFileGenerator.py	Sat Sep 29 13:04:33 2018 +0300
@@ -337,7 +337,7 @@
                             if slave_variables.get((index, subindex), None) is not None:
                                 pdo_mapping_match["matching"] += 1
 
-                        if pdo.getFixed() != True:
+                        if pdo.getFixed() is not True:
                             pdo_mapping_match["matching"] += \
                                 module_extra_params["max_pdo_size"] - \
                                 pdo_mapping_match["count"]
@@ -438,7 +438,7 @@
                              "type": pdo_type,
                              "entries": entries_infos,
                              "entries_number": len(entries_infos),
-                             "fixed": pdo.getFixed() == True})
+                             "fixed": pdo.getFixed() is True})
 
                 if PdoConfig and PdoAssign:
                     dynamic_pdos = {}