otter-service-stdalone 1.1.31__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.31 → 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.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/grade_notebooks.py +0 -4
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/upload_handle.py +3 -1
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/util.py +1 -3
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone.egg-info/PKG-INFO +1 -1
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/tests/test_upload_handle.py +5 -0
- otter_service_stdalone-1.1.31/src/otter_service_stdalone/__init__.py +0 -1
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/README.md +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/pyproject.toml +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/setup.cfg +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/access_sops_keys.py +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/app.py +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/fs_logging.py +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/index.html +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/scripts/web_socket.js +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/secrets/gh_key.dev.yaml +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/secrets/gh_key.local.yaml +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/secrets/gh_key.prod.yaml +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/secrets/gh_key.staging.yaml +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/static_files/README_DO_NOT_DISTRIBUTE.txt +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/static_templates/403.html +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/static_templates/500.html +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/user_auth.py +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone.egg-info/SOURCES.txt +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone.egg-info/dependency_links.txt +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone.egg-info/entry_points.txt +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone.egg-info/top_level.txt +0 -0
- {otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/tests/test_util.py +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "1.1.32"
|
@@ -6,7 +6,6 @@ from otter.grade import main as grade
|
|
6
6
|
from otter import logging as loggers
|
7
7
|
from multiprocessing import Process
|
8
8
|
from tornado.ioloop import PeriodicCallback
|
9
|
-
from .util import clean_directory
|
10
9
|
|
11
10
|
log_debug = f'{os.environ.get("ENVIRONMENT")}-debug'
|
12
11
|
log_count = f'{os.environ.get("ENVIRONMENT")}-count'
|
@@ -45,9 +44,6 @@ class GradeNotebooks():
|
|
45
44
|
try:
|
46
45
|
notebook_folder = uh.handle_upload(notebooks_path, results_id)
|
47
46
|
|
48
|
-
# remove special characters from notebooks and remove hidden folders
|
49
|
-
clean_directory(notebook_folder)
|
50
|
-
|
51
47
|
notebook_count = self.count_ipynb_files(notebook_folder, ".ipynb")
|
52
48
|
log.write_logs(results_id, f"{notebook_count}",
|
53
49
|
"",
|
@@ -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.31 → 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")
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "1.1.31"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{otter_service_stdalone-1.1.31 → otter_service_stdalone-1.1.32}/src/otter_service_stdalone/app.py
RENAMED
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
|