def file_to_list(path):
    """
    Return the contents of a file as a list when given a path.
    """
    if not os.path.exists(path):
        ui.error(c.MESSAGES["path_missing"], path)
        sys.exit(1)

    with codecs.open(path, "r", "UTF-8") as contents:
        lines = contents.read().splitlines()

    return lines
def file_to_list ( path ) : if not os . path . exists ( path ) : ui . error ( c . MESSAGES [ "path_missing" ] , path ) sys . exit ( 1 ) with codecs . open ( path , "r" , "UTF-8" ) as contents : lines = contents . read ( ) . splitlines ( ) return lines
Return the contents of a file as a list when given a path.