kattis2canvas 0.1.0__tar.gz → 0.1.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kattis2canvas
3
- Version: 0.1.0
3
+ Version: 0.1.1
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
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "kattis2canvas"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "CLI tool to integrate Kattis offerings with Canvas LMS courses"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -31,6 +31,7 @@ dependencies = [
31
31
  "requests>=2.25",
32
32
  "beautifulsoup4>=4.9",
33
33
  "canvasapi>=2.0",
34
+ "python-dateutil>=2.8",
34
35
  ]
35
36
 
36
37
  [project.urls]
@@ -1,3 +1,3 @@
1
1
  """kattis2canvas - CLI tool to integrate Kattis offerings with Canvas LMS courses."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.1.1"
@@ -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
- return datetime.datetime.strftime(datetime.datetime.strptime(element, "%Y-%m-%d %H:%M %Z"), "%Y-%m-%dT%H:%M:00%z")
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kattis2canvas
3
- Version: 0.1.0
3
+ Version: 0.1.1
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
 
@@ -2,3 +2,4 @@ click>=8.0
2
2
  requests>=2.25
3
3
  beautifulsoup4>=4.9
4
4
  canvasapi>=2.0
5
+ python-dateutil>=2.8
File without changes
File without changes