|
1 | 1 | from __future__ import annotations
|
2 | 2 |
|
| 3 | +import sys |
3 | 4 | from collections.abc import Callable, Iterator
|
4 |
| -from typing import TYPE_CHECKING, Annotated, Any, Literal, Self, TypeVar |
| 5 | +from typing import TYPE_CHECKING, Annotated, Any, Literal, TypeVar |
5 | 6 | from weakref import finalize
|
6 | 7 |
|
7 | 8 | import requests
|
|
41 | 42 | from datetime import date, datetime
|
42 | 43 | from types import TracebackType
|
43 | 44 |
|
| 45 | +if sys.version_info >= (3, 11): |
| 46 | + from typing import Self |
| 47 | +else: |
| 48 | + Self = TypeVar("Self", bound="TodoistAPI") |
| 49 | + |
44 | 50 |
|
45 | 51 | LanguageCode = Annotated[str, Predicate(lambda x: len(x) == 2)] # noqa: PLR2004
|
46 | 52 | ColorString = Annotated[
|
@@ -103,8 +109,7 @@ def __enter__(self) -> Self:
|
103 | 109 | The with statement will bind this method's return value to the target(s)
|
104 | 110 | specified in the as clause of the statement, if any.
|
105 | 111 |
|
106 |
| - :return: The TodoistAPI instance. |
107 |
| - :rtype: Self |
| 112 | + :return: This TodoistAPI instance. |
108 | 113 | """
|
109 | 114 | return self
|
110 | 115 |
|
@@ -463,7 +468,6 @@ def uncomplete_task(self, task_id: str) -> bool:
|
463 | 468 | :param task_id: The ID of the task to reopen.
|
464 | 469 | :return: True if the task was uncompleted successfully,
|
465 | 470 | False otherwise (possibly raise `HTTPError` instead).
|
466 |
| - :rtype: bool |
467 | 471 | :raises requests.exceptions.HTTPError: If the API request fails.
|
468 | 472 | """
|
469 | 473 | endpoint = get_api_url(f"{TASKS_PATH}/{task_id}/reopen")
|
|
0 commit comments