Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alan Marchiori
labtool
Commits
a0e63213
Commit
a0e63213
authored
Feb 17, 2020
by
Alan Marchiori
Browse files
remove leading/trailing spaces, and other improvements.
parent
a76118e4
Changes
4
Hide whitespace changes
Inline
Side-by-side
commands/checker.py
View file @
a0e63213
...
...
@@ -119,6 +119,7 @@ class Checker:
if
'on_error'
in
check
:
error
(
check
[
'on_error'
])
error
(
t
)
else
:
error
(
"{}: failed! Expected return code {} but got {}."
.
format
(
msg
,
check
[
'returncode'
],
c
))
error
(
t
)
...
...
@@ -133,7 +134,9 @@ class Checker:
else
:
warn
(
"Rubric has non-string stdout!"
)
x
=
str
(
check
[
'stdout'
])
results
+=
[
t
==
x
]
# ignore leading/trailing whitespaces (strip)
results
+=
[
t
.
strip
()
==
x
.
strip
()]
if
results
[
-
1
]:
success
(
"{}: Output passed."
.
format
(
msg
))
else
:
...
...
@@ -147,9 +150,9 @@ class Checker:
error
(
check
[
'on_error'
])
else
:
error
(
"{}: Output not as expected (check formatting!)"
.
format
(
msg
))
for
line
in
difflib
.
context_diff
(
x
.
split
(
"
\n
"
),
t
.
split
(
"
\n
"
),
x
.
strip
().
split
(
"
\n
"
),
t
.
strip
().
split
(
"
\n
"
),
fromfile
=
'Expected output'
,
tofile
=
'Your output'
):
echo
(
line
.
strip
())
...
...
commands/grade.py
View file @
a0e63213
...
...
@@ -32,11 +32,9 @@ import contextlib # to redirect stdout
help
=
'Regrade a previously graded item?
\t
[default: False]'
)
@
click
.
option
(
"--user"
,
default
=
None
,
help
=
'Set to only grade a single user (by git username).
\t
[default: ALL]'
)
@
click
.
option
(
"--feedback"
,
default
=
"feedback.txt"
,
help
=
'File to write feedback to.'
)
@
click
.
option
(
"--push/--no-push"
,
default
=
True
,
show_default
=
True
,
help
=
'Push commits to gitlab?'
)
def
grade
(
lab
,
part
,
clone
,
dograde
,
regrade
,
user
,
feedback
,
push
):
def
grade
(
lab
,
part
,
clone
,
dograde
,
regrade
,
user
,
push
):
"""grade LAB and PART for students from gitlab. LAB is required. If PART is omitted, ALL parts are graded.
"""
...
...
lt.py
View file @
a0e63213
...
...
@@ -36,7 +36,7 @@ smtp_handler = logging.handlers.SMTPHandler(
subject
=
u
"labtool crash report!"
)
__version__
=
'1.0.9'
__date__
=
'2020-02-1
1T12:03:51.878974
'
__date__
=
'2020-02-1
2T20:39:09.919446
'
__user__
=
'cs206'
__host__
=
'linuxremote3.bucknell.edu'
@
click
.
group
()
...
...
utils/history.py
View file @
a0e63213
import
os
import
os.path
import
json
import
sys
from
config.echo
import
debug
,
error
class
History
(
dict
):
"""A simple class to store grade history.
...
...
@@ -48,7 +49,7 @@ class History(dict):
self
.
update
(
d
)
except
Exception
as
x
:
print
(
x
)
exit
()
sys
.
exit
()
return
self
def
__exit__
(
self
,
type
,
value
,
traceback
):
"save history"
...
...
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