from core.conversion import noop_logger def evaluate(llm, zip, readmes, log_fn=noop_logger): log_fn("TITLE", "\nLooking for package dependencies for running the code...") overall = "No" scripts = [file_path for file_path in zip.namelist() if ((file_path.endswith(".py") | file_path.endswith(".ipynb")))] files = [file_path for file_path in zip.namelist() if (file_path.endswith(".yml") | file_path.endswith("setup.py") | file_path.endswith("requirements.txt") | ("requirement" in file_path) | ("package" in file_path))] # files = [file_path for file_path in files if len(file_path.split("/")) == 2] for file in files: log_fn("LOG", f"Found requirements file: {file}") requirements = zip.open(file).read().decode("utf-8") if (len(requirements.split("\n")) < 5): log_fn("ERROR", "Requirements file contains too few lines.") continue overall = "Yes" for readme in readmes: if (readme): if (("requirement" in readme) | ("Requirement" in readme) | ("Dependenc" in readme) | ("dependenc" in readme) | (len([row for row in readme.split("\n") if (("#" in row) & (("environment" in row) | ("Environment" in row)))]) > 0)): log_fn("LOG", "Found dependencies in README file") overall = "Yes" return overall