-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Typ parts of c parser #44677
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
Typ parts of c parser #44677
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
92ed9b7
Start typing
phofl 182217a
Continue typing
phofl 42b15a2
Merge remote-tracking branch 'upstream/master' into typ_c_parser
phofl 091b052
Resolve conflicts
phofl a9b4e07
Add argument back in
phofl 2596f19
Adress review
phofl 95a0de0
Improve callable
phofl 9979f41
Merge remote-tracking branch 'upstream/master' into typ_c_parser
phofl de71573
Merge remote-tracking branch 'upstream/master' into typ_c_parser
phofl 3146aae
Merge remote-tracking branch 'upstream/master' into typ_c_parser
phofl 30c46b2
Merge remote-tracking branch 'upstream/master' into typ_c_parser
phofl 129d5af
Merge remote-tracking branch 'upstream/master' into typ_c_parser
phofl 5f32d2f
Merge remote-tracking branch 'upstream/master' into typ_c_parser
phofl 34795f8
Remove return from init
phofl fa8fc9b
Change callable
phofl 6df4cdc
Change callable
phofl d8fa395
Merge remote-tracking branch 'upstream/master' into typ_c_parser
phofl 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
Improve callable
- Loading branch information
commit 95a0de0cc11d242417c7b10f17cb94aae2c7db9d
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
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.
can the callable return a bool?
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.
No, the return values are indices
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.
sorry should have been more clear.
I'm curious as to why usecols is a callable with an
int
return type.ParserBase.__init__
is not typed, so it is not clear to me why this isint
.bool
is type compatible here and surely any truthy value is valid. So the return type of the usecols callable is whatever the public api accepts. This is any object that can be truthy?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.
ah got you, yeah you are correct, this has to return a bool
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.
in the docs for say read_csv https://pandas.pydata.org/pandas-docs/dev/reference/api/pandas.read_csv.html
So doesn't explicitly say it should be
bool
, but why hasint
been chosen?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.
Because I minsinterpreted the return value of the callable as the return value of _evaluate_use_cols. Confused both with eacht other
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.
sure. we do use
bool
in many places in the public api where the api probably accepts any object that can be truthy. This may become an issue for users when the types are public and users start getting false positives when type checking.so changing to bool is fine for now.
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.
Technically this could return anything, which evaluates to True/False. But since the docs say that this has to evaluate to True, I think we can type it like this?
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.
Based on the doc-string (I didn't look at the code), it should probably be
Callable[[Hashable], object]
.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.
Changed to object