summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/todos.py
diff options
context:
space:
mode:
authorJohn L. Villalovos <john@sodarock.com>2021-11-06 21:33:07 -0700
committerJohn L. Villalovos <john@sodarock.com>2021-11-08 07:21:17 -0800
commit7828ba2fd13c833c118a673bac09b215587ba33b (patch)
tree71312fe159fcc62ace0aeb24be94072ee4cf33cf /gitlab/v4/objects/todos.py
parent9a2f54cf044929dfc3fd89714ce657fa839e35d0 (diff)
downloadgitlab-jlvillal/mypy_small_files_1.tar.gz
chore: enforce type-hints on most files in gitlab/v4/objects/jlvillal/mypy_small_files_1
* Add type-hints to some of the files in gitlab/v4/objects/ * Fix issues detected when adding type-hints * Changed mypy exclusion to explicitly list the 13 files that have not yet had type-hints added.
Diffstat (limited to 'gitlab/v4/objects/todos.py')
-rw-r--r--gitlab/v4/objects/todos.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/gitlab/v4/objects/todos.py b/gitlab/v4/objects/todos.py
index eecd222..9f8c52d 100644
--- a/gitlab/v4/objects/todos.py
+++ b/gitlab/v4/objects/todos.py
@@ -1,3 +1,5 @@
+from typing import Any, Dict, TYPE_CHECKING
+
from gitlab import cli
from gitlab import exceptions as exc
from gitlab.base import RESTManager, RESTObject
@@ -12,7 +14,7 @@ __all__ = [
class Todo(ObjectDeleteMixin, RESTObject):
@cli.register_custom_action("Todo")
@exc.on_http_error(exc.GitlabTodoError)
- def mark_as_done(self, **kwargs):
+ def mark_as_done(self, **kwargs: Any) -> Dict[str, Any]:
"""Mark the todo as done.
Args:
@@ -21,10 +23,16 @@ class Todo(ObjectDeleteMixin, RESTObject):
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabTodoError: If the server failed to perform the request
+
+ Returns:
+ A dict with the result
"""
path = f"{self.manager.path}/{self.id}/mark_as_done"
server_data = self.manager.gitlab.http_post(path, **kwargs)
+ if TYPE_CHECKING:
+ assert isinstance(server_data, dict)
self._update_attrs(server_data)
+ return server_data
class TodoManager(ListMixin, DeleteMixin, RESTManager):
@@ -34,7 +42,7 @@ class TodoManager(ListMixin, DeleteMixin, RESTManager):
@cli.register_custom_action("TodoManager")
@exc.on_http_error(exc.GitlabTodoError)
- def mark_all_as_done(self, **kwargs):
+ def mark_all_as_done(self, **kwargs: Any) -> None:
"""Mark all the todos as done.
Args: