clean-up: fix PEP8 E111 indentation is not a multiple of four
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Wed, 16 Aug 2017 17:27:58 +0300
changeset 1757 0de89da92ee0
parent 1756 08e4394ff4fb
child 1758 845ca626db09
clean-up: fix PEP8 E111 indentation is not a multiple of four
BeremizIDE.py
ProjectController.py
controls/DebugVariablePanel/DebugVariableGraphicViewer.py
dialogs/SFCDivergenceDialog.py
editors/Viewer.py
graphics/SFC_Objects.py
i18n/mki18n.py
svgui/pyjs/build.py
svgui/pyjs/pyjs.py
targets/__init__.py
util/ProcessLogger.py
xmlclass/xsdschema.py
--- a/BeremizIDE.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/BeremizIDE.py	Wed Aug 16 17:27:58 2017 +0300
@@ -328,7 +328,7 @@
             def OnMethodGen(obj, meth):
                 def OnMethod(evt):
                     if obj.CTR is not None:
-                       obj.CTR.CallMethod('_'+meth)
+                        obj.CTR.CallMethod('_'+meth)
                     wx.CallAfter(self.RefreshStatusToolBar)
                 return OnMethod
             newid = wx.NewId()
--- a/ProjectController.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/ProjectController.py	Wed Aug 16 17:27:58 2017 +0300
@@ -307,7 +307,7 @@
         return "Project"
 
     def CTNTestModified(self):
-         return self.ChangesToSave or not self.ProjectIsSaved()
+        return self.ChangesToSave or not self.ProjectIsSaved()
 
     def CTNFullName(self):
         return ""
@@ -1154,7 +1154,7 @@
                 # Do generate
                 code = generator()
                 if code is None:
-                     raise
+                    raise
                 code_path = os.path.join(buildpath, filename)
                 open(code_path, "w").write(code)
                 # Insert this file as first file to be compiled at root confnode
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Wed Aug 16 17:27:58 2017 +0300
@@ -438,7 +438,7 @@
         # will be set in reverse order
         buttons = self.ContextualButtons[:]
         if direction in [wx.TOP, wx.LEFT]:
-             buttons.reverse()
+            buttons.reverse()
 
         # Set contextual menu buttons position aside rect depending on
         # direction given
--- a/dialogs/SFCDivergenceDialog.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/dialogs/SFCDivergenceDialog.py	Wed Aug 16 17:27:58 2017 +0300
@@ -67,8 +67,8 @@
             (SIMULTANEOUS_CONVERGENCE, _('Simultaneous Convergence'))]
         poss_div_btns = []
         if poss_div_types is not None:
-             for val in poss_div_types:
-                 poss_div_btns.append(divergence_buttons[val])
+            for val in poss_div_types:
+                poss_div_btns.append(divergence_buttons[val])
         else:
             poss_div_btns = divergence_buttons
         self.TypeRadioButtons = {}
--- a/editors/Viewer.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/editors/Viewer.py	Wed Aug 16 17:27:58 2017 +0300
@@ -3714,7 +3714,7 @@
                 comment.Draw(dc)
         for wire in self.Wires.iterkeys():
             if wire != self.SelectedElement and (wire.IsVisible() or printing):
-                 if not self.Debug or wire.GetValue() != True:
+                if not self.Debug or wire.GetValue() != True:
                     wire.Draw(dc)
         if self.Debug:
             for wire in self.Wires.iterkeys():
--- a/graphics/SFC_Objects.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/graphics/SFC_Objects.py	Wed Aug 16 17:27:58 2017 +0300
@@ -815,7 +815,7 @@
     def SetType(self, type, condition=None):
         if self.Type != type:
             if self.Type == "connection":
-               self.Condition.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+                self.Condition.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
             self.Type = type
             if type == "connection":
                 self.Condition = Connector(self, "", "BOOL", wx.Point(0, self.Size[1] / 2), WEST)
--- a/i18n/mki18n.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/i18n/mki18n.py	Wed Aug 16 17:27:58 2017 +0300
@@ -336,98 +336,98 @@
 
 
 def fileBaseOf(filename, withPath=0):
-   """fileBaseOf(filename,withPath) ---> string
-
-   Return base name of filename.  The returned string never includes the extension.
-   Use os.path.basename() to return the basename with the extension.  The
-   second argument is optional.  If specified and if set to 'true' (non zero)
-   the string returned contains the full path of the file name.  Otherwise the
-   path is excluded.
-
-   [Example]
-   >>> fn = 'd:/dev/telepath/tvapp/code/test.html'
-   >>> fileBaseOf(fn)
-   'test'
-   >>> fileBaseOf(fn)
-   'test'
-   >>> fileBaseOf(fn,1)
-   'd:/dev/telepath/tvapp/code/test'
-   >>> fileBaseOf(fn,0)
-   'test'
-   >>> fn = 'abcdef'
-   >>> fileBaseOf(fn)
-   'abcdef'
-   >>> fileBaseOf(fn,1)
-   'abcdef'
-   >>> fn = "abcdef."
-   >>> fileBaseOf(fn)
-   'abcdef'
-   >>> fileBaseOf(fn,1)
-   'abcdef'
-   """
-   pos = filename.rfind('.')
-   if pos > 0:
-      filename = filename[:pos]
-   if withPath:
-      return filename
-   else:
-      return os.path.basename(filename)
+    """fileBaseOf(filename,withPath) ---> string
+
+    Return base name of filename.  The returned string never includes the extension.
+    Use os.path.basename() to return the basename with the extension.  The
+    second argument is optional.  If specified and if set to 'true' (non zero)
+    the string returned contains the full path of the file name.  Otherwise the
+    path is excluded.
+
+    [Example]
+    >>> fn = 'd:/dev/telepath/tvapp/code/test.html'
+    >>> fileBaseOf(fn)
+    'test'
+    >>> fileBaseOf(fn)
+    'test'
+    >>> fileBaseOf(fn,1)
+    'd:/dev/telepath/tvapp/code/test'
+    >>> fileBaseOf(fn,0)
+    'test'
+    >>> fn = 'abcdef'
+    >>> fileBaseOf(fn)
+    'abcdef'
+    >>> fileBaseOf(fn,1)
+    'abcdef'
+    >>> fn = "abcdef."
+    >>> fileBaseOf(fn)
+    'abcdef'
+    >>> fileBaseOf(fn,1)
+    'abcdef'
+    """
+    pos = filename.rfind('.')
+    if pos > 0:
+        filename = filename[:pos]
+    if withPath:
+        return filename
+    else:
+        return os.path.basename(filename)
 
 
 def mkdir(directory):
-   """Create a directory (and possibly the entire tree).
-
-   The os.mkdir() will fail to create a directory if one of the
-   directory in the specified path does not exist.  mkdir()
-   solves this problem.  It creates every intermediate directory
-   required to create the final path. Under Unix, the function
-   only supports forward slash separator, but under Windows and MacOS
-   the function supports the forward slash and the OS separator (backslash
-   under windows).
-   """
-
-   # translate the path separators
-   directory = unixpath(directory)
-   # build a list of all directory elements
-   aList = filter(lambda x: len(x) > 0, directory.split('/'))
-   theLen = len(aList)
-   # if the first element is a Windows-style disk drive
-   # concatenate it with the first directory
-   if aList[0].endswith(':'):
-      if theLen > 1:
-         aList[1] = aList[0] + '/' + aList[1]
-         del aList[0]
-         theLen -= 1
-   # if the original directory starts at root,
-   # make sure the first element of the list
-   # starts at root too
-   if directory[0] == '/':
-      aList[0] = '/' + aList[0]
-   # Now iterate through the list, check if the
-   # directory exists and if not create it
-   theDir = ''
-   for i in range(theLen):
-      theDir += aList[i]
-      if not os.path.exists(theDir):
-         os.mkdir(theDir)
-      theDir += '/'
+    """Create a directory (and possibly the entire tree).
+
+    The os.mkdir() will fail to create a directory if one of the
+    directory in the specified path does not exist.  mkdir()
+    solves this problem.  It creates every intermediate directory
+    required to create the final path. Under Unix, the function
+    only supports forward slash separator, but under Windows and MacOS
+    the function supports the forward slash and the OS separator (backslash
+    under windows).
+    """
+
+    # translate the path separators
+    directory = unixpath(directory)
+    # build a list of all directory elements
+    aList = filter(lambda x: len(x) > 0, directory.split('/'))
+    theLen = len(aList)
+    # if the first element is a Windows-style disk drive
+    # concatenate it with the first directory
+    if aList[0].endswith(':'):
+        if theLen > 1:
+            aList[1] = aList[0] + '/' + aList[1]
+            del aList[0]
+            theLen -= 1
+    # if the original directory starts at root,
+    # make sure the first element of the list
+    # starts at root too
+    if directory[0] == '/':
+        aList[0] = '/' + aList[0]
+    # Now iterate through the list, check if the
+    # directory exists and if not create it
+    theDir = ''
+    for i in range(theLen):
+        theDir += aList[i]
+        if not os.path.exists(theDir):
+            os.mkdir(theDir)
+        theDir += '/'
 
 
 def unixpath(thePath):
-   r"""Return a path name that contains Unix separator.
-
-   [Example]
-   >>> unixpath(r"d:\test")
-   'd:/test'
-   >>> unixpath("d:/test/file.txt")
-   'd:/test/file.txt'
-   >>>
-   """
-   thePath = os.path.normpath(thePath)
-   if os.sep == '/':
-      return thePath
-   else:
-      return thePath.replace(os.sep, '/')
+    r"""Return a path name that contains Unix separator.
+
+    [Example]
+    >>> unixpath(r"d:\test")
+    'd:/test'
+    >>> unixpath("d:/test/file.txt")
+    'd:/test/file.txt'
+    >>>
+    """
+    thePath = os.path.normpath(thePath)
+    if os.sep == '/':
+        return thePath
+    else:
+        return thePath.replace(os.sep, '/')
 
 
 # -----------------------------------------------------------------------------
--- a/svgui/pyjs/build.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/svgui/pyjs/build.py	Wed Aug 16 17:27:58 2017 +0300
@@ -723,7 +723,7 @@
         pyjs.path.append(abspath(d))
 
     if options.platforms:
-       app_platforms = options.platforms.split(',')
+        app_platforms = options.platforms.split(',')
 
     # this is mostly for getting boilerplate stuff
     data_dir = os.path.abspath(options.data_dir)
--- a/svgui/pyjs/pyjs.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/svgui/pyjs/pyjs.py	Wed Aug 16 17:27:58 2017 +0300
@@ -284,9 +284,9 @@
                 if importName == '__pyjamas__':  # special module to help make pyjamas modules loadable in the python interpreter
                     pass
                 elif importName.endswith('.js'):
-                   self.imported_js.add(importName)
+                    self.imported_js.add(importName)
                 else:
-                   self.add_imported_module(strip_py(importName))
+                    self.add_imported_module(strip_py(importName))
             elif isinstance(child, ast.From):
                 if child.modname == '__pyjamas__':  # special module to help make pyjamas modules loadable in the python interpreter
                     pass
@@ -310,9 +310,9 @@
             elif isinstance(child, ast.Global):
                 self._global(child, None)
             elif isinstance(child, ast.Printnl):
-               self._print(child, None)
+                self._print(child, None)
             elif isinstance(child, ast.Print):
-               self._print(child, None)
+                self._print(child, None)
             elif isinstance(child, ast.TryExcept):
                 self._tryExcept(child, None)
             elif isinstance(child, ast.Raise):
@@ -997,9 +997,9 @@
         elif isinstance(node, ast.Function):
             self._function(node, True)
         elif isinstance(node, ast.Printnl):
-           self._print(node, current_klass)
+            self._print(node, current_klass)
         elif isinstance(node, ast.Print):
-           self._print(node, current_klass)
+            self._print(node, current_klass)
         elif isinstance(node, ast.TryExcept):
             self._tryExcept(node, current_klass)
         elif isinstance(node, ast.Raise):
@@ -1066,8 +1066,8 @@
             tnode = ast.Assign([ast.AssName(tempvar, "OP_ASSIGN", node.lineno)], node.expr, node.lineno)
             self._assign(tnode, current_klass, top_level)
             for v in node.nodes:
-               tnode2 = ast.Assign([v], ast.Name(tempvar, node.lineno), node.lineno)
-               self._assign(tnode2, current_klass, top_level)
+                tnode2 = ast.Assign([v], ast.Name(tempvar, node.lineno), node.lineno)
+                self._assign(tnode2, current_klass, top_level)
             return
 
         local_var_names = None
@@ -1177,7 +1177,7 @@
             debugStmt = self.debug and not self._isNativeFunc(node)
             if debugStmt and isinstance(node.expr.node, ast.Name) and \
                node.expr.node.name == 'import_wait':
-               debugStmt = False
+                debugStmt = False
             if debugStmt:
                 st = self.get_line_trace(node)
                 print >>self.output, "sys.addstack('%s');\n" % st
@@ -1383,8 +1383,8 @@
 
     def _mod(self, node, current_klass):
         if isinstance(node.left, ast.Const) and isinstance(node.left.value, StringType):
-           self.imported_js.add("sprintf.js")  # Include the sprintf functionality if it is used
-           return "sprintf("+self.expr(node.left, current_klass) + ", " + self.expr(node.right, current_klass)+")"
+            self.imported_js.add("sprintf.js")  # Include the sprintf functionality if it is used
+            return "sprintf("+self.expr(node.left, current_klass) + ", " + self.expr(node.right, current_klass)+")"
         return self.expr(node.left, current_klass) + " % " + self.expr(node.right, current_klass)
 
     def _invert(self, node, current_klass):
@@ -1738,15 +1738,15 @@
             print >> app_code, self._translate(
                 module_name, is_app, debug=debug, imported_js=imported_js)
         for js in imported_js:
-           path = self.findFile(js)
-           if os.path.isfile(path):
-              if self.verbose:
-                  print 'Including JS', js
-              print >> lib_code,  '\n//\n// BEGIN JS '+js+'\n//\n'
-              print >> lib_code, file(path).read()
-              print >> lib_code,  '\n//\n// END JS '+js+'\n//\n'
-           else:
-              print >>sys.stderr, 'Warning: Unable to find imported javascript:', js
+            path = self.findFile(js)
+            if os.path.isfile(path):
+                if self.verbose:
+                    print 'Including JS', js
+                print >> lib_code,  '\n//\n// BEGIN JS '+js+'\n//\n'
+                print >> lib_code, file(path).read()
+                print >> lib_code,  '\n//\n// END JS '+js+'\n//\n'
+            else:
+                print >>sys.stderr, 'Warning: Unable to find imported javascript:', js
         return lib_code.getvalue(), app_code.getvalue()
 
 
--- a/targets/__init__.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/targets/__init__.py	Wed Aug 16 17:27:58 2017 +0300
@@ -68,9 +68,8 @@
 
     # Get all xsd toolchains
     for toolchainname, xsdfilename in toolchains.iteritems():
-         if path.isfile(xsdfilename):
-             DictXSD_toolchain["toolchain_"+toolchainname] = \
-                open(xsdfilename).read()
+        if path.isfile(xsdfilename):
+            DictXSD_toolchain["toolchain_"+toolchainname] = open(xsdfilename).read()
 
     # Get all xsd targets
     for targetname, nfo in targets.iteritems():
--- a/util/ProcessLogger.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/util/ProcessLogger.py	Wed Aug 16 17:27:58 2017 +0300
@@ -213,7 +213,7 @@
     def endlog(self):
         if self.endlock.acquire(False):
             if not self.outt.finished and self.kill_it:
-               self.kill()
+                self.kill()
             self.finishsem.release()
 
     def spin(self):
--- a/xmlclass/xsdschema.py	Wed Aug 16 16:37:45 2017 +0300
+++ b/xmlclass/xsdschema.py	Wed Aug 16 17:27:58 2017 +0300
@@ -281,7 +281,7 @@
                     raise ValueError("\"minExclusive\" must be lesser than \"maxExclusive\"!")
             elif facettype == "whiteSpace":
                 if basevalue == "collapse" and value in ["preserve", "replace"] or basevalue == "replace" and value == "preserve":
-                   raise ValueError("\"whiteSpace\" is incompatible with \"whiteSpace\" defined in base type!")
+                    raise ValueError("\"whiteSpace\" is incompatible with \"whiteSpace\" defined in base type!")
             elif facettype == "totalDigits":
                 if facets.has_key("fractionDigits") and value <= facets["fractionDigits"][0]:
                     raise ValueError("\"fractionDigits\" must be lesser than or equal to \"totalDigits\"!")