<s> '''<STR_LIT>''' <EOL> import pep8 <EOL> import glob <EOL> import os <EOL> from nose . tools import ok_ <EOL> EXPRESSIONS = ( <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> IGNORE = set ( ( '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , ) ) <EOL> def check_style ( filename ) : <EOL> '''<STR_LIT>''' <EOL> p = pep8 . StyleGuide ( quiet = True ) <EOL> report = p . check_files ( [ filename ] ) <EOL> take = [ y for x , y <EOL> in report . counters . items ( ) if x not in IGNORE ] <EOL> found = [ '<STR_LIT>' % ( x , y ) for x , y <EOL> in report . counters . items ( ) if x not in IGNORE ] <EOL> total = sum ( take ) <EOL> ok_ ( total == <NUM_LIT:0> , <EOL> '<STR_LIT>' % '<STR_LIT:U+002C>' . join ( found ) ) <EOL> def test_style ( ) : <EOL> '''<STR_LIT>''' <EOL> for label , expression in EXPRESSIONS : <EOL> files = glob . glob ( expression ) <EOL> files . sort ( ) <EOL> for f in files : <EOL> if os . path . isdir ( f ) : <EOL> continue <EOL> check_style . description = os . path . abspath ( f ) <EOL> yield ( check_style , os . path . abspath ( f ) ) </s>
