<s> from __future__ import print_function <EOL> import sys <EOL> def main ( argv ) : <EOL> if len ( argv ) != <NUM_LIT:2> : <EOL> print ( '<STR_LIT>' ) <EOL> return <EOL> file = argv [ <NUM_LIT:1> ] <EOL> mode = file . split ( '<STR_LIT:.>' ) [ <NUM_LIT:1> ] <EOL> if mode == '<STR_LIT>' : <EOL> cKey = '<STR_LIT:#>' <EOL> elif mode == '<STR_LIT:c>' : <EOL> cKey = '<STR_LIT>' <EOL> sKey = '<STR_LIT>' <EOL> eKey = '<STR_LIT>' <EOL> else : <EOL> print ( '<STR_LIT>' ) <EOL> return <EOL> comment = loc = blank = <NUM_LIT:0> <EOL> with open ( file , '<STR_LIT:r>' ) as f : <EOL> for line in f . readlines ( ) : <EOL> line = line . strip ( ) <EOL> if not line : <EOL> blank += <NUM_LIT:1> <EOL> elif line . startswith ( cKey ) : <EOL> comment += <NUM_LIT:1> <EOL> elif mode == '<STR_LIT:c>' and line . startswith ( sKey ) and line . endswith ( eKey ) : <EOL> comment += <NUM_LIT:1> <EOL> elif mode == '<STR_LIT:c>' and line . startswith ( sKey ) : <EOL> cFlag = True <EOL> comment += <NUM_LIT:1> <EOL> elif mode == '<STR_LIT:c>' and line . endswith ( eKey ) : <EOL> cFlag = False <EOL> comment += <NUM_LIT:1> <EOL> elif mode == '<STR_LIT:c>' and cFlag : <EOL> comment += <NUM_LIT:1> <EOL> else : <EOL> loc += <NUM_LIT:1> <EOL> print ( ) <EOL> print ( '<STR_LIT>' , file ) <EOL> print ( '<STR_LIT>' , loc ) <EOL> print ( '<STR_LIT>' , comment ) <EOL> print ( '<STR_LIT>' , blank ) <EOL> print ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( sys . argv ) </s>
