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

Code before:
        **kwargs: Unpack[EnqueueLinksKwargs],
    ) -> Coroutine[None, None, None]:
        """A call dunder method.

        Args:
            selector: CSS selector used to find the elements containing the links.
            label: Label for the newly created `Request` objects, used for request routing.
            user_data: User data to be provided to the newly created `Request` objects.
            **kwargs: Additional arguments for the `add_requests` method.
        """


class SendRequestFunction(Protocol):
    """Type of a function for performing an HTTP request."""

    def __call__(
        self,
        url: str,
        *,
        method: HttpMethod = 'GET',
        headers: HttpHeaders | dict[str, str] | None = None,
    ) -> Coroutine[None, None, HttpResponse]: ...


class UseStateFunction(Protocol):
    """Type of a function for performing Use State."""

    def __call__(
        self,
        key: str,
        default_value: dict[str, Any] | None = None,
    ) -> Coroutine[None, None, dict]: ...


T = TypeVar('T')


class KeyValueStoreInterface(Protocol):
    """The (limited) part of the `KeyValueStore` interface that should be accessible from a request handler."""

    @overload
    async def get_value(self, key: str) -> Any: ...

    @overload
    async def get_value(self, key: str, default_value: T) -> T: ...

    @overload
    async def get_value(self, key: str, default_value: T | None = None) -> T | None: ...

    async def get_value(self, key: str, default_value: T | None = None) -> T | None: ...


Review comment (suggestion):
```suggestion
    """Type of a function for performing use state."""
```

Code after:
        **kwargs: Unpack[EnqueueLinksKwargs],
    ) -> Coroutine[None, None, None]:
        """A call dunder method.

        Args:
            selector: CSS selector used to find the elements containing the links.
            label: Label for the newly created `Request` objects, used for request routing.
            user_data: User data to be provided to the newly created `Request` objects.
            **kwargs: Additional arguments for the `add_requests` method.
        """


class SendRequestFunction(Protocol):
    """Type of a function for performing an HTTP request."""

    def __call__(
        self,
        url: str,
        *,
        method: HttpMethod = 'GET',
        headers: HttpHeaders | dict[str, str] | None = None,
    ) -> Coroutine[None, None, HttpResponse]: ...


class UseStateFunction(Protocol):
    """Type of a function for performing use state.

    Warning:
        This is an experimental feature. The behavior and interface may change in future versions.
    """

    def __call__(
        self,
        key: str,
        default_value: dict[str, JsonSerializable] | None = None,
    ) -> Coroutine[None, None, dict[str, JsonSerializable]]: ...


T = TypeVar('T')


class KeyValueStoreInterface(Protocol):
    """The (limited) part of the `KeyValueStore` interface that should be accessible from a request handler."""

    @overload
    async def get_value(self, key: str) -> Any: ...

    @overload
    async def get_value(self, key: str, default_value: T) -> T: ...

    @overload