e2xcore 0.0.1__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.
- e2xcore-0.0.1/.gitignore +139 -0
- e2xcore-0.0.1/.pre-commit-config.yaml +17 -0
- e2xcore-0.0.1/.ruff_cache/.gitignore +1 -0
- e2xcore-0.0.1/.ruff_cache/CACHEDIR.TAG +1 -0
- e2xcore-0.0.1/.ruff_cache/content/28e32ca0ac5f358 +0 -0
- e2xcore-0.0.1/.ruff_cache/content/3c52bb72a04b6bd9 +0 -0
- e2xcore-0.0.1/.ruff_cache/content/44ecbf6b468661d7 +0 -0
- e2xcore-0.0.1/.ruff_cache/content/621e93c67b18efc9 +0 -0
- e2xcore-0.0.1/.ruff_cache/content/81b832535905bf56 +0 -0
- e2xcore-0.0.1/.ruff_cache/content/83081bac811ca6b2 +0 -0
- e2xcore-0.0.1/.ruff_cache/content/9cd1d6bbd710c3e3 +0 -0
- e2xcore-0.0.1/.ruff_cache/content/a15ab731fb008f6d +0 -0
- e2xcore-0.0.1/.ruff_cache/content/a55ee5d2fa9e5bbd +0 -0
- e2xcore-0.0.1/.ruff_cache/content/c3cc4a7b099c5848 +0 -0
- e2xcore-0.0.1/LICENSE +21 -0
- e2xcore-0.0.1/PKG-INFO +29 -0
- e2xcore-0.0.1/README.md +5 -0
- e2xcore-0.0.1/e2xcore/__init__.py +8 -0
- e2xcore-0.0.1/e2xcore/__version__.py +1 -0
- e2xcore-0.0.1/e2xcore/app.py +57 -0
- e2xcore-0.0.1/e2xcore/handlers/__init__.py +3 -0
- e2xcore-0.0.1/e2xcore/handlers/base.py +19 -0
- e2xcore-0.0.1/e2xcore/utils.py +35 -0
- e2xcore-0.0.1/pyproject.toml +69 -0
e2xcore-0.0.1/.gitignore
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Node modules
|
|
2
|
+
|
|
3
|
+
node_modules
|
|
4
|
+
|
|
5
|
+
# Build static files
|
|
6
|
+
e2xgrader/static
|
|
7
|
+
|
|
8
|
+
# Byte-compiled / optimized / DLL files
|
|
9
|
+
__pycache__/
|
|
10
|
+
*.py[cod]
|
|
11
|
+
*$py.class
|
|
12
|
+
|
|
13
|
+
# C extensions
|
|
14
|
+
*.so
|
|
15
|
+
|
|
16
|
+
# Distribution / packaging
|
|
17
|
+
.Python
|
|
18
|
+
build/
|
|
19
|
+
develop-eggs/
|
|
20
|
+
dist/
|
|
21
|
+
downloads/
|
|
22
|
+
eggs/
|
|
23
|
+
.eggs/
|
|
24
|
+
lib/
|
|
25
|
+
lib64/
|
|
26
|
+
parts/
|
|
27
|
+
sdist/
|
|
28
|
+
var/
|
|
29
|
+
wheels/
|
|
30
|
+
pip-wheel-metadata/
|
|
31
|
+
share/python-wheels/
|
|
32
|
+
*.egg-info/
|
|
33
|
+
.installed.cfg
|
|
34
|
+
*.egg
|
|
35
|
+
MANIFEST
|
|
36
|
+
|
|
37
|
+
# PyInstaller
|
|
38
|
+
# Usually these files are written by a python script from a template
|
|
39
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
40
|
+
*.manifest
|
|
41
|
+
*.spec
|
|
42
|
+
|
|
43
|
+
# Installer logs
|
|
44
|
+
pip-log.txt
|
|
45
|
+
pip-delete-this-directory.txt
|
|
46
|
+
|
|
47
|
+
# Unit test / coverage reports
|
|
48
|
+
htmlcov/
|
|
49
|
+
.tox/
|
|
50
|
+
.nox/
|
|
51
|
+
.coverage
|
|
52
|
+
.coverage.*
|
|
53
|
+
.cache
|
|
54
|
+
nosetests.xml
|
|
55
|
+
coverage.xml
|
|
56
|
+
*.cover
|
|
57
|
+
*.py,cover
|
|
58
|
+
.hypothesis/
|
|
59
|
+
.pytest_cache/
|
|
60
|
+
|
|
61
|
+
# Translations
|
|
62
|
+
*.mo
|
|
63
|
+
*.pot
|
|
64
|
+
|
|
65
|
+
# Django stuff:
|
|
66
|
+
*.log
|
|
67
|
+
local_settings.py
|
|
68
|
+
db.sqlite3
|
|
69
|
+
db.sqlite3-journal
|
|
70
|
+
|
|
71
|
+
# Flask stuff:
|
|
72
|
+
instance/
|
|
73
|
+
.webassets-cache
|
|
74
|
+
|
|
75
|
+
# Scrapy stuff:
|
|
76
|
+
.scrapy
|
|
77
|
+
|
|
78
|
+
# Sphinx documentation
|
|
79
|
+
docs/_build/
|
|
80
|
+
|
|
81
|
+
# PyBuilder
|
|
82
|
+
target/
|
|
83
|
+
|
|
84
|
+
# Jupyter Notebook
|
|
85
|
+
.ipynb_checkpoints
|
|
86
|
+
|
|
87
|
+
# IPython
|
|
88
|
+
profile_default/
|
|
89
|
+
ipython_config.py
|
|
90
|
+
|
|
91
|
+
# pyenv
|
|
92
|
+
.python-version
|
|
93
|
+
|
|
94
|
+
# pipenv
|
|
95
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
96
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
97
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
98
|
+
# install all needed dependencies.
|
|
99
|
+
#Pipfile.lock
|
|
100
|
+
|
|
101
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
102
|
+
__pypackages__/
|
|
103
|
+
|
|
104
|
+
# Celery stuff
|
|
105
|
+
celerybeat-schedule
|
|
106
|
+
celerybeat.pid
|
|
107
|
+
|
|
108
|
+
# SageMath parsed files
|
|
109
|
+
*.sage.py
|
|
110
|
+
|
|
111
|
+
# Environments
|
|
112
|
+
.env
|
|
113
|
+
.venv
|
|
114
|
+
env/
|
|
115
|
+
venv/
|
|
116
|
+
ENV/
|
|
117
|
+
env.bak/
|
|
118
|
+
venv.bak/
|
|
119
|
+
|
|
120
|
+
# Spyder project settings
|
|
121
|
+
.spyderproject
|
|
122
|
+
.spyproject
|
|
123
|
+
|
|
124
|
+
# Rope project settings
|
|
125
|
+
.ropeproject
|
|
126
|
+
|
|
127
|
+
# mkdocs documentation
|
|
128
|
+
/site
|
|
129
|
+
|
|
130
|
+
# mypy
|
|
131
|
+
.mypy_cache/
|
|
132
|
+
.dmypy.json
|
|
133
|
+
dmypy.json
|
|
134
|
+
|
|
135
|
+
# Pyre type checker
|
|
136
|
+
.pyre/
|
|
137
|
+
|
|
138
|
+
# vscode
|
|
139
|
+
.vscode/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/psf/black
|
|
3
|
+
rev: 23.1.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: black
|
|
6
|
+
|
|
7
|
+
- repo: https://github.com/PyCQA/isort
|
|
8
|
+
rev: 5.11.5
|
|
9
|
+
hooks:
|
|
10
|
+
- id: isort
|
|
11
|
+
files: \.py$
|
|
12
|
+
args: [--profile=black]
|
|
13
|
+
|
|
14
|
+
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
|
15
|
+
rev: "v0.0.267"
|
|
16
|
+
hooks:
|
|
17
|
+
- id: ruff
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Signature: 8a477f597d28d172789f06886806bc55
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
e2xcore-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 DigiKlausur
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
e2xcore-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: e2xcore
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: An template for a server app for e2xgrader
|
|
5
|
+
Project-URL: Documentation, https://e2x.inf.h-brs.de
|
|
6
|
+
Project-URL: Issues, https://github.com/Digiklausur/e2xcore/issues
|
|
7
|
+
Project-URL: Source, https://github.com/Digiklausur/e2xcore
|
|
8
|
+
Author-email: Tim Metzler <tim.metzler@h-brs.de>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Requires-Dist: notebook<7,>=6
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: hatchling; extra == 'dev'
|
|
21
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
22
|
+
Requires-Dist: tbump; extra == 'dev'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# e2xcore
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
e2xcore combines functionality for writing e2xgrader extensions
|
e2xcore-0.0.1/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.1"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
from typing import Any, Dict, List, Tuple
|
|
3
|
+
|
|
4
|
+
from notebook.base.handlers import IPythonHandler
|
|
5
|
+
from notebook.utils import url_path_join as ujoin
|
|
6
|
+
from traitlets.config import Application
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BaseApp(Application):
|
|
10
|
+
def __init__(self, **kwargs):
|
|
11
|
+
super().__init__(**kwargs)
|
|
12
|
+
self.log = self.parent.log
|
|
13
|
+
|
|
14
|
+
@property
|
|
15
|
+
def webapp(self):
|
|
16
|
+
return self.parent.web_app
|
|
17
|
+
|
|
18
|
+
def add_handlers(self, handlers: List[Tuple[str, IPythonHandler]]):
|
|
19
|
+
"""
|
|
20
|
+
Add handlers to the tornado server
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
handlers -- a list of handlers
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
def rewrite(x):
|
|
27
|
+
pat = ujoin(self.webapp.settings["base_url"], x[0].lstrip("/"))
|
|
28
|
+
return (pat,) + x[1:]
|
|
29
|
+
|
|
30
|
+
self.webapp.add_handlers(".*$", [rewrite(x) for x in handlers])
|
|
31
|
+
|
|
32
|
+
def update_tornado_settings(self, settings: Dict[Any, Any]):
|
|
33
|
+
"""
|
|
34
|
+
Update tornado settings
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
settings -- a settings dictionary used to update
|
|
38
|
+
the current tornado settings
|
|
39
|
+
"""
|
|
40
|
+
self.webapp.settings.update(settings)
|
|
41
|
+
|
|
42
|
+
def add_template_path(self, path: str):
|
|
43
|
+
"""
|
|
44
|
+
Add a template path to the jinja environment
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
path -- the absolute path to the template directory
|
|
48
|
+
"""
|
|
49
|
+
self.webapp.settings["e2xgrader"]["jinja_env"].loader.searchpath.append(path)
|
|
50
|
+
|
|
51
|
+
@abc.abstractmethod
|
|
52
|
+
def load_app(self):
|
|
53
|
+
"""
|
|
54
|
+
This method is called when the app is loaded.
|
|
55
|
+
Use it to initialize your app with handlers, settings, etc.
|
|
56
|
+
"""
|
|
57
|
+
pass
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from notebook.base.handlers import IPythonHandler
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class E2xHandler(IPythonHandler):
|
|
5
|
+
@property
|
|
6
|
+
def e2xgrader_settings(self):
|
|
7
|
+
return self.settings["e2xgrader"]
|
|
8
|
+
|
|
9
|
+
@property
|
|
10
|
+
def jinja_env(self):
|
|
11
|
+
return self.e2xgrader_settings["jinja_env"]
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def menu(self):
|
|
15
|
+
return self.e2xgrader_settings["menu"]
|
|
16
|
+
|
|
17
|
+
def render(self, name, **ns):
|
|
18
|
+
template = self.jinja_env.get_template(name)
|
|
19
|
+
return template.render(**ns)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from typing import Any, Dict, List
|
|
3
|
+
from urllib.parse import parse_qsl, urlencode, urlparse
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def format_url(url: str, params: Dict[str, Any]) -> str:
|
|
7
|
+
"""Join a url with search parameters
|
|
8
|
+
|
|
9
|
+
Args:
|
|
10
|
+
url (str): The url
|
|
11
|
+
params (Dict[str, Any]): A dictionary of parameters
|
|
12
|
+
|
|
13
|
+
Returns:
|
|
14
|
+
str: The url with encoded search parameters
|
|
15
|
+
"""
|
|
16
|
+
parsed = urlparse(url)
|
|
17
|
+
return parsed._replace(
|
|
18
|
+
query=urlencode({**dict(parse_qsl(parsed.query)), **params})
|
|
19
|
+
).geturl()
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def urljoin(*parts: List[str]) -> str:
|
|
23
|
+
"""Join a list of parts to produce an url
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
*parts (List[str]) - a list of parts
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
str: url with leading slash
|
|
30
|
+
|
|
31
|
+
Example:
|
|
32
|
+
>>> urljoin("e2x", "api", "v1")
|
|
33
|
+
'/e2x/api/v1'
|
|
34
|
+
"""
|
|
35
|
+
return re.sub(r"/+", r"/", ("/" + "/".join(parts)))
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "e2xcore"
|
|
7
|
+
description = "An template for a server app for e2xgrader"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.8"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Tim Metzler", email = "tim.metzler@h-brs.de" },
|
|
13
|
+
]
|
|
14
|
+
classifiers=[
|
|
15
|
+
"Programming Language :: Python",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.8",
|
|
18
|
+
"Programming Language :: Python :: 3.9",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11"
|
|
21
|
+
]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"notebook>=6,<7",
|
|
24
|
+
]
|
|
25
|
+
dynamic = ["version"]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Documentation = "https://e2x.inf.h-brs.de"
|
|
29
|
+
Issues = "https://github.com/Digiklausur/e2xcore/issues"
|
|
30
|
+
Source = "https://github.com/Digiklausur/e2xcore"
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = [
|
|
34
|
+
"pre-commit",
|
|
35
|
+
"hatchling",
|
|
36
|
+
"tbump"
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[tool.hatch.version]
|
|
40
|
+
path = "e2xcore/__version__.py"
|
|
41
|
+
|
|
42
|
+
[tool.tbump]
|
|
43
|
+
# Uncomment this if your project is hosted on GitHub:
|
|
44
|
+
# github_url = "https://github.com/<user or organization>/<project>/"
|
|
45
|
+
|
|
46
|
+
[tool.tbump.version]
|
|
47
|
+
current = "0.0.1"
|
|
48
|
+
|
|
49
|
+
regex = '''
|
|
50
|
+
(?P<major>\d+)
|
|
51
|
+
\.
|
|
52
|
+
(?P<minor>\d+)
|
|
53
|
+
\.
|
|
54
|
+
(?P<patch>\d+)
|
|
55
|
+
(?P<dev>-dev\d+)?
|
|
56
|
+
'''
|
|
57
|
+
|
|
58
|
+
[tool.tbump.git]
|
|
59
|
+
message_template = "Bump to {new_version}"
|
|
60
|
+
tag_template = "v{new_version}"
|
|
61
|
+
|
|
62
|
+
# Files with the version present
|
|
63
|
+
[[tool.tbump.file]]
|
|
64
|
+
src = "e2xcore/__version__.py"
|
|
65
|
+
|
|
66
|
+
[tool.ruff]
|
|
67
|
+
line-length = 100
|
|
68
|
+
ignore-init-module-imports = true
|
|
69
|
+
select = ["F", "E", "I"]
|