otter-service-stdalone 1.1.30__tar.gz → 1.1.32__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/PKG-INFO +1 -1
- otter_service_stdalone-1.1.32/src/otter_service_stdalone/__init__.py +1 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/app.py +1 -3
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/grade_notebooks.py +1 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/upload_handle.py +3 -1
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/util.py +1 -3
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone.egg-info/PKG-INFO +1 -1
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/tests/test_upload_handle.py +5 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/tests/test_util.py +4 -2
- otter_service_stdalone-1.1.30/src/otter_service_stdalone/__init__.py +0 -1
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/README.md +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/pyproject.toml +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/setup.cfg +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/access_sops_keys.py +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/fs_logging.py +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/index.html +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/scripts/web_socket.js +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/secrets/gh_key.dev.yaml +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/secrets/gh_key.local.yaml +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/secrets/gh_key.prod.yaml +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/secrets/gh_key.staging.yaml +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/static_files/README_DO_NOT_DISTRIBUTE.txt +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/static_templates/403.html +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/static_templates/500.html +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/user_auth.py +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone.egg-info/SOURCES.txt +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone.egg-info/dependency_links.txt +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone.egg-info/entry_points.txt +0 -0
- {otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone.egg-info/top_level.txt +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "1.1.32"
|
{otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/app.py
RENAMED
@@ -12,7 +12,7 @@ from otter_service_stdalone import grade_notebooks
|
|
12
12
|
from zipfile import ZipFile, ZIP_DEFLATED
|
13
13
|
from multiprocessing import Queue
|
14
14
|
|
15
|
-
from .util import otter_version_correct
|
15
|
+
from .util import otter_version_correct
|
16
16
|
|
17
17
|
|
18
18
|
__UPLOADS__ = "/tmp/uploads"
|
@@ -303,8 +303,6 @@ class Upload(BaseHandler):
|
|
303
303
|
session_queues[user_id][results_path] = Queue()
|
304
304
|
session_messages[user_id][results_path] = []
|
305
305
|
|
306
|
-
# remove special characters from notebooks and remove hidden folders
|
307
|
-
clean_directory(notebooks_path)
|
308
306
|
await g.grade(auto_p, notebooks_path, autograder_orig_name, results_path, session_queues[user_id].get(results_path))
|
309
307
|
except Exception as e:
|
310
308
|
log.write_logs(results_path, "Grading Problem", str(e), "error", log_error)
|
@@ -2,6 +2,7 @@ import os
|
|
2
2
|
import shutil
|
3
3
|
from zipfile import ZipFile
|
4
4
|
from otter_service_stdalone import fs_logging as log
|
5
|
+
from .util import clean_directory
|
5
6
|
|
6
7
|
|
7
8
|
def handle_one_notebook(path):
|
@@ -119,7 +120,8 @@ def handle_upload(path, results_id):
|
|
119
120
|
zip_folder = path.split(".")[0]
|
120
121
|
with ZipFile(path, 'r') as zObject:
|
121
122
|
zObject.extractall(path=zip_folder)
|
122
|
-
|
123
|
+
# remove special characters from notebooks and remove hidden folders
|
124
|
+
clean_directory(zip_folder)
|
123
125
|
log.write_logs(results_id, "Step 4a: Configure Notebooks Folder for Otter Grader",
|
124
126
|
"Zipped file of notebooks Uploaded",
|
125
127
|
"debug",
|
{otter_service_stdalone-1.1.30 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/util.py
RENAMED
@@ -49,7 +49,7 @@ def sanitize_filename(filename: str) -> str:
|
|
49
49
|
# Split name and extension
|
50
50
|
name, ext = os.path.splitext(filename)
|
51
51
|
# Remove periods and commas from the name part
|
52
|
-
clean_name = name.replace('.', '').replace(',', '')
|
52
|
+
clean_name = name.replace('.', '').replace(',', '').replace(' ', '')
|
53
53
|
return f"{clean_name}{ext}"
|
54
54
|
|
55
55
|
|
@@ -62,7 +62,6 @@ def clean_directory(path: str):
|
|
62
62
|
for dir_name in list(dirs):
|
63
63
|
if dir_name.startswith('.') or dir_name == '__MACOSX':
|
64
64
|
dir_path = os.path.join(root, dir_name)
|
65
|
-
print(f"Deleting folder: {dir_path}")
|
66
65
|
shutil.rmtree(dir_path)
|
67
66
|
dirs.remove(dir_name) # remove from list to avoid walking it
|
68
67
|
|
@@ -72,5 +71,4 @@ def clean_directory(path: str):
|
|
72
71
|
new_name = sanitize_filename(file_name)
|
73
72
|
new_path = os.path.join(root, new_name)
|
74
73
|
if old_path != new_path:
|
75
|
-
print(f"Renaming {old_path} -> {new_path}")
|
76
74
|
os.rename(old_path, new_path)
|
@@ -11,6 +11,7 @@ def resources():
|
|
11
11
|
l4 = "tests/files/lab04/lab04.ipynb"
|
12
12
|
n1 = "tests/files/hw3-submissions-only-notebooks"
|
13
13
|
n2 = "tests/files/hw3-submissions-notebooks-zips-mixed"
|
14
|
+
n3 = "tests/files/clean_up"
|
14
15
|
shutil.copy("tests/files/student_1.zip", "/".join(s1.split("/")[:-1]))
|
15
16
|
shutil.copy("tests/files/student_4.zip", "/".join(s4.split("/")[:-1]))
|
16
17
|
yield "resources"
|
@@ -25,6 +26,8 @@ def resources():
|
|
25
26
|
shutil.rmtree(n1)
|
26
27
|
if os.path.exists(n2):
|
27
28
|
shutil.rmtree(n2)
|
29
|
+
if os.path.exists(n3):
|
30
|
+
shutil.rmtree(n3)
|
28
31
|
|
29
32
|
|
30
33
|
def test_one_notebook(resources):
|
@@ -58,7 +61,9 @@ def test_period_in_notebook_name(resources):
|
|
58
61
|
def test_handle_upload(resources):
|
59
62
|
zip = "tests/files/hw3-submissions-only-notebooks.zip"
|
60
63
|
mixed_zip = "tests/files/hw3-submissions-notebooks-zips-mixed.zip"
|
64
|
+
clean = "tests/files/clean_up.zip"
|
61
65
|
assert "tests/files" in uh.handle_upload("tests/files/hw3.ipynb", "test-up-123")
|
62
66
|
assert "files/hw3-submissions-only-notebooks" in uh.handle_upload(zip, "test-up-123")
|
63
67
|
assert "files/hw3-submissions-only-notebooks" in uh.handle_upload(zip, "test-up-123")
|
64
68
|
assert "files/hw3-submissions-notebooks-zips-mixed" in uh.handle_upload(mixed_zip, "test-up-123")
|
69
|
+
assert "files/clean_up" in uh.handle_upload(clean, "test-up-123")
|
@@ -8,9 +8,11 @@ def test_autograder_zip_version():
|
|
8
8
|
a1 = "tests/files/hw01-autograder_6_0_4.zip"
|
9
9
|
a2 = "tests/files/hw02-autograder_6_1_0.zip"
|
10
10
|
a3 = "tests/files/hw02-autograder_5_5_0.zip"
|
11
|
-
|
12
|
-
assert util.otter_version_correct(
|
11
|
+
a4 = "tests/files/hw03-autograder_6_1_3.zip"
|
12
|
+
assert util.otter_version_correct(a1) is False
|
13
|
+
assert util.otter_version_correct(a2) is False
|
13
14
|
assert util.otter_version_correct(a3) is False
|
15
|
+
assert util.otter_version_correct(a4) is False
|
14
16
|
|
15
17
|
|
16
18
|
def test_clean_directory():
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "1.1.30"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|