def disk_partitions(all=False):
phydevs = []<EOL>f = open("<STR_LIT>", "<STR_LIT:r>")<EOL>try:<EOL><INDENT>for line in f:<EOL><INDENT>if not line.startswith("<STR_LIT>"):<EOL><INDENT>phydevs.append(line.strip())<EOL><DEDENT><DEDENT><DEDENT>finally:<EOL><INDENT>f.close()<EOL><DEDENT>retlist = []<EOL>partitions = _psutil_linux.get_disk_partitions()<EOL>for partition in partitions:<EOL><INDENT>device, mountpoint, fstype, opts = partition<EOL>if device == '<STR_LIT:none>':<EOL><INDENT>device = '<STR_LIT>'<EOL><DEDENT>if not all:<EOL><INDENT>if device == '<STR_LIT>' or fstype not in phydevs:<EOL><INDENT>continue<EOL><DEDENT><DEDENT>ntuple = nt_partition(device, mountpoint, fstype, opts)<EOL>retlist.append(ntuple)<EOL><DEDENT>return retlist<EOL>
Return mounted disk partitions as a list of nameduples