def file_basename(self, file):
valid_extensions = set("<STR_LIT>",<EOL>"<STR_LIT>")<EOL>split_file = os.path.basename(file).split('<STR_LIT:.>')<EOL>base, suffix = '<STR_LIT:.>'.join(split_file[:-<NUM_LIT:1>]), split_file[-<NUM_LIT:1>]<EOL>if suffix in valid_extensions:<EOL><INDENT>return base<EOL><DEDENT>else:<EOL><INDENT>logging.error("<STR_LIT>" % file)<EOL>logging.error("<STR_LIT>" % '<STR_LIT:U+0020>'.join(valid_extensions.keys()))<EOL>raise InvalidFileExtensionError<EOL><DEDENT>
Strips the path and last extension from the file variable. If the
extension is found to be valid, the basename will be returned. Otherwise
an error will be raise and graftM will exit