pyvikunja 0.8__tar.gz → 0.9__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.
- {pyvikunja-0.8/pyvikunja.egg-info → pyvikunja-0.9}/PKG-INFO +1 -1
- {pyvikunja-0.8 → pyvikunja-0.9}/pyproject.toml +1 -1
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja/models/enum/repeat_mode.py +2 -2
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja/models/task.py +24 -5
- {pyvikunja-0.8 → pyvikunja-0.9/pyvikunja.egg-info}/PKG-INFO +1 -1
- {pyvikunja-0.8 → pyvikunja-0.9}/LICENSE +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/README.md +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja/__init__.py +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja/api.py +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja/models/enum/task_priority.py +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja/models/label.py +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja/models/models.py +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja/models/project.py +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja/models/team.py +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja/models/user.py +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja.egg-info/SOURCES.txt +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja.egg-info/dependency_links.txt +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja.egg-info/requires.txt +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/pyvikunja.egg-info/top_level.txt +0 -0
- {pyvikunja-0.8 → pyvikunja-0.9}/setup.cfg +0 -0
@@ -33,6 +33,23 @@ class Task(BaseModel):
|
|
33
33
|
self.labels: List[Label] = [Label(label_data) for label_data in data.get('labels', []) or []]
|
34
34
|
self.assignees: List[User] = [User(user_data) for user_data in data.get('assignees', []) or []]
|
35
35
|
|
36
|
+
# Parse repeat_mode into an enum
|
37
|
+
self.repeat_mode: RepeatMode = self._parse_repeat_mode(data.get('repeat_mode'))
|
38
|
+
|
39
|
+
# Parse repeat_after into timedelta
|
40
|
+
self.repeat_after: Optional[timedelta] = self._parse_repeat_after(data.get('repeat_after'))
|
41
|
+
|
42
|
+
def _parse_repeat_mode(self, mode: Optional[int]) -> Optional[RepeatMode]:
|
43
|
+
"""Convert repeat_mode integer into an Enum value, defaulting to NONE."""
|
44
|
+
try:
|
45
|
+
return RepeatMode(mode) if mode is not None else None
|
46
|
+
except ValueError:
|
47
|
+
return None
|
48
|
+
|
49
|
+
def _parse_repeat_after(self, seconds: Optional[int]) -> Optional[timedelta]:
|
50
|
+
"""Convert repeat_after seconds into a timedelta."""
|
51
|
+
return timedelta(seconds=seconds) if seconds else None
|
52
|
+
|
36
53
|
async def update(self, data: Dict) -> 'Task':
|
37
54
|
# Merge self.data with the new data (data overrides keys in self.data)
|
38
55
|
combined = {**self.data, **data}
|
@@ -94,12 +111,14 @@ class Task(BaseModel):
|
|
94
111
|
iso_date = str(date.isoformat())
|
95
112
|
return await self.update({'end_date': iso_date})
|
96
113
|
|
97
|
-
async def set_repeating_interval(self, interval: timedelta, mode: RepeatMode =
|
98
|
-
|
99
|
-
total_seconds = int(
|
100
|
-
|
114
|
+
async def set_repeating_interval(self, interval: Optional[timedelta] = None, mode: Optional[RepeatMode] = None) -> 'Task':
|
115
|
+
new_interval = interval if interval else self.repeat_after
|
116
|
+
total_seconds = int(new_interval.total_seconds())
|
117
|
+
|
118
|
+
new_mode = mode if mode else self.repeat_mode
|
119
|
+
|
101
120
|
return await self.update({'repeat_after': total_seconds,
|
102
|
-
'repeat_mode':
|
121
|
+
'repeat_mode': new_mode.value})
|
103
122
|
|
104
123
|
async def delete_task(self) -> Dict:
|
105
124
|
return await self.api.delete_task(self.id)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|