Repository: apify/crawlee-python
File: src/crawlee/storages/_dataset.py (Python)

Code before:

    _EFFECTIVE_LIMIT_SIZE = _MAX_PAYLOAD_SIZE - (_MAX_PAYLOAD_SIZE * _SAFETY_BUFFER_PERCENT)
    """Calculated payload limit considering safety buffer."""

    def __init__(self, id: str, name: str | None, storage_client: StorageClient) -> None:
        self._id = id
        self._name = name
        datetime_now = datetime.now(timezone.utc)
        self._storage_object: StorageMetadata = StorageMetadata(
            id=id, name=name, accessed_at=datetime_now, created_at=datetime_now, modified_at=datetime_now
        )

        # Get resource clients from the storage client.
        self._resource_client = storage_client.dataset(self._id)
        self._resource_collection_client = storage_client.datasets()

    @classmethod
    def from_storage_object(cls, storage_client: StorageClient, storage_object: StorageMetadata) -> Dataset:
        """Create a new instance of Dataset from a storage metadata object."""
        dataset = Dataset(
            id=storage_object.id,
            name=storage_object.name,
            storage_client=storage_client,
        )

        dataset.set_storage_object(storage_object)
        return dataset

    @property
    @override
    def id(self) -> str:
        return self._id

    @property
    @override
    def name(self) -> str | None:
        return self._name

    @property
    @override
    def storage_object(self) -> StorageMetadata:
        return self._storage_object

    @classmethod
    @override
    def set_storage_object(cls, storage_object: StorageMetadata) -> None:
        cls._storage_object = storage_object

    @override
    @classmethod
    async def open(

Review comment (suggestion):
When you add the setter through the decorator,then you can assign value like this:

`dataset.storage_object  = storage_object`

Code after:

    _EFFECTIVE_LIMIT_SIZE = _MAX_PAYLOAD_SIZE - (_MAX_PAYLOAD_SIZE * _SAFETY_BUFFER_PERCENT)
    """Calculated payload limit considering safety buffer."""

    def __init__(self, id: str, name: str | None, storage_client: StorageClient) -> None:
        self._id = id
        self._name = name
        datetime_now = datetime.now(timezone.utc)
        self._storage_object = StorageMetadata(
            id=id, name=name, accessed_at=datetime_now, created_at=datetime_now, modified_at=datetime_now
        )

        # Get resource clients from the storage client.
        self._resource_client = storage_client.dataset(self._id)
        self._resource_collection_client = storage_client.datasets()

    @classmethod
    def from_storage_object(cls, storage_client: StorageClient, storage_object: StorageMetadata) -> Dataset:
        """Create a new instance of Dataset from a storage metadata object."""
        dataset = Dataset(
            id=storage_object.id,
            name=storage_object.name,
            storage_client=storage_client,
        )

        dataset.storage_object = storage_object
        return dataset

    @property
    @override
    def id(self) -> str:
        return self._id

    @property
    @override
    def name(self) -> str | None:
        return self._name

    @property
    @override
    def storage_object(self) -> StorageMetadata:
        return self._storage_object

    @storage_object.setter
    @override
    def storage_object(self, storage_object: StorageMetadata) -> None:
        self._storage_object = storage_object

    @override
    @classmethod
    async def open(