diff --git a/src/crawlee/base_storage_client/_base_dataset_client.py b/src/crawlee/base_storage_client/_base_dataset_client.py index eb92718da9..ca53d5603d 100644 --- a/src/crawlee/base_storage_client/_base_dataset_client.py +++ b/src/crawlee/base_storage_client/_base_dataset_client.py @@ -122,6 +122,11 @@ async def iterate_items( An asynchronous iterator of dictionary objects, each representing a dataset item after applying the specified filters and transformations. """ + # This syntax is to make mypy properly work with abstract AsyncIterator. + # https://mypy.readthedocs.io/en/stable/more_types.html#asynchronous-iterators + raise NotImplementedError + if False: # type: ignore[unreachable] + yield 0 @abstractmethod async def get_items_as_bytes( diff --git a/src/crawlee/memory_storage_client/_dataset_client.py b/src/crawlee/memory_storage_client/_dataset_client.py index a4ca6d7a90..8877134cbd 100644 --- a/src/crawlee/memory_storage_client/_dataset_client.py +++ b/src/crawlee/memory_storage_client/_dataset_client.py @@ -203,7 +203,7 @@ async def list_items( ) @override - async def iterate_items( # type: ignore + async def iterate_items( self, *, offset: int = 0, diff --git a/src/crawlee/storages/_dataset.py b/src/crawlee/storages/_dataset.py index 1b244b61f5..526e12296b 100644 --- a/src/crawlee/storages/_dataset.py +++ b/src/crawlee/storages/_dataset.py @@ -404,7 +404,7 @@ async def iterate_items( Yields: Each item from the dataset as a dictionary. """ - async for item in self._resource_client.iterate_items( # type: ignore + async for item in self._resource_client.iterate_items( offset=offset, limit=limit, clean=clean,