TYP: type all arguments with str default values by twoertwein · Pull Request #48508 · pandas-dev/pandas (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation15 Commits13 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

twoertwein

After this PR autotyping will gently nudge people to add type annotations for arguments with a string default value.

This PR is bigger than expected - there were many untyped arguments that have a string default value.

Typing arguments that have default values is important, as pyright assumes that untyped arguments that have default values are of their default value type (except for None).

mroeschke

mroeschke

mroeschke

@twoertwein

@twoertwein

After this PR autotyping will gently nudge people to add type annotations for arguments with a string default value.

The suggested type by autotyping might not be correct: an argument might accept only specific strings (Literal[...]) or might also accept other types. If the type is incorrect, the PR author who adds a new argument should know how to adjust the type if needed (much easier than someone else trying to add annotations for code they are not 100% sure about).

My goal is to also enable autotyping's suggestion for int and bool but that requires first annotating all arguments with int/bool default values.

@twoertwein

@mroeschke

Looked fairly good. Just a merge conflict

@twoertwein

@twoertwein

@twoertwein

some network timeouts on windows and mac but otherwise all green

@twoertwein

mroeschke

@mroeschke

phofl pushed a commit to phofl/pandas that referenced this pull request

Sep 22, 2022

@twoertwein @phofl

mroeschke added a commit that referenced this pull request

Sep 26, 2022

…8662)

Co-authored-by: Matthew Roeschke 10647082+mroeschke@users.noreply.github.com

scorecard-action does not have a major version tag.

Temporarily disabling github.repository check to ensure action now works.

https://pandas.pydata.org/docs/reference/api/pandas.merge.html It should be "str | bool" instead of just string

fixed type hint in merge.py

Update indicator type hint in _MergeOperation

Added type hint _MergeOperation init

DOC: Document default value for options.display.max_cols

display.max_cols has a default value of 20 when not running in a terminal such as Jupyter Notebook

Co-Authored-By: Matthew Roeschke 10647082+mroeschke@users.noreply.github.com

Co-authored-by: Matthew Roeschke 10647082+mroeschke@users.noreply.github.com

Co-authored-by: Matthew Roeschke 10647082+mroeschke@users.noreply.github.com Co-authored-by: Ralf Gommers ralf.gommers@gmail.com Co-authored-by: Marc Garcia garcia.marc@gmail.com Co-authored-by: Luke Manley lukemanley@gmail.com Co-authored-by: Siddhartha Gandhi siddhartha.a.gandhi@gmail.com Co-authored-by: Torsten Wörtwein twoertwein@users.noreply.github.com Co-authored-by: Xiao Yuan yuanx749@gmail.com Co-authored-by: paradox-lab 57354735+paradox-lab@users.noreply.github.com Co-authored-by: Pedro Nacht 15221358+pnacht@users.noreply.github.com Co-authored-by: dataxerik dsshar@gmail.com Co-authored-by: jbrockmendel jbrockmendel@gmail.com Co-authored-by: Pablo 48098178+PabloRuizCuevas@users.noreply.github.com Co-authored-by: tmoschou 5567550+tmoschou@users.noreply.github.com Co-authored-by: Thomas Li 47963215+lithomas1@users.noreply.github.com Co-authored-by: Richard Shadrach 45562402+rhshadrach@users.noreply.github.com

noatamir pushed a commit to noatamir/pandas that referenced this pull request

Nov 9, 2022

@twoertwein @noatamir

noatamir pushed a commit to noatamir/pandas that referenced this pull request

Nov 9, 2022

…ndas-dev#48662)

Co-authored-by: Matthew Roeschke 10647082+mroeschke@users.noreply.github.com

scorecard-action does not have a major version tag.

Temporarily disabling github.repository check to ensure action now works.

https://pandas.pydata.org/docs/reference/api/pandas.merge.html It should be "str | bool" instead of just string

fixed type hint in merge.py

Update indicator type hint in _MergeOperation

Added type hint _MergeOperation init

DOC: Document default value for options.display.max_cols

display.max_cols has a default value of 20 when not running in a terminal such as Jupyter Notebook

Co-Authored-By: Matthew Roeschke 10647082+mroeschke@users.noreply.github.com

Co-authored-by: Matthew Roeschke 10647082+mroeschke@users.noreply.github.com

Co-authored-by: Matthew Roeschke 10647082+mroeschke@users.noreply.github.com Co-authored-by: Ralf Gommers ralf.gommers@gmail.com Co-authored-by: Marc Garcia garcia.marc@gmail.com Co-authored-by: Luke Manley lukemanley@gmail.com Co-authored-by: Siddhartha Gandhi siddhartha.a.gandhi@gmail.com Co-authored-by: Torsten Wörtwein twoertwein@users.noreply.github.com Co-authored-by: Xiao Yuan yuanx749@gmail.com Co-authored-by: paradox-lab 57354735+paradox-lab@users.noreply.github.com Co-authored-by: Pedro Nacht 15221358+pnacht@users.noreply.github.com Co-authored-by: dataxerik dsshar@gmail.com Co-authored-by: jbrockmendel jbrockmendel@gmail.com Co-authored-by: Pablo 48098178+PabloRuizCuevas@users.noreply.github.com Co-authored-by: tmoschou 5567550+tmoschou@users.noreply.github.com Co-authored-by: Thomas Li 47963215+lithomas1@users.noreply.github.com Co-authored-by: Richard Shadrach 45562402+rhshadrach@users.noreply.github.com

Labels

Typing

type annotations, mypy/pyright type checking

2 participants

@twoertwein @mroeschke