Skip to content
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

TYP: improve typing for DataFrame.to_string #44426

Merged
merged 5 commits into from
Nov 18, 2021

Conversation

topper-123
Copy link
Contributor

No description provided.

@topper-123 topper-123 changed the title TYP: improve typing for type DataFrame.to_string TYP: improve typing for DataFrame.to_string Nov 13, 2021
self,
buf: None = None,
columns: Sequence[str] | None = None,
col_space: int | None = None,
Copy link
Member

Choose a reason for hiding this comment

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

Not directly related to your pr, but this type hint is wrong, can also be list[int] or dict

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I can look into that. Would like to get current version to pass first, then I’ll do this.

@jreback jreback added the Typing type annotations, mypy/pyright type checking label Nov 14, 2021
@jreback jreback added this to the 1.4 milestone Nov 14, 2021
@jreback
Copy link
Contributor

jreback commented Nov 14, 2021

cc @simonjayhawkins @twoertwein if comments

@overload
def to_string(
self,
buf: None = None,
Copy link
Member

Choose a reason for hiding this comment

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

can leave out the defaults for the overloads. It's only the parameter types that are relevant in overloads.

Suggested change
buf: None = None,
buf: None = ...,

Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

@topper-123 there was a parameter moved in #44331

need changes here to the overloads to prevent mypy errors on merge master.

pandas/core/frame.py:1094: error: Overloaded function implementation does not accept all possible arguments of signature 1  [misc]
pandas/core/frame.py:1094: error: Overloaded function implementation does not accept all possible arguments of signature 2  [misc]

@topper-123
Copy link
Contributor Author

Updated.

Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

Thanks @topper-123 LGTM

@topper-123
Copy link
Contributor Author

Ping…

@simonjayhawkins simonjayhawkins merged commit fb567c8 into pandas-dev:master Nov 18, 2021
@simonjayhawkins
Copy link
Member

Thanks @topper-123

@simonjayhawkins
Copy link
Member

This is going to fail ci checks... looking now.

@simonjayhawkins
Copy link
Member

FilePathOrBuffer was changed in #43951

@topper-123 topper-123 deleted the type_to_string branch November 18, 2021 10:09
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.

4 participants