fix pylint warning (bad-indentation) Bad indentation. Found X spaces, expected Y
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 29 Sep 2017 16:39:52 +0300
changeset 1838 646245c1c0d9
parent 1837 c507c363625e
child 1839 a2324624e516
fix pylint warning (bad-indentation) Bad indentation. Found X spaces, expected Y
controls/VariablePanel.py
dialogs/FindInPouDialog.py
docutil/dochtml.py
editors/Viewer.py
tests/tools/check_source.sh
util/TranslationCatalogs.py
--- a/controls/VariablePanel.py	Fri Sep 29 16:26:15 2017 +0300
+++ b/controls/VariablePanel.py	Fri Sep 29 16:39:52 2017 +0300
@@ -841,25 +841,25 @@
                 self.SaveValues()
 
     def BuildStdIECTypesMenu(self, type_menu):
-            # build a submenu containing standard IEC types
-            base_menu = wx.Menu(title='')
-            for base_type in self.Controler.GetBaseTypes():
-                new_id = wx.NewId()
-                base_menu.Append(help='', id=new_id, kind=wx.ITEM_NORMAL, text=base_type)
-                self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(base_type), id=new_id)
-
-            type_menu.AppendMenu(wx.NewId(), _("Base Types"), base_menu)
+        # build a submenu containing standard IEC types
+        base_menu = wx.Menu(title='')
+        for base_type in self.Controler.GetBaseTypes():
+            new_id = wx.NewId()
+            base_menu.Append(help='', id=new_id, kind=wx.ITEM_NORMAL, text=base_type)
+            self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(base_type), id=new_id)
+
+        type_menu.AppendMenu(wx.NewId(), _("Base Types"), base_menu)
 
     def BuildUserTypesMenu(self, type_menu):
-            # build a submenu containing user-defined types
-            datatype_menu = wx.Menu(title='')
-            datatypes = self.Controler.GetDataTypes(basetypes=False, confnodetypes=False)
-            for datatype in datatypes:
-                new_id = wx.NewId()
-                datatype_menu.Append(help='', id=new_id, kind=wx.ITEM_NORMAL, text=datatype)
-                self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(datatype), id=new_id)
-
-            type_menu.AppendMenu(wx.NewId(), _("User Data Types"), datatype_menu)
+        # build a submenu containing user-defined types
+        datatype_menu = wx.Menu(title='')
+        datatypes = self.Controler.GetDataTypes(basetypes=False, confnodetypes=False)
+        for datatype in datatypes:
+            new_id = wx.NewId()
+            datatype_menu.Append(help='', id=new_id, kind=wx.ITEM_NORMAL, text=datatype)
+            self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(datatype), id=new_id)
+
+        type_menu.AppendMenu(wx.NewId(), _("User Data Types"), datatype_menu)
 
     def BuildLibsTypesMenu(self, type_menu):
         for category in self.Controler.GetConfNodeDataTypes():
--- a/dialogs/FindInPouDialog.py	Fri Sep 29 16:26:15 2017 +0300
+++ b/dialogs/FindInPouDialog.py	Fri Sep 29 16:39:52 2017 +0300
@@ -31,7 +31,7 @@
 
     def _init_icon(self, parent):
         if parent and parent.icon:
-                self.SetIcon(parent.icon)
+            self.SetIcon(parent.icon)
 
     def __init__(self, parent):
         wx.Dialog.__init__(
--- a/docutil/dochtml.py	Fri Sep 29 16:26:15 2017 +0300
+++ b/docutil/dochtml.py	Fri Sep 29 16:39:52 2017 +0300
@@ -31,13 +31,13 @@
 
 
 def OpenHtmlFrame(self, title, file, size):
-        if title not in HtmlFrameOpened:
-            HtmlFrameOpened.append(title)
-            window = HtmlFrame(self, HtmlFrameOpened)
-            window.SetTitle(title)
-            window.SetHtmlPage(file)
-            window.SetClientSize(size)
-            window.Show()
+    if title not in HtmlFrameOpened:
+        HtmlFrameOpened.append(title)
+        window = HtmlFrame(self, HtmlFrameOpened)
+        window.SetTitle(title)
+        window.SetHtmlPage(file)
+        window.SetClientSize(size)
+        window.Show()
 
 
 [ID_HTMLFRAME, ID_HTMLFRAMEHTMLCONTENT] = [wx.NewId() for _init_ctrls in range(2)]
@@ -67,40 +67,40 @@
 
 
 class HtmlFrame(wx.Frame):
-        def _init_ctrls(self, prnt):
-            self.SetIcon(prnt.icon)
-            self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
+    def _init_ctrls(self, prnt):
+        self.SetIcon(prnt.icon)
+        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
 
-            self.HtmlContent = UrlClickHtmlWindow(id=ID_HTMLFRAMEHTMLCONTENT,
-                                                  name='HtmlContent', parent=self, pos=wx.Point(0, 0),
-                                                  size=wx.Size(-1, -1), style=wx.html.HW_SCROLLBAR_AUTO | wx.html.HW_NO_SELECTION)
-            self.HtmlContent.Bind(HtmlWindowUrlClick, self.OnLinkClick)
+        self.HtmlContent = UrlClickHtmlWindow(id=ID_HTMLFRAMEHTMLCONTENT,
+                                              name='HtmlContent', parent=self, pos=wx.Point(0, 0),
+                                              size=wx.Size(-1, -1), style=wx.html.HW_SCROLLBAR_AUTO | wx.html.HW_NO_SELECTION)
+        self.HtmlContent.Bind(HtmlWindowUrlClick, self.OnLinkClick)
 
-        def __init__(self, parent, opened):
-            wx.Frame.__init__(self, id=ID_HTMLFRAME, name='HtmlFrame',
-                              parent=parent, pos=wx.Point(320, 231),
-                              size=wx.Size(853, 616),
-                              style=wx.DEFAULT_FRAME_STYLE, title='')
-            self._init_ctrls(parent)
-            self.HtmlFrameOpened = opened
+    def __init__(self, parent, opened):
+        wx.Frame.__init__(self, id=ID_HTMLFRAME, name='HtmlFrame',
+                          parent=parent, pos=wx.Point(320, 231),
+                          size=wx.Size(853, 616),
+                          style=wx.DEFAULT_FRAME_STYLE, title='')
+        self._init_ctrls(parent)
+        self.HtmlFrameOpened = opened
 
-        def SetHtmlCode(self, htmlcode):
-            self.HtmlContent.SetPage(htmlcode)
+    def SetHtmlCode(self, htmlcode):
+        self.HtmlContent.SetPage(htmlcode)
 
-        def SetHtmlPage(self, htmlpage):
-            self.HtmlContent.LoadPage(htmlpage)
+    def SetHtmlPage(self, htmlpage):
+        self.HtmlContent.LoadPage(htmlpage)
 
-        def OnCloseFrame(self, event):
-            self.HtmlFrameOpened.remove(self.GetTitle())
-            event.Skip()
+    def OnCloseFrame(self, event):
+        self.HtmlFrameOpened.remove(self.GetTitle())
+        event.Skip()
 
-        def OnLinkClick(self, event):
-            url = event.linkinfo[0]
-            try:
-                if wx.Platform == '__WXMSW__':
-                    import webbrowser
-                    webbrowser.open(url)
-                elif subprocess.call("firefox %s" % url, shell=True) != 0:
-                    wx.MessageBox("""Firefox browser not found.\nPlease point your browser at :\n%s""" % url)
-            except ImportError:
-                wx.MessageBox('Please point your browser at: %s' % url)
+    def OnLinkClick(self, event):
+        url = event.linkinfo[0]
+        try:
+            if wx.Platform == '__WXMSW__':
+                import webbrowser
+                webbrowser.open(url)
+            elif subprocess.call("firefox %s" % url, shell=True) != 0:
+                wx.MessageBox("""Firefox browser not found.\nPlease point your browser at :\n%s""" % url)
+        except ImportError:
+            wx.MessageBox('Please point your browser at: %s' % url)
--- a/editors/Viewer.py	Fri Sep 29 16:26:15 2017 +0300
+++ b/editors/Viewer.py	Fri Sep 29 16:39:52 2017 +0300
@@ -2445,24 +2445,24 @@
                 items.append((_(u'Divergence'), self.GetAddToWireMenuCallBack(self.AddNewDivergence,
                                                                               poss_div_types)))
         elif start_direction == EAST:
+            items.extend([
+                (_(u'Block'), self.GetAddToWireMenuCallBack(self.AddNewBlock)),
+                (_(u'Connection'), self.GetAddToWireMenuCallBack(self.AddNewConnection))])
+
+            if self.CurrentLanguage != "FBD":
+                items.append((_(u'Contact'), self.GetAddToWireMenuCallBack(self.AddNewContact)))
+
+            if self.CurrentLanguage == "LD":
                 items.extend([
-                    (_(u'Block'), self.GetAddToWireMenuCallBack(self.AddNewBlock)),
-                    (_(u'Connection'), self.GetAddToWireMenuCallBack(self.AddNewConnection))])
-
-                if self.CurrentLanguage != "FBD":
-                    items.append((_(u'Contact'), self.GetAddToWireMenuCallBack(self.AddNewContact)))
-
-                if self.CurrentLanguage == "LD":
-                    items.extend([
-                        (_(u'Coil'), self.GetAddToWireMenuCallBack(self.AddNewCoil)),
-                        (_(u'Power Rail'), self.GetAddToWireMenuCallBack(self.AddNewPowerRail))])
-
-                if self.CurrentLanguage == "SFC":
-                    items.append(
-                        (_(u'Transition'), self.GetAddToWireMenuCallBack(self.AddNewTransition, True)))
-                else:
-                    items.append(
-                        (_(u'Variable'), self.GetAddToWireMenuCallBack(self.AddNewVariable, True)))
+                    (_(u'Coil'), self.GetAddToWireMenuCallBack(self.AddNewCoil)),
+                    (_(u'Power Rail'), self.GetAddToWireMenuCallBack(self.AddNewPowerRail))])
+
+            if self.CurrentLanguage == "SFC":
+                items.append(
+                    (_(u'Transition'), self.GetAddToWireMenuCallBack(self.AddNewTransition, True)))
+            else:
+                items.append(
+                    (_(u'Variable'), self.GetAddToWireMenuCallBack(self.AddNewVariable, True)))
         return items
 
     # -------------------------------------------------------------------------------
--- a/tests/tools/check_source.sh	Fri Sep 29 16:26:15 2017 +0300
+++ b/tests/tools/check_source.sh	Fri Sep 29 16:39:52 2017 +0300
@@ -211,6 +211,7 @@
     enable=$enable,C0321          # (multiple-statements) More than one statement on a single line
     enable=$enable,W0231          # (super-init-not-called) __init__ method from base class is not called
     enable=$enable,W0105          # (pointless-string-statement) String statement has no effect    
+    enable=$enable,W0311          # (bad-indentation) Bad indentation. Found 16 spaces, expected 12
 
     # enable=$enable,W0403        # relative import
     # enable=$enable,W0622        # (redefined-builtin) Redefining built-in
--- a/util/TranslationCatalogs.py	Fri Sep 29 16:26:15 2017 +0300
+++ b/util/TranslationCatalogs.py	Fri Sep 29 16:39:52 2017 +0300
@@ -59,4 +59,4 @@
 
 
 def NoTranslate(x):
-        return x
+    return x