-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Various annotations extracted from #9511 #11092
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
This comment has been minimized.
This comment has been minimized.
source: Incomplete | ||
shared_strings: Incomplete | ||
source: _FileRead | ||
shared_strings: SupportsGetItem[int, Incomplete] |
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 doesn't feel right to have such a simple Protocol as an attribute, but openpyxl's own usage of it is extremely simple. I don't see the property being dynamically bound anywhere else. It's in a private module. And it's undocumented.
If someone reports needing it, we could make it generic.
Ah fun /s, even if return types are accurate, it leads to errors if the value is fed back into a method that's still inaccurately only expects |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…mplex-extraction-from-9511
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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, just one remark below.
start_row: Unused = None, | ||
start_column: Unused = None, | ||
end_row: Unused = None, | ||
end_column: Unused = None, |
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.
I wonder whether it would be safer to use : None = None
here. It seems providing range_string
and the rows and cols - while working at runtime - could introduce subtle bugs and is probably not what anyone wants.
But we should at least use ConvertibleToInt | None
instead of Unused
, because providing anything else (while working) is surely a bug.
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. I can see how passing both (which this allows) may lead to unexpected bug by not knowing which param is actually used. I'll move the concept that these params go unused in that overload as a comment instead of the parameter type.
…/Avasam/typeshed into non-complex-extraction-from-9511
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Extracted from, and improved over #9511 to make these changes reviewable.
The following changes from #9511 is not present here:
Cell
,MergedCell
,ReadOnlyWorksheet
,_WorkbookChild
annotations and their subclasses that can't be explicitly known by looking at surface implementation (so new instances andisinstance
checks)stubs/openpyxl/openpyxl/worksheet/_reader.pyi
stubs/openpyxl/openpyxl/styles/styleable.pyi
to_tree
methods (openpyxl: typeto_tree
methods #10967)