

def _read_last_lines(num_lines, mesos_file):
    'Returns the last `num_lines` of a file, or less if the file is\n    smaller.  Seeks to EOF.\n    '
    file_size = mesos_file.size()
    fetch_size = (LINE_SIZE * num_lines)
    end = file_size
    start = max((end - lines), 0)
    data = ''
    while True:
        mesos_file.seek(start)
        data = (mesos_file.read((end - start)) + data)
        data_tmp = _strip_trailing_newline(data)
        lines = data_tmp.split('\n')
        if (len(lines) > num_lines):
            ret = lines[(- num_lines):]
            break
        elif (start == 0):
            ret = lines
            break
        end = start
        start = max((end - fetch_size), 0)
    mesos_file.seek(file_size)
    return ret

dataset/ETHPy150Open shopkeep/shpkpr/shpkpr/files.py _read_last_lines/VarMisuse@41/106 `fetch_size`->`lines`