Skip to content

Commit 413efc4

Browse files
committed
Reftime handling when values are missing
1 parent 5094419 commit 413efc4

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# CHANGELOG
2+
3+
## 0.3.36
4+
- [x] update: Reftime handling works if reftime is malformed
5+
26
## 0.3.35
37
- [x] add: validations for the input file for conversation tagging
48

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "skit-labels"
3-
version = "0.3.35"
3+
version = "0.3.36"
44
description = "Command line tool for interacting with labelled datasets at skit.ai."
55
authors = []
66
license = "MIT"

skit_labels/db.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
)
2727

2828

29+
def update_reftime(reftime, tz):
30+
try:
31+
reftime = to_datetime(reftime)
32+
return reftime.astimezone(tz).isoformat()
33+
except Exception as e:
34+
print("Couldn't convert thr timezone for Reftime: " + str(reftime))
35+
return reftime
36+
37+
2938
def build_task(
3039
d: Dict, task_type: str, data_id: Optional[str] = None, tz=pytz.UTC
3140
) -> Task:
@@ -39,8 +48,7 @@ def build_task(
3948
# Since the reftime from db is in UTC, we convert it to our timezone. This
4049
# is needed as saying 12 pm means different things in different timezones
4150
# and can't be translated without doing something stupid.
42-
task.reftime = to_datetime(task.reftime)
43-
task.reftime = task.reftime.astimezone(tz).isoformat()
51+
task.reftime = update_reftime(task.reftime, tz)
4452
elif task_type == "simulated_call":
4553
task = SimulatedCallTask.from_dict(d)
4654
elif task_type == "audio_segment":

0 commit comments

Comments
 (0)