Skip to content

TYP: type all arguments with int default values #48761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 26, 2022
Merged

TYP: type all arguments with int default values #48761

merged 5 commits into from
Sep 26, 2022

Conversation

twoertwein
Copy link
Member

This enables the last missing check from autotyping: adding type annotations for int default values.

Some of the axis might need some more scrutiny whether they allow only ints or also "index" and "columns". Wouldn't mind postponing that when tightening Axis to Literal[0, 1, "index", "columns", "rows"].

stacking_id=None,
*,
bins,
Copy link
Member Author

Choose a reason for hiding this comment

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

bins cannot be None as len(None) raises.

@mroeschke mroeschke merged commit 71c94c3 into pandas-dev:main Sep 26, 2022
@mroeschke
Copy link
Member

Thanks @twoertwein

Some of the axis might need some more scrutiny whether they allow only ints or also "index" and "columns".

Yeah definitely. Is there an open issue about this in the issue tracker? IMO public API axis args should be able to accept Literal[0, 1, "index", "columns", "rows"] but immediately converted to 0/1

@mroeschke mroeschke added the Typing type annotations, mypy/pyright type checking label Sep 26, 2022
@mroeschke mroeschke added this to the 1.6 milestone Sep 26, 2022
@twoertwein
Copy link
Member Author

MO public API axis args should be able to accept Literal[0, 1, "index", "columns", "rows"] but immediately converted to 0/1

That is also my assumption/expectation :) however, I think that some of the self.axis might also be "index/columns". hopefully can figure it out with mypy+doc-string+some runtime testing.

@mroeschke mroeschke modified the milestones: 1.6, 2.0 Oct 13, 2022
noatamir pushed a commit to noatamir/pandas that referenced this pull request Nov 9, 2022
* TYP: type all arguments with int default values

* multiindex

* _get_ordinal_range

* fix plotting/_matplotlib/hist.py

* mark only bins as keyword-only
@twoertwein twoertwein deleted the int branch August 9, 2023 15:08
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants