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: Add _WorkbookChild / ReadOnlyWorksheet / Workbook annotations #11677

Merged
merged 3 commits into from
Apr 1, 2024

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Mar 31, 2024

Extracted from #9511 and added all _WorkbookChild / ReadOnlyWorksheet / Workbook annotations I could find using the following search:

I updated parameter annotations for all of the following mathcing "whole word" regex:

  • worksheet[,:\)]
  • .*_worksheet[,:\)]
  • sheets?[,:\)]
  • ws[,:\)]
  • parent[,:\)]
  • wb[,:\)]
  • workbook[,:\)]
  • .*_workbook[,:\)]

And the return type of functions matching the following:

  • def .*?workbook.*?\(
  • def .*?sheet.*?\(

(note I looked for a few other variations of the above words, but they didn't match anything)

Now that typeshed has support for PEP 696, Workbook should probably be made generic on read_only and write_only, but that's out of scope for this PR. (see #9940 )

Added refs to python/mypy#6700

This comment has been minimized.

Copy link
Contributor

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

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Looks reasonable after spot checking.

@srittau srittau merged commit 0cea0bc into python:main Apr 1, 2024
43 checks passed
@Avasam Avasam deleted the worksheet-type-annotations branch April 1, 2024 13:41
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.

2 participants