import glob


def get_unprocessed_cves(directory: str) -> list:
    """Returns a list of CSV files to upload and process.

    Args:
        directory (str): Directory to look in for CSVs.

    Returns:
        cve_files (list): List of files to be processed and uploaded.
    """

    cve_files = []

    paths = glob.glob(f"{directory}/*.csv")

    for path in paths:
        try:
            cve_file = open(path, "rb")

            cve_files.append(cve_file)
        except (OSError, IOError) as error:
            print(f"Error: Could not open a CSV. {error}")

    print(f"Found {len(cve_files)} file(s) to upload.")

    return cve_files