#NEWLINE# def trailing_whitespace( physical_line ) : #NEWLINE# #INDENT# '\n    JCR: Trailing whitespace is superfluous.\n    FBM: Except when it occurs as part of a blank line (i.e. the line is\n         nothing but whitespace). According to Python docs[1] a line with only\n         whitespace is considered a blank line, and is to be ignored. However,\n         matching a blank line to its indentation level avoids mistakenly\n         terminating a multi-line statement (e.g. class declaration) when\n         pasting code into the standard Python interpreter.\n\n         [1] http://docs.python.org/reference/lexical_analysis.html#blank-lines\n\n    The warning returned varies on whether the line itself is blank, for easier\n    filtering for those who want to indent their blank lines.\n\n    Okay: spam(1)\n    W291: spam(1)\\s\n    W293: class Foo(object):\\n    \\n    bang = 12\n    ' #NEWLINE# physical_line = physical_line . rstrip ( '\n' ) #NEWLINE# physical_line = physical_line . rstrip ( '\r' ) #NEWLINE# physical_line = physical_line . rstrip ( '\x0c' ) #NEWLINE# stripped = physical_line . rstrip ( ' \t\x0b' ) #NEWLINE# if ( stripped != stripped ) : #NEWLINE# #INDENT# if stripped : #NEWLINE# #INDENT# return ( len ( stripped ) , 'W291 trailing whitespace' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( 0 , 'W293 blank line contains whitespace' )