-
-
Notifications
You must be signed in to change notification settings - Fork 144
GH1226 Add Styler.map to the stubs #1228
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
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7a47b42
GH1226 Add Styler.map to the stubs
loicdiridollou a3357a3
Update pandas-stubs/io/formats/style.pyi
loicdiridollou 85eac7a
GH1226 PR Feedback
loicdiridollou 75b9ad9
GH1226 PR Feedback
loicdiridollou b7a991b
GH1226 PR Feedback
loicdiridollou 6dd566a
GH1226 PR Feedback
loicdiridollou 8196941
GH1226 PR Feedback
loicdiridollou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs indicate what the callable should look like, and kwargs has to be a dict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a little tricky since the example on the docs mention that you can pass kwargs to the function so the signature would be something like, Callable[[Scalar, kwargs], str | None].
I will type it in as Callable[[Scalar], str | None] since the docs itself mention the return type None and then we can see if users complain. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do this with an overload? If
kwargs
is not specified, then we use a single argument in theCallable
. Ifkwargs
is specified as adict
, then a differentCallable
signature is needed.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dr-Irv
As far as I know kwargs are annotated with the type of the values so if it can be only ints, then it's
kwargs: int
, if it can be anything then it'skwargs: Any
I am pretty sure we don't expect only dictionaries to be passed in kwargs here so
Any
seems correcthttps://peps.python.org/pep-0484/#arbitrary-argument-lists-and-default-argument-values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example in the docs passes a str and not a dict so indeed we may be a bit lax.