reproduce / evaluations /requirements.py
attilasimko's picture
What did I do before then?
77f290b
raw
history blame
1.26 kB
from .utils import log
def evaluate(verbose, llm, zip, readme):
log(verbose, "LOG", "\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(verbose, "LOG", f"Found requirements file: {file}")
requirements = zip.open(file).read().decode("utf-8")
overall = "Yes"
if (len(requirements.split("\n")) < 5):
log(verbose, "WARNING", "Requirements file contains too few lines.")
overall = "No"
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(verbose, "LOG", "Found dependencies in README file")
overall = "Yes"
return overall