Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • tuhe/unitgrade_private
1 result
Show changes
Commits on Source (2)
Showing
with 133 additions and 18 deletions
# example_moss/tmp/submissions/s1002/0_homework1.py
# example_moss/tmp/submissions/s1001/0_homework1.py
def reverse_list(mylist): #!f
"""
Given a list 'mylist' returns a list consisting of the same elements in reverse order. E.g.
reverse_list([1,2,3]) should return [3,2,1] (as a list).
"""
ls = []
for l in mylist:
ls = [l] + ls
return ls
# return list(reversed(mylist))
return list(reversed(mylist))
def add(a,b): #!f
""" Given two numbers `a` and `b` this function should simply return their sum:
> add(a,b) = a+b """
sum = a + b
return sum
return a+b
if __name__ == "__main__":
# Example usage:
......
# example_moss/tmp/submissions/s1001/0_homework1.py
def reverse_list(mylist): #!f
"""
Given a list 'mylist' returns a list consisting of the same elements in reverse order. E.g.
reverse_list([1,2,3]) should return [3,2,1] (as a list).
"""
return list(reversed(mylist))
def add(a,b): #!f
""" Given two numbers `a` and `b` this function should simply return their sum:
> add(a,b) = a+b """
return a+b
if __name__ == "__main__":
# Example usage:
print(f"Your result of 2 + 2 = {add(2,2)}")
print(f"Reversing a small list", reverse_list([2,3,5,7]))
\ No newline at end of file
# autolab_example_py_upload/instructor/cs102_autolab/deploy_autolab.py
# autolab_example_py_upload/instructor/cs102_autolab/deploy_autolab.py
# Step 1: Download and compile docker grading image. You only need to do this once.
download_docker_images("../docker") # Download docker images from gitlab (only do this once).
dockerfile = f"../docker/docker_tango_python/Dockerfile"
......
# autolab_example_py_upload/instructor/cs102_autolab/deploy_autolab.py
# Step 1: Download and compile docker grading image. You only need to do this once.
download_docker_images("../docker") # Download docker images from gitlab (only do this once).
dockerfile = f"../docker/docker_tango_python/Dockerfile"
autograde_image = 'tango_python_tue2' # Tag given to the image in case you have multiple images.
compile_docker_image(Dockerfile=dockerfile, tag=autograde_image, no_cache=False) # Compile docker image.
\ No newline at end of file
# autolab_example_py_upload/instructor/cs102_autolab/deploy_autolab.py
# autolab_example_py_upload/instructor/cs102_autolab/deploy_autolab.py
# Step 2: Create the cs102.tar file from the grade scripts.
instructor_base = f"."
student_base = f"../../students/cs102_autolab"
......
# autolab_example_py_upload/instructor/cs102_autolab/deploy_autolab.py
# Step 2: Create the cs102.tar file from the grade scripts.
instructor_base = f"."
student_base = f"../../students/cs102_autolab"
from report2_test import Report2
# INSTRUCTOR_GRADE_FILE =
output_tar = new_deploy_assignment("cs105h", # Autolab name of assignment (and name of .tar file)
INSTRUCTOR_BASE=instructor_base,
INSTRUCTOR_GRADE_FILE=f"{instructor_base}/report2_test_grade.py",
STUDENT_BASE=student_base,
STUDENT_GRADE_FILE=f"{instructor_base}/report2_test.py",
autograde_image_tag=autograde_image,
homework_file="homework1.py")
\ No newline at end of file
# example_docker/instructor/cs103/deploy.py
if __name__ == "__main__":
# Step 1: Deploy the students files and return the directory they were written to
setup_grade_file_report(Report3) # Create report3_complete_grade.py which tests everything
fout, Report = remove_hidden_methods(Report3, outfile="report3.py") # Create report3.py without @hide-methods
setup_grade_file_report(Report) # Create report3_grade.py for the students
student_directory = "../../students/cs103"
snip_dir("./", student_directory, exclude=['*.token', 'deploy.py', 'report3_complete*.py', '.*'])
\ No newline at end of file
# example_docker/instructor/cs103/deploy.py
# example_docker/instructor/cs103/deploy.py
os.system("cd ../../students && python -m cs103.report3_grade")
student_token_file = glob.glob(student_directory + "/*.token").pop()
\ No newline at end of file
# example_docker/instructor/cs103/deploy.py
os.system("cd ../../students && python -m cs103.report3_grade")
student_token_file = glob.glob(student_directory + "/*.token").pop()
\ No newline at end of file
# example_docker/instructor/cs103/deploy.py
# example_docker/instructor/cs103/deploy.py
# Step 3: Compile the Docker image (obviously you should only do this once).
download_docker_images(destination="../docker") # Download an up-to-date docker image from gitlab.
Dockerfile = "../docker/unitgrade-docker/Dockerfile" # Location of just downloaded docker file
......
# example_docker/instructor/cs103/deploy.py
# Step 3: Compile the Docker image (obviously you should only do this once).
download_docker_images(destination="../docker") # Download an up-to-date docker image from gitlab.
Dockerfile = "../docker/unitgrade-docker/Dockerfile" # Location of just downloaded docker file
compile_docker_image(Dockerfile, tag="unitgrade-docker")
\ No newline at end of file
# example_docker/instructor/cs103/deploy.py
# example_docker/instructor/cs103/deploy.py
# Step 4: Test the students code in the .token file and get the results-token-file:
token = docker_run_token_file(Dockerfile_location=Dockerfile,
host_tmp_dir=os.path.dirname(Dockerfile) + "/home",
......
# example_docker/instructor/cs103/deploy.py
# Step 4: Test the students code in the .token file and get the results-token-file:
token = docker_run_token_file(Dockerfile_location=Dockerfile,
host_tmp_dir=os.path.dirname(Dockerfile) + "/home",
student_token_file=student_token_file,
instructor_grade_script="report3_complete_grade.py",
tag="unitgrade-docker")
\ No newline at end of file
# example_docker/instructor/cs103/deploy.py
# example_docker/instructor/cs103/deploy.py
# Load the two token files and compare their scores
checked_token, _ = load_token(token)
results, _ = load_token(student_token_file)
......
# example_docker/instructor/cs103/deploy.py
# Load the two token files and compare their scores
checked_token, _ = load_token(token)
results, _ = load_token(student_token_file)
print("Student's score was:", results['total'])
print("My independent evaluation of the students score was", checked_token['total'])
\ No newline at end of file
# example_simplest/instructor/cs101/deploy.py
from cs101.report1 import Report1
from unitgrade_private.hidden_create_files import setup_grade_file_report
from snipper import snip_dir
if __name__ == "__main__":
setup_grade_file_report(Report1) # Make the report1_grade.py report file
# Deploy the files using snipper: https://gitlab.compute.dtu.dk/tuhe/snipper
snip_dir("./", "../../students/cs101", exclude=['__pycache__', '*.token', 'deploy.py'])
\ No newline at end of file
# autolab_example_py_upload/instructor/cs102_autolab/homework1.py
# example_flat/instructor/cs101flat/homework1.py
def reverse_list(mylist): #!f
"""
Given a list 'mylist' returns a list consisting of the same elements in reverse order. E.g.
......@@ -9,8 +9,9 @@ def reverse_list(mylist): #!f
def add(a,b): #!f
""" Given two numbers `a` and `b` this function should simply return their sum:
> add(a,b) = a+b """
return a+b*2
return a+b
if __name__ == "__main__": # Example usage:
if __name__ == "__main__":
# Example usage:
print(f"Your result of 2 + 2 = {add(2,2)}")
print(f"Reversing a small list", reverse_list([2,3,5,7]))
\ No newline at end of file
# example_flat/instructor/cs101flat/homework1.py
def reverse_list(mylist): #!f
"""
Given a list 'mylist' returns a list consisting of the same elements in reverse order. E.g.
reverse_list([1,2,3]) should return [3,2,1] (as a list).
"""
return list(reversed(mylist))
def add(a,b): #!f
""" Given two numbers `a` and `b` this function should simply return their sum:
> add(a,b) = a+b """
return a+b
if __name__ == "__main__":
# Example usage:
print(f"Your result of 2 + 2 = {add(2,2)}")
print(f"Reversing a small list", reverse_list([2,3,5,7]))
\ No newline at end of file
# example_hints/instructor/cs106/homework_hints.py
def find_primes(n): #!f
"""
Return a list of all primes up to (and including) n
Hints:
* Remember to return a *list* (and not a tuple or numpy ndarray)
* Remember to include n if n is a prime
* The first few primes are 2, 3, 5, ...
"""
primes = [p for p in range(2, n+1) if is_prime(n) ]
return primes
def is_prime(n): #!f
"""
Return true iff n is a prime
Hints:
* A number is a prime if it has no divisors
* You can check if k divides n using the modulo-operator. I.e. n % k == True if k divides n.
"""
for k in range(2, n):
if k % n == 0: # This line is intentionally buggy so that we see the hint!
return False
return True
\ No newline at end of file
# example_in_progress/in_progress.py
# example_in_progress/in_progress.py
self.title = f"Checking if reverse_list({ls}) = {reverse}" # Programmatically set the title
def ex_test_output_capture(self):
......