Skip to content

Add explicit -> Any return type annotation to .pin_read and .pin_download #352

@nathanjmcdougall

Description

@nathanjmcdougall

These function sare currently un-annotated, so some type checkers (e.g. pyright) will try to infer based on the underlying function calls like load_data and by extension function calls like pd.DataFrame.

It would be better if we explicitly annotated these with typing.Any since it would mean the type checker short-circuits this inference and wouldn't raise an error if the user fails to narrow down the type through case-checking from DataFrame | dict etc.

It would also play nicer with extension packages like geopins which extend the interface to give extra return types dynamically, which the type checker doesn't know about.

I understand that pins isn't typically used in the context of heavy-duty type checking but I think this is pretty easy thing to add and would make it more pleasant to work with in VS Code which usually does light pyright analysis via pylance.

I can put in a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions