kattis2canvas 0.1.0__py3-none-any.whl → 0.1.2__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 +26 -3
- {kattis2canvas-0.1.0.dist-info → kattis2canvas-0.1.2.dist-info}/METADATA +2 -1
- kattis2canvas-0.1.2.dist-info/RECORD +8 -0
- kattis2canvas-0.1.0.dist-info/RECORD +0 -8
- {kattis2canvas-0.1.0.dist-info → kattis2canvas-0.1.2.dist-info}/WHEEL +0 -0
- {kattis2canvas-0.1.0.dist-info → kattis2canvas-0.1.2.dist-info}/entry_points.txt +0 -0
- {kattis2canvas-0.1.0.dist-info → kattis2canvas-0.1.2.dist-info}/top_level.txt +0 -0
kattis2canvas/__init__.py
CHANGED
kattis2canvas/cli.py
CHANGED
|
@@ -9,6 +9,7 @@ from fractions import Fraction
|
|
|
9
9
|
from typing import NamedTuple, Optional
|
|
10
10
|
|
|
11
11
|
import click
|
|
12
|
+
from dateutil import parser as dateparser
|
|
12
13
|
import pprint
|
|
13
14
|
import requests
|
|
14
15
|
import requests.cookies
|
|
@@ -150,11 +151,29 @@ def list_offerings(name: str):
|
|
|
150
151
|
info(str(offering))
|
|
151
152
|
|
|
152
153
|
|
|
154
|
+
# Common timezone abbreviations to UTC offsets
|
|
155
|
+
TZINFOS = {
|
|
156
|
+
"UTC": 0,
|
|
157
|
+
"GMT": 0,
|
|
158
|
+
"CET": 3600, # Central European Time (UTC+1)
|
|
159
|
+
"CEST": 7200, # Central European Summer Time (UTC+2)
|
|
160
|
+
"EST": -18000, # Eastern Standard Time (UTC-5)
|
|
161
|
+
"EDT": -14400, # Eastern Daylight Time (UTC-4)
|
|
162
|
+
"CST": -21600, # Central Standard Time (UTC-6)
|
|
163
|
+
"CDT": -18000, # Central Daylight Time (UTC-5)
|
|
164
|
+
"MST": -25200, # Mountain Standard Time (UTC-7)
|
|
165
|
+
"MDT": -21600, # Mountain Daylight Time (UTC-6)
|
|
166
|
+
"PST": -28800, # Pacific Standard Time (UTC-8)
|
|
167
|
+
"PDT": -25200, # Pacific Daylight Time (UTC-7)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
|
|
153
171
|
# reformat kattis date format to canvas format
|
|
154
172
|
def extract_kattis_date(element: str) -> str:
|
|
155
173
|
if element == "infinity":
|
|
156
174
|
element = "2100-01-01 00:00 UTC"
|
|
157
|
-
|
|
175
|
+
dt = dateparser.parse(element, tzinfos=TZINFOS)
|
|
176
|
+
return dt.strftime("%Y-%m-%dT%H:%M:00%z")
|
|
158
177
|
|
|
159
178
|
|
|
160
179
|
# convert canvas UTC to datetime
|
|
@@ -310,7 +329,7 @@ def course2canvas(offering, canvas_course, dryrun, force, add_to_module):
|
|
|
310
329
|
if not kattis_group:
|
|
311
330
|
# create assignment group if not present on canvas
|
|
312
331
|
if dryrun:
|
|
313
|
-
info(
|
|
332
|
+
info("would create assignment group 'kattis'.")
|
|
314
333
|
else:
|
|
315
334
|
kattis_group = course.create_assignment_group(name='kattis')
|
|
316
335
|
info(f"created assignment group {kattis_group}.")
|
|
@@ -331,7 +350,11 @@ def course2canvas(offering, canvas_course, dryrun, force, add_to_module):
|
|
|
331
350
|
add_to_module.edit(module=args)
|
|
332
351
|
info(f"published module {add_to_module}.")
|
|
333
352
|
|
|
334
|
-
|
|
353
|
+
# In dryrun mode without existing kattis group, get all assignments; otherwise filter by group
|
|
354
|
+
if kattis_group:
|
|
355
|
+
canvas_assignments = {a.name: a for a in course.get_assignments(assignment_group_id=kattis_group.id)}
|
|
356
|
+
else:
|
|
357
|
+
canvas_assignments = {}
|
|
335
358
|
|
|
336
359
|
# make sure assignments are in place
|
|
337
360
|
sorted_assignments = list(get_assignments(offerings[0]))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kattis2canvas
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: CLI tool to integrate Kattis offerings with Canvas LMS courses
|
|
5
5
|
Author: bcr33d
|
|
6
6
|
License-Expression: MIT
|
|
@@ -24,6 +24,7 @@ Requires-Dist: click>=8.0
|
|
|
24
24
|
Requires-Dist: requests>=2.25
|
|
25
25
|
Requires-Dist: beautifulsoup4>=4.9
|
|
26
26
|
Requires-Dist: canvasapi>=2.0
|
|
27
|
+
Requires-Dist: python-dateutil>=2.8
|
|
27
28
|
|
|
28
29
|
# kattis2canvas
|
|
29
30
|
|
|
@@ -0,0 +1,8 @@
|
|
|
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,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
kattis2canvas/__init__.py,sha256=WXVSa9ObDHh468WIrxRa_8Zi7e49ChxlRF5gWkopzss,109
|
|
2
|
-
kattis2canvas/__main__.py,sha256=GGdT4J5WJQ5MvnJ7m-VX_noR8DGaYXclhjDUIFjW5SY,120
|
|
3
|
-
kattis2canvas/cli.py,sha256=eWJxw0zO4oh-ZLrIKTyIA8BwMMZHrrA7H4PvS73Tfxk,23164
|
|
4
|
-
kattis2canvas-0.1.0.dist-info/METADATA,sha256=z_qYgPTsWF4at39HqeD70oTqp5actGOIKtplRFGTn7o,7045
|
|
5
|
-
kattis2canvas-0.1.0.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
6
|
-
kattis2canvas-0.1.0.dist-info/entry_points.txt,sha256=V7GPrZNe7aIcu6f_dNo_pCjkuqBQxRzKAQZCNxl9DYg,56
|
|
7
|
-
kattis2canvas-0.1.0.dist-info/top_level.txt,sha256=ZoThmon7y1CR0sTAZndaF2rloBK8xz10mGyz5PUbtCo,14
|
|
8
|
-
kattis2canvas-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|