Skip to content

Commit 8dc5b34

Browse files
Merge #956
956: Fix reported type of decorator r=curquiza a=sanders41 # Pull Request ## Related issue Fixes #<issue_number> Reported on Discord https://discord.com/channels/1006923006964154428/1006923007559729154/1235605897418506401 The Return type is getting swallowed by the `version_error_hint_message` decorator. ![image](https://github.com/meilisearch/meilisearch-python/assets/25045024/1467c6b1-3d86-449a-ba6c-15b2a7c33777) ## What does this PR do? - Uses a generic instead of `Any` for the decorator. After the update: ![image](https://github.com/meilisearch/meilisearch-python/assets/25045024/3eb434a2-08ab-46fd-8bd1-24db11e8ce64) ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: Paul Sanders <[email protected]>
2 parents a3401ae + 036296f commit 8dc5b34

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

meilisearch/errors.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import json
44
from functools import wraps
5-
from typing import TYPE_CHECKING, Any, Callable
5+
from typing import TYPE_CHECKING, Any, Callable, TypeVar
66

77
from requests import Response
88

@@ -11,6 +11,8 @@
1111
from meilisearch.index import Index
1212
from meilisearch.task import TaskHandler
1313

14+
T = TypeVar("T")
15+
1416

1517
class MeilisearchError(Exception): # pragma: no cover
1618
"""Generic class for Meilisearch error handling"""
@@ -63,7 +65,7 @@ def __str__(self) -> str: # pragma: no cover
6365
return f"MeilisearchTimeoutError, {self.message}"
6466

6567

66-
def version_error_hint_message(func: Callable) -> Any:
68+
def version_error_hint_message(func: Callable[..., T]) -> Callable[..., T]:
6769
@wraps(func)
6870
def wrapper(*args: Any, **kwargs: Any) -> Any:
6971
try:

0 commit comments

Comments
 (0)