Skip to content

Conversation

@twoertwein
Copy link
Member

There are (unsurprisingly) many errors when trying to use pyright/mypy to validate pandas-stub's tests against the pandas annotations. This PR fixes three of them.

cls,
iterables: Sequence[Iterable[Hashable]],
sortorder: int | None = None,
names: Sequence[str | None] | lib.NoDefault = lib.no_default,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think names: Sequence[Level | None] | lib.NoDefault or similar as the docstring is under-specifying what can be accepted here (more than just strings)

In [1]: >>> numbers = [0, 1, 2] ...: >>> colors = ['green', 'purple'] ...: >>> pd.MultiIndex.from_product([numbers, colors], ...: ... names=[55, 60]) Out[1]: MultiIndex([(0, 'green'), (0, 'purple'), (1, 'green'), (1, 'purple'), (2, 'green'), (2, 'purple')], names=[55, 60]) 
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for reviewing all of the typing PRs!

@mroeschke mroeschke added the Typing type annotations, mypy/pyright type checking label Jul 1, 2022
@mroeschke mroeschke added this to the 1.5 milestone Jul 1, 2022
@jreback jreback merged commit a7c8513 into pandas-dev:main Jul 3, 2022
@jreback
Copy link
Contributor

jreback commented Jul 3, 2022

thanks @twoertwein

yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
@twoertwein twoertwein deleted the stubs branch September 21, 2022 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Typing type annotations, mypy/pyright type checking

3 participants