kattis2canvas 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl
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.
- kattis2canvas/__init__.py +1 -1
- kattis2canvas/cli.py +22 -20
- {kattis2canvas-0.1.2.dist-info → kattis2canvas-0.1.3.dist-info}/METADATA +1 -1
- kattis2canvas-0.1.3.dist-info/RECORD +8 -0
- kattis2canvas-0.1.2.dist-info/RECORD +0 -8
- {kattis2canvas-0.1.2.dist-info → kattis2canvas-0.1.3.dist-info}/WHEEL +0 -0
- {kattis2canvas-0.1.2.dist-info → kattis2canvas-0.1.3.dist-info}/entry_points.txt +0 -0
- {kattis2canvas-0.1.2.dist-info → kattis2canvas-0.1.3.dist-info}/top_level.txt +0 -0
kattis2canvas/__init__.py
CHANGED
kattis2canvas/cli.py
CHANGED
|
@@ -306,7 +306,8 @@ def get_courses(canvas: Canvas, name: str, is_active=True, is_finished=False) ->
|
|
|
306
306
|
@click.option("--dryrun/--no-dryrun", default=True, help="show planned actions, do not make them happen.")
|
|
307
307
|
@click.option("--force/--no-force", default=False, help="force an update of an assignment if it already exists.")
|
|
308
308
|
@click.option("--add-to-module", help="the module to add the assignment to.")
|
|
309
|
-
|
|
309
|
+
@click.option("--assignment-group", default="kattis", help="the canvas assignment group to use (default: kattis).")
|
|
310
|
+
def course2canvas(offering, canvas_course, dryrun, force, add_to_module, assignment_group):
|
|
310
311
|
"""
|
|
311
312
|
create assignments in canvas for all the assignments in kattis.
|
|
312
313
|
"""
|
|
@@ -321,18 +322,18 @@ def course2canvas(offering, canvas_course, dryrun, force, add_to_module):
|
|
|
321
322
|
canvas = Canvas(config.canvas_url, config.canvas_token)
|
|
322
323
|
course = get_course(canvas, canvas_course)
|
|
323
324
|
|
|
324
|
-
|
|
325
|
+
canvas_group = None
|
|
325
326
|
for ag in course.get_assignment_groups():
|
|
326
|
-
if ag.name ==
|
|
327
|
-
|
|
327
|
+
if ag.name == assignment_group:
|
|
328
|
+
canvas_group = ag
|
|
328
329
|
break
|
|
329
|
-
if not
|
|
330
|
+
if not canvas_group:
|
|
330
331
|
# create assignment group if not present on canvas
|
|
331
332
|
if dryrun:
|
|
332
|
-
info("would create assignment group '
|
|
333
|
+
info(f"would create assignment group '{assignment_group}'.")
|
|
333
334
|
else:
|
|
334
|
-
|
|
335
|
-
info(f"created assignment group {
|
|
335
|
+
canvas_group = course.create_assignment_group(name=assignment_group)
|
|
336
|
+
info(f"created assignment group {canvas_group}.")
|
|
336
337
|
|
|
337
338
|
if add_to_module:
|
|
338
339
|
modules = {m.name: m for m in course.get_modules()}
|
|
@@ -350,9 +351,9 @@ def course2canvas(offering, canvas_course, dryrun, force, add_to_module):
|
|
|
350
351
|
add_to_module.edit(module=args)
|
|
351
352
|
info(f"published module {add_to_module}.")
|
|
352
353
|
|
|
353
|
-
# In dryrun mode without existing
|
|
354
|
-
if
|
|
355
|
-
canvas_assignments = {a.name: a for a in course.get_assignments(assignment_group_id=
|
|
354
|
+
# In dryrun mode without existing group, get all assignments; otherwise filter by group
|
|
355
|
+
if canvas_group:
|
|
356
|
+
canvas_assignments = {a.name: a for a in course.get_assignments(assignment_group_id=canvas_group.id)}
|
|
356
357
|
else:
|
|
357
358
|
canvas_assignments = {}
|
|
358
359
|
|
|
@@ -368,7 +369,7 @@ def course2canvas(offering, canvas_course, dryrun, force, add_to_module):
|
|
|
368
369
|
info(f"would update {assignment.title}.")
|
|
369
370
|
else:
|
|
370
371
|
canvas_assignments[assignment.title].edit(assignment={
|
|
371
|
-
'assignment_group_id':
|
|
372
|
+
'assignment_group_id': canvas_group.id,
|
|
372
373
|
'name': assignment.title,
|
|
373
374
|
'description': f'Solve the problems found at <a href="{assignment.url}">{assignment.url}</a>. {description}',
|
|
374
375
|
'points_possible': 100,
|
|
@@ -386,7 +387,7 @@ def course2canvas(offering, canvas_course, dryrun, force, add_to_module):
|
|
|
386
387
|
continue
|
|
387
388
|
else:
|
|
388
389
|
canvas_assignments[assignment.title] = course.create_assignment({
|
|
389
|
-
'assignment_group_id':
|
|
390
|
+
'assignment_group_id': canvas_group.id,
|
|
390
391
|
'name': assignment.title,
|
|
391
392
|
'description': f'Solve the problems found at <a href="{assignment.url}">{assignment.url}</a>. {description}',
|
|
392
393
|
'points_possible': 100,
|
|
@@ -468,7 +469,8 @@ def kattislinks(canvas_course):
|
|
|
468
469
|
@click.argument("offering")
|
|
469
470
|
@click.argument("canvas_course")
|
|
470
471
|
@click.option("--dryrun/--no-dryrun", default=True, help="show planned actions, do not make them happen.")
|
|
471
|
-
|
|
472
|
+
@click.option("--assignment-group", default="kattis", help="the canvas assignment group to use (default: kattis).")
|
|
473
|
+
def submissions2canvas(offering, canvas_course, dryrun, assignment_group):
|
|
472
474
|
"""
|
|
473
475
|
mirror summary of submission from kattis into canvas as a submission comment.
|
|
474
476
|
"""
|
|
@@ -492,17 +494,17 @@ def submissions2canvas(offering, canvas_course, dryrun):
|
|
|
492
494
|
else:
|
|
493
495
|
warn(f"kattis link missing for {link.canvas_user.name} {link.canvas_user.email}.")
|
|
494
496
|
|
|
495
|
-
|
|
497
|
+
canvas_group = None
|
|
496
498
|
for ag in course.get_assignment_groups():
|
|
497
|
-
if ag.name ==
|
|
498
|
-
|
|
499
|
+
if ag.name == assignment_group:
|
|
500
|
+
canvas_group = ag
|
|
499
501
|
break
|
|
500
502
|
|
|
501
|
-
if not
|
|
502
|
-
error(f"no
|
|
503
|
+
if not canvas_group:
|
|
504
|
+
error(f"no '{assignment_group}' assignment group in {canvas_course}")
|
|
503
505
|
exit(4)
|
|
504
506
|
|
|
505
|
-
assignments = {a.name: a for a in course.get_assignments(assignment_group_id=
|
|
507
|
+
assignments = {a.name: a for a in course.get_assignments(assignment_group_id=canvas_group.id)}
|
|
506
508
|
|
|
507
509
|
for assignment in get_assignments(offerings[0]):
|
|
508
510
|
if assignment.title.replace("-late", "") not in assignments:
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
kattis2canvas/__init__.py,sha256=MqIjN6muURlNetfg6Sc2rjbVxZqvW_PE8v8H4n1MuYk,109
|
|
2
|
+
kattis2canvas/__main__.py,sha256=GGdT4J5WJQ5MvnJ7m-VX_noR8DGaYXclhjDUIFjW5SY,120
|
|
3
|
+
kattis2canvas/cli.py,sha256=qH2X4GNapfWuKAQN-25_PhRgAZgFLERtrgDbbq8LU2g,24296
|
|
4
|
+
kattis2canvas-0.1.3.dist-info/METADATA,sha256=7kIWlf7eybKvd9pWsWbs8NO7joWOp8FQzKABREbmseQ,7081
|
|
5
|
+
kattis2canvas-0.1.3.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
6
|
+
kattis2canvas-0.1.3.dist-info/entry_points.txt,sha256=V7GPrZNe7aIcu6f_dNo_pCjkuqBQxRzKAQZCNxl9DYg,56
|
|
7
|
+
kattis2canvas-0.1.3.dist-info/top_level.txt,sha256=ZoThmon7y1CR0sTAZndaF2rloBK8xz10mGyz5PUbtCo,14
|
|
8
|
+
kattis2canvas-0.1.3.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
kattis2canvas/__init__.py,sha256=eQhFufU8FowVsAgP6GPL4jY3u_OYsDabZPIN-qefj4k,109
|
|
2
|
-
kattis2canvas/__main__.py,sha256=GGdT4J5WJQ5MvnJ7m-VX_noR8DGaYXclhjDUIFjW5SY,120
|
|
3
|
-
kattis2canvas/cli.py,sha256=Ch0Mr-p6_-H0108k5T_FdvsuGsKvh7BERH3EjxEcpDk,23984
|
|
4
|
-
kattis2canvas-0.1.2.dist-info/METADATA,sha256=8D5iPAMRI6bCvUnwidUQphTfUPUf3VwFSV28_1SWpvU,7081
|
|
5
|
-
kattis2canvas-0.1.2.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
6
|
-
kattis2canvas-0.1.2.dist-info/entry_points.txt,sha256=V7GPrZNe7aIcu6f_dNo_pCjkuqBQxRzKAQZCNxl9DYg,56
|
|
7
|
-
kattis2canvas-0.1.2.dist-info/top_level.txt,sha256=ZoThmon7y1CR0sTAZndaF2rloBK8xz10mGyz5PUbtCo,14
|
|
8
|
-
kattis2canvas-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|