apify-sdk-python icon indicating copy to clipboard operation
apify-sdk-python copied to clipboard

Replace the usage of `Any` with generic types

Open vdusek opened this issue 2 years ago • 1 comments

Do not use Any type as suggested in the ANN401.

Instead of

from typing import Any

def get_first(container: list[Any]) -> Any:
    return container[0]

use the following

from typing import TypeVar

T = TypeVar('T')

def get_first(container: list[T]) -> T:
    return container[0]

Any can probably still make sense for the *args / **kwargs.

vdusek avatar Nov 20 '23 12:11 vdusek

After #210, I believe the only notable offender is the input shape in Actor.

janbuchar avatar Aug 12 '24 11:08 janbuchar