human
get line count
assistant
Here is some code to get line count of file `filename`

def bufcount(filename):
    f = open(filename)
    lines = 0
    buf_size = (1024 * 1024)
    read_f = f.read
    buf = read_f(buf_size)
    while buf:
        lines += buf.count('\n')
        buf = read_f(buf_size)
    return lines

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.