Skip to content

Commit

Permalink
Rename e2xgrader_base_app to e2xcore
Browse files Browse the repository at this point in the history
  • Loading branch information
tmetzl committed May 20, 2023
1 parent 464e324 commit a4cf5e8
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from e2xgrader_base_app import BaseApp
from e2xcore import BaseApp

from .handlers import default_handlers

Expand Down
3 changes: 2 additions & 1 deletion e2xgrader/server_extensions/apps/authoring/apihandlers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import os

from e2xcore import urljoin
from jupyter_client.kernelspec import KernelSpecManager
from nbgrader.server_extensions.formgrader.base import check_xsrf
from tornado import web
Expand All @@ -14,9 +15,9 @@
TaskPoolModel,
TemplateModel,
)
from e2xgrader.utils import NotebookVariableExtractor, urljoin

from ..e2xgraderapi.base import E2xApiHandler
from .notebookvariableextractor import NotebookVariableExtractor


class BaseApiManageHandler(E2xApiHandler):
Expand Down
2 changes: 1 addition & 1 deletion e2xgrader/server_extensions/apps/authoring/authoring.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from e2xgrader_base_app import BaseApp
from e2xcore import BaseApp
from nbgrader.apps.baseapp import NbGrader
from tornado import web

Expand Down
2 changes: 1 addition & 1 deletion e2xgrader/server_extensions/apps/authoring/handlers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys

from e2xcore import urljoin
from nbgrader.server_extensions.formgrader.base import (
BaseHandler,
check_notebook_dir,
Expand All @@ -9,7 +10,6 @@
from tornado import web

from e2xgrader.models import ExerciseModel, TaskPoolModel, TemplateModel
from e2xgrader.utils import urljoin

app_url = urljoin("e2x", "authoring", "app")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import re

import nbformat


class NotebookVariableExtractor:
def __init__(self):
self.__pattern = re.compile(r"{{\s*(\w+)\s*}}")

def extract(self, nb_path):
nb = nbformat.read(nb_path, as_version=4)
variables = []
for cell in nb.cells:
source = cell.source
variables.extend(self.__pattern.findall(source))
return variables
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from e2xgrader_base_app import BaseApp
from e2xcore import BaseApp
from nbgrader.apps.baseapp import NbGrader

from .apihandlers import default_handlers
Expand Down
2 changes: 1 addition & 1 deletion e2xgrader/server_extensions/apps/formgrader/formgrader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from e2xgrader_base_app import BaseApp
from e2xcore import BaseApp
from nbgrader.apps.baseapp import NbGrader
from nbgrader.server_extensions.formgrader import handlers as nbgrader_handlers
from tornado import web
Expand Down
3 changes: 1 addition & 2 deletions e2xgrader/server_extensions/apps/formgrader/handlers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os

from e2xcore import format_url
from nbgrader.api import MissingEntry
from nbgrader.server_extensions.formgrader.base import (
BaseHandler,
Expand All @@ -11,8 +12,6 @@
)
from tornado import web

from e2xgrader.utils import format_url


class ExportGradesHandler(BaseHandler):
@web.authenticated
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from e2xgrader_base_app import BaseApp
from e2xcore import BaseApp
from nbgrader.apps.baseapp import NbGrader
from nbgrader.server_extensions.formgrader.apihandlers import default_handlers

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from e2xgrader_base_app import BaseApp
from e2xcore import BaseApp

from .handlers import default_handlers

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ classifiers=[
"Programming Language :: Python :: 3.9",
]
dependencies = [
"e2xgrader_base_app",
"e2xcore",
"nbgrader==0.7.*",
"nbconvert>=6.5",
"notebook>=6,<7",
Expand Down

0 comments on commit a4cf5e8

Please sign in to comment.