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.
CLN/TYP: pandas/io/formats/excel.py #37862
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
CLN/TYP: pandas/io/formats/excel.py #37862
Changes from 7 commits
8d5d4bb
b066f5f
3484f53
5c2f160
ee884ca
dab9e15
1ff8cb8
ee09d4d
c5e1d9c
7d27a71
2f02811
a63b7d1
9fcfb32
aa48fb6
f4abe27
f468397
4cf8f83
084e953
8a9a40a
2ee661c
c88aff9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
glad to see this. for some reason my local mypy diagrees with the CI about whether its L601 or L602 that has the problem
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.
It seems that the problem was with len(self.header), so it should be line 602, but presumably one line was added on top since then.
EDIT: I guess I am not correct here...
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.
once we add a runtime isinstance, this sort of duplicates the _has_aliases property.
since self.header is a sequence or bool, maybe _has_aliases could reflect that instead of the explicit checks for the 4 classes.
if we have a guarantee from the is_* call, a cast would be more appropriate than the assert.
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.
Updated.
Used casting instead of asserting.
In
_has_aliases
check if not boolean rather than 4 sequence-like classes.Is that what you meant?
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.
If the types are correct for the header parameter of ExcelFormatter then this should be fine.
also cast is a no-op, so no harm using
self.header = cast(Sequence, self.header)
and the other self.header -> header changes wouldn't be needed.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.
OK, changed the casting as you suggested.