

def disk_reads_writes(device):
    'Return number of disk (reads, writes).'
    with open('/proc/diskstats') as f:
        content = f.read()
    sep = ('%s ' % device)
    found = False
    for line in content.splitlines():
        if (sep in line):
            found = True
            fields = line.strip().split(sep)[1].split()
            num_reads = int(fields[0])
            num_writes = int(fields[4])
            break
    if (not line):
        raise DiskError(('device not found: %r' % device))
    return (num_reads, num_writes)

dataset/ETHPy150Open cgoldberg/linux-metrics/linux_metrics/disk_stat.py disk_reads_writes/VarMisuse@114/148 `found`->`line`