Merge openpyxl stubs from microsoft/python-type-stubs
Bring openpyxl stubs at least up to par with https://github.com/microsoft/python-type-stubs/tree/main/openpyxl
Add class variable types and descriptors for affected classes. For a bit of context: "descriptor" types are assigned to class variables. Those become property-like with getters that type-check on assignment. There's also "Convertible" descriptors that do type coercion.
This is not meant to complete the stub, far from there. Only to make it good enough to upstream. And a few other things here and there.
There's overlap with ~~#9487~~ #9764, I'd suggest finishing that PR first, then I'll double check any conflict that arise. I'll look at primer results after that as well.
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:80: error: Argument 1 to "remove" of "Workbook" has incompatible type "Union[Worksheet, ReadOnlyWorksheet, WriteOnlyWorksheet]"; expected "Union[Worksheet, WriteOnlyWorksheet, Chartsheet]" [arg-type]
+ pandas/io/excel/_openpyxl.py:322: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:473: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:478: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:499: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:520: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:554: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[Union[str, PathLike[str]], IO[bytes]]" [arg-type]
(Adding DO-NOT-MERGE for now, as I agree we should resolve #9487 first before tackling this :)
In the meantime, @AlexWaygood , can we consider allowing lxml-stubs in the stubuploader?
Also, is there a list somewhere of those "stubs taken out of typeshed because incomplete"? I feel it shouldn't be too hard to add 'em back with modern stubgen.
In the meantime, @AlexWaygood , can we consider allowing lxml-stubs in the stubuploader?
SGTM but I'm not a stub-uploader maintainer :)
Also, is there a list somewhere of those "stubs taken out of typeshed because incomplete"? I feel it shouldn't be too hard to add 'em back with modern stubgen.
Not sure I understand, sorry -- what's this a reference to?
Not sure I understand, sorry -- what's this a reference to?
https://pypi.org/project/lxml-stubs/
These type annotations were initially included in typeshed, but lxml's annotations are still incomplete and have therefore been extracted from typeshed to avoid unintentional false positive results.
I feel it's not the first time I see that. Or maybe it is and I just read it twice on the same page.
You'll have to ask one of the other maintainers -- sounds like that all happened before I arrived on the typeshed scene!
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:80: error: Argument 1 to "remove" of "Workbook" has incompatible type "Union[Worksheet, ReadOnlyWorksheet, WriteOnlyWorksheet]"; expected "Union[Worksheet, WriteOnlyWorksheet, Chartsheet]" [arg-type]
+ pandas/io/excel/_openpyxl.py:322: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:473: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:478: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:499: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:520: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:554: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[Union[str, PathLike[str]], IO[bytes]]" [arg-type]
In the meantime, @AlexWaygood , can we consider allowing lxml-stubs in the stubuploader?
SGTM but I'm not a stub-uploader maintainer :)
On second thought -- with our current setup, I think you'll be unable to use lxml-stubs even if wwe add them to the stub-uploader allowlist :( The current rules on the stub-uploader are that non-types dependencies must be explicitly included in the "non-types allowlist", and also be specified as a requirement of the runtime package. But the runtime package doesn't declare lxml-stubs as a dependency, so the stub-uploader tests will fail even if we add lxml-stubs in the stub-uploader :/
This is an annoying situation but I'm not sure what the solution might be.
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:80: error: Argument 1 to "remove" of "Workbook" has incompatible type "Union[Worksheet, ReadOnlyWorksheet, WriteOnlyWorksheet]"; expected "Union[Worksheet, WriteOnlyWorksheet, Chartsheet]" [arg-type]
+ pandas/io/excel/_openpyxl.py:322: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:473: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:478: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:499: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:520: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:554: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[Union[str, PathLike[str]], IO[bytes]]" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:80: error: Argument 1 to "remove" of "Workbook" has incompatible type "Union[Worksheet, ReadOnlyWorksheet, WriteOnlyWorksheet]"; expected "Union[Worksheet, WriteOnlyWorksheet, Chartsheet]" [arg-type]
+ pandas/io/excel/_openpyxl.py:322: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:473: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:478: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:499: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:520: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:554: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[Union[str, PathLike[str]], IO[bytes]]" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:330: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:481: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:486: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:506: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:527: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:561: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[IO[bytes], Union[str, PathLike[str]]]" [arg-type]
I've added comments for the less obvious conflicts. Everything else should be self-explanatory (hopefully). Ready for review!
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:330: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:481: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:486: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:506: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:527: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:561: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[IO[bytes], Union[str, PathLike[str]]]" [arg-type]
Big batch of changes. I've commented out lxml stuff for now. Will see about completely moving it out later (gotta go sleep!). Btw I haven't validated mypy_primer errors yet either.
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:330: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:481: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:486: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:506: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:527: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:561: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[IO[bytes], Union[str, PathLike[str]]]" [arg-type]
I agree with @AlexWaygood above about literal types. I think that when in doubt, it's usually better to not use a literal type. In my experience users rarely use literal types when annotating code, so literal types in stubs can cause errors that are perceived by users as false positives, even if they are technically valid.
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:330: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:481: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:486: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:506: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:527: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:561: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[IO[bytes], Union[str, PathLike[str]]]" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:330: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:481: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:486: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:506: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:527: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:561: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[IO[bytes], Union[str, PathLike[str]]]" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:330: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:481: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:486: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:506: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:527: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:561: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[IO[bytes], Union[str, PathLike[str]]]" [arg-type]
(I've been quite occupied last week, and I got sick this week. I'll look into using proper descriptors in stubs and cleaning up this PR further soon once I feel a bit better)
(I've been quite occupied last week, and I got sick this week. I'll look into using proper descriptors in stubs and cleaning up this PR further soon once I feel a bit better)
The ball's in my court on this one anyway, I owe you the next round of review comments :)
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:331: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:482: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:487: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:507: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:528: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:562: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[IO[bytes], Union[str, PathLike[str]]]" [arg-type]
#9921 will fix the stubtest failures relating to the new modules added in recent releases
I've merged in the existing changes, but this might have introduces new problems, since some changes were incompatible.
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:331: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:482: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:487: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:507: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:528: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:562: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[IO[bytes], Union[str, PathLike[str]]]" [arg-type]
I do think I have a viable solution for the fake desrciptors, by making them look like real generic descriptors! I can even deal with allow_none properly.

Their use is internal only, so as long as the getter/setter works properly and stubtest is happy, should be good. Added bonus that I can correctly type properties using the descriptors instead of the more verbose @property workaround that stubtest also doesn't like.
I'm making a completely different PR for that. And it should massively simplify this here PR.
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:331: error: Argument "style" to "Side" has incompatible type "str"; expected "Optional[Literal['dashDot', 'dashDotDot', 'dashed', 'dotted', 'double', 'hair', 'medium', 'mediumDashDot', 'mediumDashDotDot', 'mediumDashed', 'slantDashDot', 'thick', 'thin']]" [arg-type]
+ pandas/io/excel/_openpyxl.py:482: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:487: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:507: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:528: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:562: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[IO[bytes], Union[str, PathLike[str]]]" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:482: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:487: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:507: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:528: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:571: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[IO[bytes], Union[str, PathLike[str]]]" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/excel/_openpyxl.py:482: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:487: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:507: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "merge_cells" [union-attr]
+ pandas/io/excel/_openpyxl.py:528: error: Item "WriteOnlyWorksheet" of "Union[WriteOnlyWorksheet, Worksheet]" has no attribute "cell" [union-attr]
+ pandas/io/excel/_openpyxl.py:571: error: Argument 1 to "load_workbook" has incompatible type "Union[Union[str, PathLike[str]], ReadBuffer[bytes]]"; expected "Union[IO[bytes], Union[str, PathLike[str]]]" [arg-type]