Skip to content
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

[openpyxl] Annotate Worksheet and other items #9892

Merged
merged 10 commits into from
Mar 23, 2023

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Mar 16, 2023

No description provided.

@srittau
Copy link
Collaborator Author

srittau commented Mar 16, 2023

I'll update #9511 if this gets merged first.

@overload
def __getitem__(self, key: int | slice) -> tuple[Cell, ...]: ...
@overload
def __getitem__(self, key: str) -> Any: ... # Cell | tuple[Cell, ...]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Another instance where python/typing#566 would come in handy.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks, a few comments:

stubs/openpyxl/openpyxl/cell/cell.pyi Outdated Show resolved Hide resolved
stubs/openpyxl/openpyxl/utils/bound_dictionary.pyi Outdated Show resolved Hide resolved

class BoundDictionary(defaultdict[_KT, _VT], Generic[_KT, _VT]):
reference: str | None
def __init__(self, reference: str | None = None, *args, **kw) -> None: ...
Copy link
Member

Choose a reason for hiding this comment

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

The *args, **kwargs here just forward on the arguments to defaultdict.__init__, but we have 8 overloads for that. So I'm fine with keeping this as it is for now.

stubs/openpyxl/openpyxl/worksheet/dimensions.pyi Outdated Show resolved Hide resolved
stubs/openpyxl/openpyxl/worksheet/dimensions.pyi Outdated Show resolved Hide resolved
stubs/openpyxl/openpyxl/worksheet/dimensions.pyi Outdated Show resolved Hide resolved
stubs/openpyxl/openpyxl/worksheet/dimensions.pyi Outdated Show resolved Hide resolved
Comment on lines 137 to 140
@property
def rows(self) -> Generator[Cell, None, None]: ...
def rows(self) -> Generator[tuple[Cell, ...], None, None]: ...
@property
def values(self) -> Generator[str | float | datetime | None, None, None]: ...
def values(self) -> Generator[tuple[str | float | datetime | None, ...], None, None]: ...
Copy link
Member

Choose a reason for hiding this comment

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

Revert change to auto_type, might find a better solution in the future.
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

LGTM!

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood merged commit c7d805b into python:main Mar 23, 2023
@srittau srittau deleted the openpyxl-stuff branch March 24, 2023 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants