Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 1,262 Bytes
77f290b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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 |