fix pylint warning "(undefined-loop-variable) Using possibly undefined loop variable 'X'"
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Tue, 10 Oct 2017 12:21:46 +0300
changeset 1855 f33942053466
parent 1854 cff5179cc601
child 1856 c2cba67145eb
fix pylint warning "(undefined-loop-variable) Using possibly undefined loop variable 'X'"
IDEFrame.py
tests/tools/check_source.sh
--- a/IDEFrame.py	Tue Oct 10 11:58:30 2017 +0300
+++ b/IDEFrame.py	Tue Oct 10 12:21:46 2017 +0300
@@ -297,6 +297,7 @@
     if len(tabs) == 1:
         return tabs[0]
     split = None
+    split_id = None
     for idx, tab in enumerate(tabs):
         if len(tab["pages"]) == 0:
             raise ValueError("Not possible")
@@ -309,6 +310,7 @@
                 split = (wx.BOTTOM, 1.0 - float(tab["size"][1]) / float(rect.height))
                 split_rect = wx.Rect(rect.x, rect.y,
                                      rect.width, rect.height - tab["size"][1] - TAB_BORDER)
+            split_id = idx
             break
         elif tab["size"][1] == rect.height:
             if tab["pos"][0] == rect.x:
@@ -319,9 +321,10 @@
                 split = (wx.RIGHT, 1.0 - float(tab["size"][0]) / float(rect.width))
                 split_rect = wx.Rect(rect.x, rect.y,
                                      rect.width - tab["size"][0] - TAB_BORDER, rect.height)
+            split_id = id
             break
     if split is not None:
-        split_tab = tabs.pop(idx)
+        split_tab = tabs.pop(split_id)
         return {"split": split,
                 "tab": split_tab,
                 "others": ComputeTabsLayout(tabs, split_rect)}
@@ -331,7 +334,7 @@
     return tabs
 
 
-UNEDITABLE_NAMES_DICT = dict([(_(name), name) for name in UNEDITABLE_NAMES])
+UNEDITABLE_NAMES_DICT = dict([(_(n), n) for n in UNEDITABLE_NAMES])
 
 
 class IDEFrame(wx.Frame):
--- a/tests/tools/check_source.sh	Tue Oct 10 11:58:30 2017 +0300
+++ b/tests/tools/check_source.sh	Tue Oct 10 12:21:46 2017 +0300
@@ -201,6 +201,8 @@
     disable=$disable,W0613        # (unused-argument) Unused argument 'X'
     disable=$disable,W0622        # (redefined-builtin) Redefining built-in
     disable=$disable,W0621        # (redefined-outer-name) Redefining name 'Y' from outer scope (line X)    
+    disable=$disable,W0122        # (exec-used) Use of exec
+    disable=$disable,W0123        # (eval-used) Use of eval
 
     # It'd be nice to fix warnings below some day
     disable=$disable,C0111        # missing-docstring
@@ -230,6 +232,7 @@
     enable=$enable,W0102          # (dangerous-default-value) Dangerous default value {} as argument
     enable=$enable,W0403          # (relative-import) Relative import 'Y', should be 'X.Y'
     enable=$enable,C0112          # (empty-docstring)
+    enable=$enable,W0631          # (undefined-loop-variable) Using possibly undefined loop variable 'X'
     # enable=
 
     options=