Skip to content

TYP/CLN: cleanup _openpyxl.py, add type annotation #36021 #36022

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 9 commits into from
Sep 1, 2020

Conversation

fangchenli
Copy link
Member

@fangchenli fangchenli commented Sep 1, 2020

@fangchenli fangchenli changed the title TYP/CLN: cleanup, add type annotation #36021 TYP/CLN: cleanup _openpyxl.py, add type annotation #36021 Sep 1, 2020
@@ -515,16 +484,17 @@ def get_sheet_by_index(self, index: int):

def _convert_cell(self, cell, convert_float: bool) -> Scalar:

# TODO: replace with openpyxl constants
from openpyxl.cell.cell import TYPE_BOOL, TYPE_ERROR, TYPE_NUMERIC

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openpyxl verion < 2.6 would raise import error here.

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Sep 1, 2020
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @VirosaLi for the PR.

if updating minimum versions need to update Increased minimum versions for dependencies of doc\source\whatsnew\v1.2.0.rst and pandas\doc\source\getting_started\install.rst

I'm not sure whether we want to update minimum versions just for typing @WillAyd

@simonjayhawkins
Copy link
Member

@VirosaLi to fix the import errors, use quotes around the type (or can use from __future__ import annotations if #36034 approved. )

return self.book.save(self.path)

@classmethod
def _convert_to_style(cls, style_dict):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this method is used anywhere. And it doesn't affect any test. Also, it seems like openpyxl doesn't have a style module anymore.

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments. I think the bump is OK given it's been out for a year and a half at this point

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @VirosaLi

@WillAyd WillAyd added this to the 1.2 milestone Sep 1, 2020
@WillAyd WillAyd merged commit ecc5015 into pandas-dev:master Sep 1, 2020
@fangchenli fangchenli deleted the type-openpyxl branch September 2, 2020 01:04
sarthakvk pushed a commit to sarthakvk/pandas that referenced this pull request Sep 2, 2020
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TYP/CLN: cleanup _openpyxl.py, add type annotation
3 participants