You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, when it comes to using a str as a key, there is simply no way to know statically whether you are targeting an individual cell, row, column or full range. So the type would be Cell | tuple[Cell, ...] | tuple[tuple[Cell, ...], ...], which is too distruptive so we fallback to Any (see python/mypy#1693)
The case for slicing can be improved, but unfortunately only to remove false-positives, in favor of false-negatives. (which we prefer).
I originally posted this on the
openpyxl
GitLab but it seems that they don't maintain the type annotations.The first issue is that
worksheet[start:end]
seems to return atuple[tuple[Cell]]
, but the type annotations imply that it returns atuple[cell]
.You can see this issue in the following code:
Type checkers believe one thing:
Python disagrees:
Versions:
The second issue relates to a single string index:
The text was updated successfully, but these errors were encountered: