fix unnecessary parens after keyword
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 22 Sep 2017 16:37:38 +0300
changeset 1828 396da88d7b5c
parent 1827 b8b47f9b5e56
child 1829 a776ac02b079
fix unnecessary parens after keyword
Beremiz_service.py
ConfigTreeNode.py
ProjectController.py
canfestival/canfestival.py
controls/DebugVariablePanel/DebugVariablePanel.py
docutil/docpdf.py
docutil/docsvg.py
editors/SFCViewer.py
graphics/GraphicCommons.py
i18n/mki18n.py
plcopen/structures.py
svgui/pyjs/lib/pyjslib.py
tests/tools/check_source.sh
util/Zeroconf.py
--- a/Beremiz_service.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/Beremiz_service.py	Fri Sep 22 16:37:38 2017 +0300
@@ -514,7 +514,7 @@
 
     def evaluator(tocall, *args, **kwargs):
         global main_thread
-        if(main_thread == currentThread()):
+        if main_thread == currentThread():
             # avoid dead lock if called from the wx mainloop
             return default_evaluator(tocall, *args, **kwargs)
         else:
--- a/ConfigTreeNode.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/ConfigTreeNode.py	Fri Sep 22 16:37:38 2017 +0300
@@ -567,7 +567,7 @@
                     # Load the confnode.xml file into parameters members
                     _self.LoadXMLParams(NewCTNName)
                     # Basic check. Better to fail immediately.
-                    if (_self.BaseParams.getName() != NewCTNName):
+                    if _self.BaseParams.getName() != NewCTNName:
                         raise Exception(
                             _("Project tree layout do not match confnode.xml {a1}!={a2} ").
                             format(a1=NewCTNName, a2=_self.BaseParams.getName()))
--- a/ProjectController.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/ProjectController.py	Fri Sep 22 16:37:38 2017 +0300
@@ -1361,7 +1361,7 @@
         if status is None:
             self._SetConnector(None, False)
             status = "Disconnected"
-        if(self.previous_plcstate != status):
+        if self.previous_plcstate != status:
             for args in {
                     "Started":      [("_Run", False),
                                      ("_Stop", True)],
--- a/canfestival/canfestival.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/canfestival/canfestival.py	Fri Sep 22 16:37:38 2017 +0300
@@ -127,7 +127,7 @@
         # TODO change netname when name change
         NodeManager.__init__(self)
         odfilepath = self.GetSlaveODPath()
-        if(os.path.isfile(odfilepath)):
+        if os.path.isfile(odfilepath):
             self.OpenFileInCurrent(odfilepath)
         else:
             self.FilePath = ""
--- a/controls/DebugVariablePanel/DebugVariablePanel.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariablePanel.py	Fri Sep 22 16:37:38 2017 +0300
@@ -787,7 +787,7 @@
         if source_panel is not None:
             source_panel_idx = self.GraphicPanels.index(source_panel)
 
-            if (len(source_panel.GetItems()) == 1):
+            if len(source_panel.GetItems()) == 1:
 
                 if source_panel_idx < idx:
                     self.GraphicPanels.insert(idx, source_panel)
@@ -857,7 +857,7 @@
                             source_panel.ReleaseMouse()
                         source_panel.Destroy()
                         self.GraphicPanels.remove(source_panel)
-            elif (merge_type != graph_type and len(target_panel.Items) == 2):
+            elif merge_type != graph_type and len(target_panel.Items) == 2:
                 target_panel.RemoveItem(source_item)
             else:
                 target_panel = None
--- a/docutil/docpdf.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/docutil/docpdf.py	Fri Sep 22 16:37:38 2017 +0300
@@ -72,13 +72,13 @@
             return None
 
         readerexepath = os.path.join(readerpath, "AcroRd32.exe")
-        if(os.path.isfile(readerexepath)):
+        if os.path.isfile(readerexepath):
             open_win_pdf(readerexepath, pdffile, pagenum)
         else:
             return None
     else:
         readerexepath = os.path.join("/usr/bin", "xpdf")
-        if(os.path.isfile(readerexepath)):
+        if os.path.isfile(readerexepath):
             open_lin_pdf(readerexepath, pdffile, pagenum)
         else:
             wx.MessageBox("xpdf is not found or installed !")
--- a/docutil/docsvg.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/docutil/docsvg.py	Fri Sep 22 16:37:38 2017 +0300
@@ -64,7 +64,7 @@
             return None
     else:
         svgexepath = os.path.join("/usr/bin", "inkscape")
-        if(os.path.isfile(svgexepath)):
+        if os.path.isfile(svgexepath):
             open_lin_svg(svgexepath, svgfile)
         else:
             wx.MessageBox("Inkscape is not found or installed !")
--- a/editors/SFCViewer.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/editors/SFCViewer.py	Fri Sep 22 16:37:38 2017 +0300
@@ -346,7 +346,7 @@
            (isinstance(startblock, SFC_Objects) or isinstance(endblock, SFC_Objects)):
             # Full "SFC_StandardRules" table would be symmetrical and
             # to avoid duplicate records and minimize the table only upper part is defined.
-            if (direction == SOUTH or direction == EAST):
+            if direction == SOUTH or direction == EAST:
                 startblock, endblock = endblock, startblock
             start = self.GetBlockName(startblock)
             end = self.GetBlockName(endblock)
--- a/graphics/GraphicCommons.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/graphics/GraphicCommons.py	Fri Sep 22 16:37:38 2017 +0300
@@ -2652,7 +2652,7 @@
         scalex, scaley = dc.GetUserScale()
         dc.SetUserScale(1, 1)
         # If user trying to connect wire with wrong input, highlight will become red.
-        if self.ErrHighlight and not (self.EndConnected):
+        if self.ErrHighlight and not self.EndConnected:
             highlightcolor = wx.RED
         else:
             highlightcolor = HIGHLIGHTCOLOR
--- a/i18n/mki18n.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/i18n/mki18n.py	Fri Sep 22 16:37:38 2017 +0300
@@ -467,7 +467,7 @@
         printUsage(e[0])
         sys.exit(1)
     for (opt, val) in optionList:
-        if (opt == '-h'):
+        if opt == '-h':
             printUsage()
             sys.exit(0)
         option[optionKey[opt]] = 1 if val == '' else val
--- a/plcopen/structures.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/plcopen/structures.py	Fri Sep 22 16:37:38 2017 +0300
@@ -110,7 +110,7 @@
     return the matching row without first field
     """
     fields = [None]
-    while(fields[0] != section_name):
+    while fields[0] != section_name:
         fields = table.pop(0)
     return fields[1:]
 
@@ -123,7 +123,7 @@
     variables = find_section("Standard_functions_variables_types", table)
     standard_funtions_input_variables = {}
     fields = [True, True]
-    while(fields[1]):
+    while fields[1]:
         fields = table.pop(0)
         variable_from_csv = dict([(champ, val) for champ, val in zip(variables, fields[1:]) if champ != ''])
         standard_funtions_input_variables[variable_from_csv['name']] = variable_from_csv['type']
--- a/svgui/pyjs/lib/pyjslib.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/svgui/pyjs/lib/pyjslib.py	Fri Sep 22 16:37:38 2017 +0300
@@ -987,7 +987,7 @@
 
 
 def ord(x):
-    if(isString(x) and len(x) is 1):
+    if isString(x) and len(x) is 1:
         JS("""
             return x.charCodeAt(0);
         """)
--- a/tests/tools/check_source.sh	Fri Sep 22 10:57:57 2017 +0300
+++ b/tests/tools/check_source.sh	Fri Sep 22 16:37:38 2017 +0300
@@ -203,7 +203,8 @@
     enable=
     enable=$enable,E1601          # print statement used    
     # enable=$enable,W0403        # relative import
-
+    enable=$enable,C0325        # (superfluous-parens) Unnecessary parens after keyword
+    # enable=
 
     options=
     options="$options --rcfile=.pylint"
--- a/util/Zeroconf.py	Fri Sep 22 10:57:57 2017 +0300
+++ b/util/Zeroconf.py	Fri Sep 22 16:37:38 2017 +0300
@@ -903,7 +903,7 @@
 
     def delReader(self, socket):
         self.condition.acquire()
-        del(self.readers[socket])
+        del self.readers[socket]
         self.condition.notify()
         self.condition.release()
 
@@ -1001,7 +1001,7 @@
                 else:
                     def callback(x):
                         return self.listener.removeService(x, self.type, record.alias)
-                    del(self.services[record.alias.lower()])
+                    del self.services[record.alias.lower()]
                     self.list.append(callback)
                     return
             except Exception:
@@ -1348,7 +1348,7 @@
         for browser in self.browsers:
             if browser.listener == listener:
                 browser.cancel()
-                del(browser)
+                del browser
 
     def registerService(self, info, ttl=_DNS_TTL):
         """Registers service information to the network with a default TTL
@@ -1378,7 +1378,7 @@
     def unregisterService(self, info):
         """Unregister a service."""
         try:
-            del(self.services[info.name.lower()])
+            del self.services[info.name.lower()]
         except Exception:
             pass
         now = currentTimeMillis()
@@ -1430,7 +1430,7 @@
         while i < 3:
             for record in self.cache.entriesWithName(info.type):
                 if record.type == _TYPE_PTR and not record.isExpired(now) and record.alias == info.name:
-                    if (info.name.find('.') < 0):
+                    if info.name.find('.') < 0:
                         info.name = info.name + ".[" + info.address + ":" + info.port + "]." + info.type
                         self.checkService(info)
                         return