-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
GH:624 - added mode
keyword to DataFrame.to_json
#684
Conversation
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.
This is a bit tricky. You have to put the 2 overloads for orient = Literal["records"]
first, but without the "= ..." . The first two overloads would then have lines: Literal[True]
and mode: Literal["a"]
. This may need an *
in the right places (see DataFrame.to_dict()
for an example). Then you add another pair of overloads with orient: Literal["records"]
and lines: Literal[False] = ...
, mode: Literal["w"] = ...
. Then you have the 2 overloads that are there where mode: Literal["w"] = ...
is allowed.
You also have to fix the overloads in series.pyi
.
For the tests, you should test the valid and invalid combinations, using TYPE_CHECKING_INVALID_USAGE
for the invalid ones, with appropriate ignore
statements.
Were you trying to write |
It may be that the second set of overloads I suggested are not needed because of the overlap you mention. |
I have done the needfull but the only problem is with the warnings in the test, could you please help with that |
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.
2 small changes, and then it should be good to go
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.
2 small changes, and then it should be good to go
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.
Thanks @ramvikrams
assert_type()
to assert the type of any return value