-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: fix mypy ignored error in pandas/io/formats/latex.py #37738
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
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.
Thanks @ivanovmg generally lgtm.
pandas/io/formats/latex.py
Outdated
self.strcols: Sequence[Sequence[str]] = self._get_strcols() | ||
self.strrows: Sequence[Sequence[str]] = list(zip(*self.strcols)) |
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 variable type annotations can be removed. My preference is not to add variable types annotations unless absolutely necessary.
the variable types for self.strcols and self.strrows can (should) be inferred from the rhs expression.
self.strcols: Revealed type is 'builtins.list[builtins.list[builtins.str]]'
self.strrows: Revealed type is 'builtins.list[builtins.tuple*[Any]]'
I'm not sure why mypy can't infer more precise for self.strrows
mypy is green, but if wanted to be more precise for self.strrows could use List[Tuple[str, ...]]
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.
Thank you for the suggestions!
Updated accordingly.
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 @ivanovmg ping on green.
@simonjayhawkins looks like green (internal Windows py38_np18 error) |
Thanks @ivanovmg |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Handle mypy ignored error in
pandas/io/formats/latex.py
.