Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/crawlee/storage_clients/_base/_dataset_client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from __future__ import annotations

from abc import ABC, abstractmethod
from collections.abc import Sequence
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from collections.abc import AsyncIterator, Mapping, Sequence
from collections.abc import AsyncIterator, Mapping

from crawlee._types import JsonSerializable
from crawlee.storage_clients.models import DatasetItemsListPage, DatasetMetadata
Expand Down Expand Up @@ -91,3 +92,16 @@ async def iterate_items(
raise NotImplementedError
if False:
yield {}

@staticmethod
def _is_sequence_of_items(
data: Sequence[Mapping[str, JsonSerializable]] | Mapping[str, JsonSerializable],
) -> bool:
"""Tell whether the `push_data` payload is a sequence of items rather than a single item.

No `push_data` implementation in this repository uses this helper - it is inlined there instead. It stays
on the base class because the Apify SDK up to 4.0.1 calls it from `ApifyDatasetClient.push_data`, so
removing it breaks every Actor that resolves such an SDK version against this package. Drop it in the
next major version, once those SDK versions are out of the supported range.
"""
return isinstance(data, Sequence)
Loading