def countLines(filename, buf_size=<NUM_LIT>):
f = open(filename)<EOL>try:<EOL><INDENT>lines = <NUM_LIT:1><EOL>read_f = f.read  <EOL>buf = read_f(buf_size)<EOL>if not buf:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>while buf:<EOL><INDENT>lines += buf.count('<STR_LIT:\n>')<EOL>buf = read_f(buf_size)<EOL><DEDENT>return lines<EOL><DEDENT>finally:<EOL><INDENT>f.close()<EOL><DEDENT>
fast counting to the lines of a given filename
through only reading out a limited buffer