Plugins/CheckerPlugins/Tabnanny/Tabnanny.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2680
110ac646a3a0
parent 3004
c4bf32c791d0
child 3060
5883ce99ee12
--- a/Plugins/CheckerPlugins/Tabnanny/Tabnanny.py	Tue Oct 15 22:03:54 2013 +0200
+++ b/Plugins/CheckerPlugins/Tabnanny/Tabnanny.py	Fri Oct 18 23:00:41 2013 +0200
@@ -37,7 +37,8 @@
 #   linenumber and the error message (boolean, string, string, string). The
 #   values are only valid, if the status equals 1.
 #
-# Mofifications Copyright (c) 2003-2013 Detlev Offenbach <detlev@die-offenbachs.de>
+# Mofifications Copyright (c) 2003-2013 Detlev Offenbach
+# <detlev@die-offenbachs.de>
 #
 
 __version__ = "6_eric"
@@ -58,6 +59,8 @@
 
 class NannyNag(Exception):
     """
+    Class implementing an exception for indentation issues.
+    
     Raised by tokeneater() if detecting an ambiguous indent.
     Captured and handled in check().
     """
@@ -98,7 +101,8 @@
 
 def check(file, text=""):
     """
-    Private function to check one Python source file for whitespace related problems.
+    Private function to check one Python source file for whitespace related
+    problems.
     
     @param file source filename (string)
     @param text source text (string)
@@ -126,7 +130,8 @@
         return (True, file, "1", "Token Error: {0}".format(str(msg)))
     
     except IndentationError as err:
-        return (True, file, err.lineno, "Indentation Error: {0}".format(str(err.msg)))
+        return (True, file, err.lineno,
+                "Indentation Error: {0}".format(str(err.msg)))
     
     except NannyNag as nag:
         badline = nag.get_lineno()
@@ -236,7 +241,8 @@
     # for all t >= 1
     def equal(self, other):
         """
-        Method to compare the indentation levels of two Whitespace objects for equality.
+        Method to compare the indentation levels of two Whitespace objects for
+        equality.
         
         @param other Whitespace object to compare against.
         @return True, if we compare equal against the other Whitespace object.
@@ -283,8 +289,8 @@
     # Note that M is of the form (T*)(S*) iff len(M.norm[0]) <= 1.
     def less(self, other):
         """
-        Method to compare the indentation level against another Whitespace objects to
-        be smaller.
+        Method to compare the indentation level against another Whitespace
+        objects to be smaller.
         
         @param other Whitespace object to compare against.
         @return True, if we compare less against the other Whitespace object.
@@ -346,6 +352,7 @@
     Function processing all tokens generated by a tokenizer run.
     
     @param tokens list of tokens
+    @exception NannyNag raised to indicate an indentation error
     """
     INDENT = tokenize.INDENT
     DEDENT = tokenize.DEDENT
@@ -381,7 +388,8 @@
             # Ouch!  This assert triggers if the last line of the source
             # is indented *and* lacks a newline -- then DEDENTs pop out
             # of thin air.
-            # assert check_equal  # else no earlier NEWLINE, or an earlier INDENT
+            # assert check_equal  # else no earlier NEWLINE, or an
+            # earlier INDENT
             check_equal = 1
 
             del indents[-1]

eric ide

mercurial