From 1fb34b5a8096691126e719f15c2c8f6567932399 Mon Sep 17 00:00:00 2001 From: ramnes Date: Wed, 15 Jan 2025 11:17:10 +0100 Subject: [PATCH] Fix the iteration helpers type annotations Our generators do not yield lists, they yield whatever the function they wrap returns. Fixes #253 --- notion_client/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notion_client/helpers.py b/notion_client/helpers.py index 7ade264..8f66960 100644 --- a/notion_client/helpers.py +++ b/notion_client/helpers.py @@ -36,7 +36,7 @@ def get_id(url: str) -> str: def iterate_paginated_api( function: Callable[..., Any], **kwargs: Any -) -> Generator[List[Any], None, None]: +) -> Generator[Any, None, None]: """Return an iterator over the results of any paginated Notion API.""" next_cursor = kwargs.pop("start_cursor", None) @@ -57,7 +57,7 @@ def collect_paginated_api(function: Callable[..., Any], **kwargs: Any) -> List[A async def async_iterate_paginated_api( function: Callable[..., Awaitable[Any]], **kwargs: Any -) -> AsyncGenerator[List[Any], None]: +) -> AsyncGenerator[Any, None]: """Return an async iterator over the results of any paginated Notion API.""" next_cursor = kwargs.pop("start_cursor", None)