clean-up: fix PEP8 E202 whitespace before ')'
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Wed, 16 Aug 2017 12:03:46 +0300
changeset 1746 45d6f5fba016
parent 1745 f9d32913bad4
child 1747 6046ffa2280f
clean-up: fix PEP8 E202 whitespace before ')'
Beremiz_service.py
ConfigTreeNode.py
ProjectController.py
canfestival/canfestival.py
controls/DebugVariablePanel/DebugVariableGraphicViewer.py
controls/EnhancedStatusBar.py
dialogs/DiscoveryDialog.py
doc/conf.py
py_ext/py_ext.py
runtime/NevowServer.py
svgui/pyjs/build.py
svgui/pyjs/jsonrpc/django/jsonrpc.py
svgui/pyjs/pyjs.py
util/ProcessLogger.py
util/Zeroconf.py
--- a/Beremiz_service.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/Beremiz_service.py	Wed Aug 16 12:03:46 2017 +0300
@@ -287,7 +287,7 @@
                 elif "wxGTK" in wx.PlatformInfo:
                     img = img.Scale(22, 22)
                 # wxMac can be any size upto 128x128, so leave the source img alone....
-                icon = wx.IconFromBitmap(img.ConvertToBitmap() )
+                icon = wx.IconFromBitmap(img.ConvertToBitmap())
                 return icon
 
             def OnTaskBarStartPLC(self, evt):
--- a/ConfigTreeNode.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/ConfigTreeNode.py	Wed Aug 16 12:03:46 2017 +0300
@@ -294,7 +294,7 @@
                     # keep the same path
                     buildpath,
                     # filter locations that start with current IEC location
-                    [loc for loc in locations if loc["LOC"][0:depth] == new_location ])
+                    [loc for loc in locations if loc["LOC"][0:depth] == new_location])
             # stack the result
             LocationCFilesAndCFLAGS += _LocationCFilesAndCFLAGS
             LDFLAGS += _LDFLAGS
--- a/ProjectController.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/ProjectController.py	Wed Aug 16 12:03:46 2017 +0300
@@ -562,10 +562,10 @@
 
     def GetLibrariesTypes(self):
         self.LoadLibraries()
-        return [ lib.GetTypes() for lib in self.Libraries ]
+        return [lib.GetTypes() for lib in self.Libraries]
 
     def GetLibrariesSTCode(self):
-        return "\n".join([ lib.GetSTCode() for lib in self.Libraries ])
+        return "\n".join([lib.GetSTCode() for lib in self.Libraries])
 
     def GetLibrariesCCode(self, buildpath):
         if len(self.Libraries) == 0:
@@ -788,7 +788,7 @@
             return False
 
         # Now extract C files of stdout
-        C_files = [ fname for fname in result.splitlines() if fname[-2:] == ".c" or fname[-2:] == ".C" ]
+        C_files = [fname for fname in result.splitlines() if fname[-2:] == ".c" or fname[-2:] == ".C"]
         # remove those that are not to be compiled because included by others
         C_files.remove("POUS.c")
         if not C_files:
@@ -798,7 +798,7 @@
         C_files = map(lambda filename: os.path.join(buildpath, filename), C_files)
 
         # prepend beremiz include to configuration header
-        H_files = [ fname for fname in result.splitlines() if fname[-2:] == ".h" or fname[-2:] == ".H" ]
+        H_files = [fname for fname in result.splitlines() if fname[-2:] == ".h" or fname[-2:] == ".H"]
         H_files.remove("LOCATED_VARIABLES.h")
         H_files = map(lambda filename: os.path.join(buildpath, filename), H_files)
         for H_file in H_files:
@@ -856,7 +856,7 @@
         """
 
         return ([(C_file_name, self.plcCFLAGS)
-                for C_file_name in self.PLCGeneratedCFiles ],
+                for C_file_name in self.PLCGeneratedCFiles],
                "",  # no ldflags
                False)  # do not expose retreive/publish calls
 
--- a/canfestival/canfestival.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/canfestival/canfestival.py	Wed Aug 16 12:03:46 2017 +0300
@@ -223,7 +223,7 @@
         current_location = self.GetCurrentLocation()
         # define a unique name for the generated C file
         prefix = "_".join(map(str, current_location))
-        Gen_OD_path = os.path.join(buildpath, "OD_%s.c" % prefix )
+        Gen_OD_path = os.path.join(buildpath, "OD_%s.c" % prefix)
         # Create a new copy of the model
         slave = self.GetCurrentNodeCopy()
         slave.SetNodeName("OD_%s" % prefix)
@@ -442,7 +442,7 @@
         current_location = self.GetCurrentLocation()
         # define a unique name for the generated C file
         prefix = "_".join(map(str, current_location))
-        Gen_OD_path = os.path.join(buildpath, "OD_%s.c" % prefix )
+        Gen_OD_path = os.path.join(buildpath, "OD_%s.c" % prefix)
         # Create a new copy of the model with DCF loaded with PDO mappings for desired location
         try:
             master, pointers = config_utils.GenerateConciseDCF(locations, current_location, self, self.CanFestivalNode.getSync_TPDOs(), "OD_%s" % prefix)
@@ -481,7 +481,7 @@
     """
 
     CTNChildrenTypes = [("CanOpenNode",  _NodeListCTN, "CanOpen Master"),
-                        ("CanOpenSlave", _SlaveCTN,    "CanOpen Slave" )]
+                        ("CanOpenSlave", _SlaveCTN,    "CanOpen Slave")]
     def GetParamsAttributes(self, path=None):
         infos = ConfigTreeNode.GetParamsAttributes(self, path=path)
         for element in infos:
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Wed Aug 16 12:03:46 2017 +0300
@@ -452,7 +452,7 @@
                 y = rect.y + (rect.height - h) / 2
                 offset += w
             else:
-                x = rect.x + (rect.width - w ) / 2
+                x = rect.x + (rect.width - w) / 2
                 y = rect.y + (- h - offset
                               if direction == wx.TOP
                               else rect.height + offset)
--- a/controls/EnhancedStatusBar.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/controls/EnhancedStatusBar.py	Wed Aug 16 12:03:46 2017 +0300
@@ -78,7 +78,7 @@
 # ---------------------------------------------------------------
 class EnhancedStatusBarItem(object):
     def __init__(self, widget, pos, horizontalalignment=ESB_ALIGN_CENTER_HORIZONTAL, verticalalignment=ESB_ALIGN_CENTER_VERTICAL):
-        self.__dict__.update( locals() )
+        self.__dict__.update(locals())
 
 
 class EnhancedStatusBar(wx.StatusBar):
--- a/dialogs/DiscoveryDialog.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/dialogs/DiscoveryDialog.py	Wed Aug 16 12:03:46 2017 +0300
@@ -247,6 +247,6 @@
 
         # "name" is included at the end so that self.removeService
         # can access it.
-        self.itemDataMap[self.nextItemId] = [ svcname, typename, ip, port, name ]
+        self.itemDataMap[self.nextItemId] = [svcname, typename, ip, port, name]
 
         self.nextItemId += 1
--- a/doc/conf.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/doc/conf.py	Wed Aug 16 12:03:46 2017 +0300
@@ -58,7 +58,7 @@
 #language = None
 
 gettext_compact = False
-locale_dirs = [ "locale/" ]
+locale_dirs = ["locale/"]
 
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:
--- a/py_ext/py_ext.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/py_ext/py_ext.py	Wed Aug 16 12:03:46 2017 +0300
@@ -48,7 +48,7 @@
 
         # prepare python code
         plc_python_code = plc_python_code % {
-            "python_eval_fb_count": python_eval_fb_count }
+            "python_eval_fb_count": python_eval_fb_count}
 
         Gen_Pythonfile_path = os.path.join(buildpath, "py_ext.c")
         pythonfile = open(Gen_Pythonfile_path, 'w')
--- a/runtime/NevowServer.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/runtime/NevowServer.py	Wed Aug 16 12:03:46 2017 +0300
@@ -122,7 +122,7 @@
                                     tags.head(render=tags.directive('liveglue')),
                                     tags.body[
                                         tags.div[
-                                                tags.div( render=tags.directive( "MainPage" ))
+                                                tags.div(render=tags.directive("MainPage"))
                                                 ]]]])
     MainPage = MainPage()
     PLCHMI = PLCHMI
--- a/svgui/pyjs/build.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/svgui/pyjs/build.py	Wed Aug 16 12:03:46 2017 +0300
@@ -138,19 +138,17 @@
 </html>
 """
 
-    filename = os.path.split    ( source_file )[1]
-    mod_name = os.path.splitext ( filename    )[0]
-    file_name = os.path.join     ( dest_path, mod_name + '.html' )
+    filename  = os.path.split   (source_file)[1]
+    mod_name  = os.path.splitext(filename)[0]
+    file_name = os.path.join    (dest_path, mod_name + '.html')
 
     # if html file in output directory exists, leave it alone.
-    if os.path.exists ( file_name ):
+    if os.path.exists (file_name):
         return 0
 
-    if os.path.exists (
-        os.path.join ( dest_path, mod_name + '.css' ) ):
+    if os.path.exists(os.path.join(dest_path, mod_name + '.css')):
         css = "<link rel='stylesheet' href='" + mod_name + ".css'>"
-    elif os.path.exists (
-        os.path.join ( dest_path, 'pyjamas_default.css' ) ):
+    elif os.path.exists(os.path.join(dest_path, 'pyjamas_default.css')):
         css = "<link rel='stylesheet' href='pyjamas_default.css'>"
 
     else:
--- a/svgui/pyjs/jsonrpc/django/jsonrpc.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/svgui/pyjs/jsonrpc/django/jsonrpc.py	Wed Aug 16 12:03:46 2017 +0300
@@ -171,7 +171,7 @@
             if not f.is_valid():
                 return {'success': False, 'errors': builderrors(f)}
             instance = f.save()  # XXX: if you want more, over-ride save.
-            return {'success': True, 'instance': json_convert(instance) }
+            return {'success': True, 'instance': json_convert(instance)}
 
         elif command.has_key('html'):
             return {'success': True, 'html': f.as_table()}
--- a/svgui/pyjs/pyjs.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/svgui/pyjs/pyjs.py	Wed Aug 16 12:03:46 2017 +0300
@@ -543,7 +543,7 @@
                 return ("pyjs_kwargs_function_call("+call_name+", "
                                   + star_arg_name
                                   + ", ["+fn_args+"]"
-                                  + ")" )
+                                  + ")")
             else:
                 return ("pyjs_kwargs_method_call("+call_this+", '"+method_name+"', "
                                   + star_arg_name
@@ -588,7 +588,7 @@
                 for x in expr.nodes:
                     l.append("(%(err)s.__name__ == %(expr)s.__name__)" % dict (err=errName, expr=self.expr(x, current_klass)))
             else:
-                l = [ " (%(err)s.__name__ == %(expr)s.__name__) " % dict (err=errName, expr=self.expr(expr, current_klass)) ]
+                l = [" (%(err)s.__name__ == %(expr)s.__name__) " % dict (err=errName, expr=self.expr(expr, current_klass))]
             print >> self.output, "   if(%s) {" % '||\n\t\t'.join(l)
         for stmt in node.handlers[0][2]:
             self._stmt(stmt, current_klass)
@@ -670,7 +670,7 @@
         elif v.name in self.module_imports() and return_none_for_module:
             return None
         elif v.name in PYJSLIB_BUILTIN_CLASSES:
-            return "pyjslib." + pyjs_builtin_remap( v.name )
+            return "pyjslib." + pyjs_builtin_remap(v.name)
         elif current_klass:
             if v.name not in local_var_names and \
                v.name not in self.top_level_vars and \
--- a/util/ProcessLogger.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/util/ProcessLogger.py	Wed Aug 16 12:03:46 2017 +0300
@@ -135,7 +135,7 @@
         else:
             self.timeout = None
 
-        self.Proc = subprocess.Popen( self.Command, **popenargs )
+        self.Proc = subprocess.Popen(self.Command, **popenargs)
 
         self.outt = outputThread(
                       self.Proc,
--- a/util/Zeroconf.py	Wed Aug 16 11:47:27 2017 +0300
+++ b/util/Zeroconf.py	Wed Aug 16 12:03:46 2017 +0300
@@ -159,7 +159,7 @@
              _CLASS_CH:   "ch",
              _CLASS_HS:   "hs",
              _CLASS_NONE: "none",
-             _CLASS_ANY:  "any" }
+             _CLASS_ANY:  "any"}
 
 _TYPES = { _TYPE_A:     "a",
            _TYPE_NS:    "ns",
@@ -179,7 +179,7 @@
            _TYPE_TXT:   "txt",
            _TYPE_AAAA:  "quada",
            _TYPE_SRV:   "srv",
-           _TYPE_ANY:   "any" }
+           _TYPE_ANY:   "any"}
 
 # utility functions