Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mossutils
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dinfk-lecturers
mossutils
Commits
74c50a72
Commit
74c50a72
authored
May 07, 2020
by
scmalte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init.py (and others): added mu-init to copy package resources to local directory
parent
efad50e1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
115 additions
and
1 deletion
+115
-1
mossutils/aggr.py
mossutils/aggr.py
+1
-1
mossutils/data/cluster_mail.txt
mossutils/data/cluster_mail.txt
+6
-0
mossutils/data/clusters.html.jinja
mossutils/data/clusters.html.jinja
+70
-0
mossutils/init.py
mossutils/init.py
+37
-0
setup.py
setup.py
+1
-0
No files found.
mossutils/aggr.py
View file @
74c50a72
...
...
@@ -71,7 +71,7 @@ def main(
jinja2_file_loader
=
jinja2
.
FileSystemLoader
(
"."
)
jinja2_env
=
jinja2
.
Environment
(
loader
=
jinja2_file_loader
)
template
=
jinja2_env
.
get_template
(
"clusters.html.jinja"
)
template
=
jinja2_env
.
get_template
(
"
./_static/
clusters.html.jinja"
)
# output = template.render(colors=colors)
# print(output)
...
...
mossutils/data/cluster_mail.txt
0 → 100644
View file @
74c50a72
Sehr geehrte Studierende
Sie sind beim Kopieren der Bonusaufgabe erwischt worden. Das ist höchst unerfreulich — für Sie! Denn nun müssen wir Ihnen leider die Punkte wieder abziehen.
Freundliche Grüsse
Ihre Dozenten
\ No newline at end of file
mossutils/data/clusters.html.jinja
0 → 100644
View file @
74c50a72
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
/>
<meta
http-equiv=
"x-ua-compatible"
content=
"ie=edge"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<title>
{{ title }}
</title>
{#
<link
rel=
"stylesheet"
href=
"css/main.css"
/>
<link
rel=
"icon"
href=
"images/favicon.png"
/>
#}
</head>
<body
style=
"padding: 1em"
>
No. of eDoz students: {{ edoz_count }}
<br>
No. of CX students: {{ course_count }}
<span
style=
"color: #999999"
>
(may include staff)
</span><br>
No. of plagiarists: {{ plagiarist_count }}
<br>
{% for key, value in percentages.items() %}
{{ key }}: {{ value }}%
<br>
{% endfor %}
<table
style=
"border-spacing: 1em 2em"
>
<thead>
<tr>
<th
scope=
"col"
></th>
<th
scope=
"col"
></th>
</tr>
</thead>
<tbody>
{% for (cluster, cluster_rows) in clusters %}
<tr>
<td>
Size: {{ cluster_rows.shape[0] }}
{{ cluster_rows.to_html(classes="cluster", header=False, index_names=False) }}
{#
<table>
{% for row in cluster_rows %}
<tr>
<td>
{{ row }}
</td>
{ #
<td></td>
<td></td>
# }
</tr>
{% endfor %}
</table>
#}
</td>
<td>
<object
data=
"{{ cluster['svg_file'].iat[0] }}"
type=
"image/svg+xml"
style=
"transform:scale(60%); max-width: 75em; visibility: hidden"
></object>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<script>
window
.
addEventListener
(
"
load
"
,
function
(){
var
svg_objects
=
document
.
querySelectorAll
(
"
table > tbody object
"
);
// console.log(svg_objects);
svg_objects
.
forEach
(
obj
=>
{
var
dim
=
obj
.
getBoundingClientRect
();
// console.log(dim.width, dim.height);
obj
.
style
.
visibility
=
"
visible
"
;
//obj.style.removeProperty("visibility");
obj
.
style
.
transform
=
""
;
obj
.
style
.
width
=
dim
.
width
+
"
px
"
;
obj
.
style
.
height
=
dim
.
height
+
"
px
"
;
})
});
</script>
</body>
</html>
mossutils/init.py
0 → 100644
View file @
74c50a72
import
logging
import
pkgutil
import
os
from
.utils
import
logging
as
logutils
def
main
():
logutils
.
configure_level_and_format
()
# Files hardcoded here because I couldn't figure out how to iterate over the
# files in the package's "data" directory.
# See also https://stackoverflow.com/questions/61531935.
files
=
[
"style.css"
,
"script.js"
,
"sorttable.js"
,
"clusters.html.jinja"
,
"cluster_mail.txt"
]
source_data_directory
=
"./data"
destination_data_directory
=
"./_static"
logging
.
info
(
"Creating directory {}"
.
format
(
destination_data_directory
))
os
.
makedirs
(
destination_data_directory
,
exist_ok
=
True
)
for
file
in
files
:
source_file
=
os
.
path
.
join
(
source_data_directory
,
file
)
destination_file
=
os
.
path
.
join
(
destination_data_directory
,
file
)
logging
.
info
(
"Creating file {}"
.
format
(
destination_file
))
with
open
(
destination_file
,
"wb"
)
as
destination_fh
:
destination_fh
.
write
(
pkgutil
.
get_data
(
__name__
,
source_file
))
if
__name__
==
"__main__"
:
main
()
setup.py
View file @
74c50a72
...
...
@@ -28,6 +28,7 @@ setup(
# scripts=['bin/mossutils-moss'],
entry_points
=
{
"console_scripts"
:
[
'mu-init = mossutils.init:main'
,
'mu-moss = mossutils.moss:main'
,
'mu-revise = mossutils.revise:main'
,
'mu-cluster = mossutils.cluster:main'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment