You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The mypy check complains 'Value of type "Any | Awaitable[Any]" is not indexable' for the line response = self.notion_client.search and all_pages_info.extend(response["results"]).
I wonder how to solve this. Thanks!
The text was updated successfully, but these errors were encountered:
example.py:8: error: Value of type "Any | Awaitable[Any]" is not indexable [index]
Found 1 error in 1 file (checked 1 source file)
So basically what's happening here is that we don't implement response type hints, and our current SyncAsync[Any] workaround you can see everywhere in api_endpoints.py makes Mypy unhappy because it's not precise enough to determine if response["results"] should be allowed or not (i.e. if it's indexable, i.e. if it's a dict).
Honestly it's an error I'm quite surprised to not have encountered yet, but it definitely should be fixed. Even without implementing / supporting all the response type hints, we should definitely replace our Any by something a bit more sensible, it's long overdue.
Some work has already been started / discussed in #200 and #243. I'd be happy if we could land something, even if it just adds the overall message enveloppes and not the precise response types.
PR welcome!
ramnes
changed the title
mypy check complains Value of type "Any | Awaitable[Any]" is not indexable
Response envelope type hints
Dec 18, 2024
When I use the sync client like below
The mypy check complains 'Value of type "Any | Awaitable[Any]" is not indexable' for the line response = self.notion_client.search and all_pages_info.extend(response["results"]).
I wonder how to solve this. Thanks!
The text was updated successfully, but these errors were encountered: