import run_tests import re def read_fs( line: str ) -> FS: items = line.split() dev = items[ 0 ] path = items[ 1 ] fstype = items[ 2 ] opts = items[ 3 ].split( ',' ) freq = int( items[ 4 ] ) if len( items ) > 4 else 0 fsck = int( items[ 5 ] ) if len( items ) > 5 else 0 return dev, path, fstype, opts, freq, fsck def read_fstab( path: str ) -> list[ FS ]: comment = re.compile( '#.*' ) ws = re.compile( '\s*' ) res : list[ FS ] = [] with open( path, 'r' ) as f: for line in f: line = comment.sub( '', line ) if ws.fullmatch( line ): continue res.append( read_fs( line ) ) return res