Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
code-generic
code-webis-cmd
Commits
2909296e
Commit
2909296e
authored
Feb 17, 2021
by
Michael Völske
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update exams.py
parent
7b588f99
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
tools/exams.py
tools/exams.py
+11
-7
No files found.
tools/exams.py
View file @
2909296e
...
...
@@ -27,10 +27,15 @@ def exams():
@
click
.
argument
(
'pool_yaml'
)
@
click
.
argument
(
'output_file'
)
@
click
.
option
(
'--student-list-file'
,
'-f'
,
help
=
'Tab-separated file. '
'defining students for which variants should be sampled. Must have a header. '
'Header names define variable names, rows define their values. '
'ATTENTION: use latin-1 encoding!'
,
required
=
True
)
def
generate_variants
(
pool_yaml
,
output_file
,
student_list_file
):
'defining students for which variants should be sampled.'
'Must have a header. Header names define variable names, '
'rows define their values. ATTENTION: use latin-1 encoding!'
,
required
=
True
)
@
click
.
option
(
'--column'
,
'-c'
,
help
=
'Columns to copy from the student-list-file.'
,
multiple
=
True
,
default
=
[
'STUDENT_NAME'
,
'STUDENT_EMAIL'
],
show_default
=
True
)
def
generate_variants
(
pool_yaml
,
output_file
,
student_list_file
,
column
):
""" Generate a variant-list-file, where each student in the
student-list-file gets a unique sample of problems, one from each pool
defined in the pool_yaml
...
...
@@ -59,12 +64,11 @@ def generate_variants(pool_yaml, output_file, student_list_file):
newline
=
''
,
encoding
=
'latin1'
)
as
of
:
writer
=
csv
.
writer
(
of
,
delimiter
=
'
\t
'
,
dialect
=
dialect
)
variable_string
=
list
(
pools
.
keys
())
writer
.
writerow
(
[
'STUDENT_NAME'
,
'STUDENT_EMAIL'
]
+
variable_string
)
writer
.
writerow
(
column
+
variable_string
)
for
env
in
tqdm
(
items
,
desc
=
'generating variants'
):
variant_string
=
[
f
'
{
choice
(
variants
)
}
'
for
variants
in
pools
.
values
()]
writer
.
writerow
([
env
[
'STUDENT_NAME'
],
env
[
'STUDENT_EMAIL'
]]
+
variant_string
)
writer
.
writerow
([
env
[
c
]
for
c
in
column
]
+
variant_string
)
########################################################################
...
...
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