Skip to content
Snippets Groups Projects
Commit a697b1c4 authored by tuhe's avatar tuhe
Browse files

Removed bad __main__ block that caused buggy behavior in some cases

parent 193eeaef
No related branches found
No related tags found
No related merge requests found
Metadata-Version: 2.1 Metadata-Version: 2.1
Name: unitgrade Name: unitgrade
Version: 0.1.30.9 Version: 0.1.30.15
Summary: A student homework/exam evaluation framework build on pythons unittest framework. Summary: A student homework/exam evaluation framework build on pythons unittest framework.
Home-page: https://lab.compute.dtu.dk/tuhe/unitgrade Home-page: https://lab.compute.dtu.dk/tuhe/unitgrade
Author: Tue Herlau Author: Tue Herlau
......
This diff is collapsed.
...@@ -287,6 +287,8 @@ def hash_string(s): ...@@ -287,6 +287,8 @@ def hash_string(s):
# gfg.update(s.encode("utf-8")) # gfg.update(s.encode("utf-8"))
# return gfg.digest() # return gfg.digest()
def hash2url(hash):
return hash[:16]
def picklestring2dict(picklestr): def picklestring2dict(picklestr):
""" Reverse of the above method: Turns the string back into a dictionary. """ """ Reverse of the above method: Turns the string back into a dictionary. """
...@@ -335,6 +337,8 @@ def checkout_remote_results(remote_url, manifest): ...@@ -335,6 +337,8 @@ def checkout_remote_results(remote_url, manifest):
SEP = "-----------" SEP = "-----------"
remote = {ll[0]: ll[1] for ll in [l.strip().split(" ") for l in html.split(SEP)[1].strip().splitlines()] } remote = {ll[0]: ll[1] for ll in [l.strip().split(" ") for l in html.split(SEP)[1].strip().splitlines()] }
# lines = # lines =
# print(remote_url)
# print(remote)
mf = [m.strip().split(" ")[-1] for m in manifest.strip().splitlines()] mf = [m.strip().split(" ")[-1] for m in manifest.strip().splitlines()]
a = 23 a = 23
...@@ -342,7 +346,7 @@ def checkout_remote_results(remote_url, manifest): ...@@ -342,7 +346,7 @@ def checkout_remote_results(remote_url, manifest):
url = None url = None
for hash in reversed(mf): for hash in reversed(mf):
if hash_string(hash) in remote: if hash_string(hash) in remote:
url = f"{remote_url}/{os.path.dirname( remote[hash_string(hash)] )}/{hash}/index.html" url = f"{remote_url}/{os.path.dirname( remote[hash_string(hash)] )}/{hash2url(hash)}/index.html"
with urllib.request.urlopen(url) as response: with urllib.request.urlopen(url) as response:
html = response.read().decode() html = response.read().decode()
# print( html ) # print( html )
...@@ -354,7 +358,6 @@ def checkout_remote_results(remote_url, manifest): ...@@ -354,7 +358,6 @@ def checkout_remote_results(remote_url, manifest):
df = dfs[0] df = dfs[0]
# df.__format__() # df.__format__()
# tabular # tabular
# print( df.to_string(index=False) ) # print( df.to_string(index=False) )
# df.as # df.as
result = dict(html=html, df=df, score=float( df.iloc[2].to_list()[-1] ), url=url) result = dict(html=html, df=df, score=float( df.iloc[2].to_list()[-1] ), url=url)
...@@ -430,10 +433,10 @@ class DKPupDB: ...@@ -430,10 +433,10 @@ class DKPupDB:
return item in self.dk[self.name_] #keys() return item in self.dk[self.name_] #keys()
# return item in self.dk # return item in self.dk
if __name__ == "__main__": # if __name__ == "__main__":
url = "https://cp.pages.compute.dtu.dk/02002public/_static/evaluation/" # url = "https://cp.pages.compute.dtu.dk/02002public/_static/evaluation/"
manifest = """ # manifest = """
/home/tuhe/Documents/unitgrade_private/src/unitgrade_private/pipelines/tmp/students/cp/project0/Project0_handin_0_of_10.token 7720b41ab925098956c7db37c8292ce3a7b4ded96f4442234dee493c021fc5f7294e543de78630aaf873b756d25bf7b4fd7eb6e66cec282b54f0c35b83e9071f # /home/tuhe/Documents/unitgrade_private/src/unitgrade_private/pipelines/tmp/students/cp/project0/Project0_handin_0_of_10.token 7720b41ab925098956c7db37c8292ce3a7b4ded96f4442234dee493c021fc5f7294e543de78630aaf873b756d25bf7b4fd7eb6e66cec282b54f0c35b83e9071f
""" # """
checkout_remote_results(url, manifest = manifest) # # checkout_remote_results(url, manifest = manifest)
__version__ = "0.1.30.9" __version__ = "0.1.30.15"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment