(all=False)
return retlist
Return mounted disk partitions as a list of namedtuples
Return mounted disk partitions as a list of namedtuples
Return mounted disk partitions as a list of namedtuples
def disk_partitions(all=False):
    """Return mounted disk partitions as a list of namedtuples"""
    fstypes = set()
    with open_text("/proc/filesystems") as f:
        for line in f:
            line = line.strip()
            if not line.startswith("nodev"):
                fstypes.add(line.strip())
            else:
                # ignore all lines starting with "nodev" except "nodev zfs"
                fstype = line.split("\t")[1]
                if fstype == "zfs":
                    fstypes.add("zfs")

    retlist = []
    partitions = cext.disk_partitions()
    for partition in partitions:
        device, mountpoint, fstype, opts = partition
        if device == 'none':
            device = ''
        if not all:
            if device == '' or fstype not in fstypes:
                continue
        ntuple = _common.sdiskpart(device, mountpoint, fstype, opts)
        retlist.append(ntuple)
    return retlist
def disk_partitions ( all = False ) : fstypes = set ( ) with open_text ( "/proc/filesystems" ) as f : for line in f : line = line . strip ( ) if not line . startswith ( "nodev" ) : fstypes . add ( line . strip ( ) ) else : # ignore all lines starting with "nodev" except "nodev zfs" fstype = line . split ( "\t" ) [ 1 ] if fstype == "zfs" : fstypes . add ( "zfs" ) retlist = [ ] partitions = cext . disk_partitions ( ) for partition in partitions : device , mountpoint , fstype , opts = partition if device == 'none' : device = '' if not all : if device == '' or fstype not in fstypes : continue ntuple = _common . sdiskpart ( device , mountpoint , fstype , opts ) retlist . append ( ntuple ) return retlist