Open dave-edison opened 6 months ago
Not sure if this is still a problem, with pyright 1.1.367 this code seem to work for me:
import polars as pl
from polars.dataframe.group_by import GroupBy
def f() -> GroupBy:
return pl.DataFrame().group_by("a")
t.reveal_type(f()) # GroupBy as expected
This is in strict mode.
[tool.pyright]
typeCheckingMode = "strict"
useLibraryCodeForTypes = true
pythonVersion = "3.12"
reportUnnecessaryTypeIgnoreComment = true
reportMissingTypeStubs = false
Description
I have a function which returns a
GroupBy
, but it doesn't seem possible to provide type hints for it in a way that appeases static type checkers (or at least pyright, can't speak to mypy or others).Using
polars.dataframe.group_by.GroupBy
gives anreportAttributeAccessIssue
error, and I don't see anything inpolars.type_aliases
that would work here.Certainly possible I'm missing something! If not, it would be nice to be able to give hints for this, although I also understand that returning a
GroupBy
in a function is somewhat non-standard usage.