@@ -8,8 +8,9 @@ from openpyxl.comments.comments import Comment
88from openpyxl .compat .numbers import NUMERIC_TYPES as NUMERIC_TYPES # cell numeric types
99from openpyxl .styles .cell_style import StyleArray
1010from openpyxl .styles .styleable import StyleableObject
11+ from openpyxl .workbook .child import _WorkbookChild
12+ from openpyxl .worksheet ._read_only import ReadOnlyWorksheet
1113from openpyxl .worksheet .hyperlink import Hyperlink
12- from openpyxl .worksheet .worksheet import Worksheet
1314
1415__docformat__ : Final = "restructuredtext en"
1516TIME_TYPES : Final [tuple [type , ...]]
@@ -41,7 +42,7 @@ class Cell(StyleableObject):
4142 # row and column are never meant to be None and would lead to errors
4243 def __init__ (
4344 self ,
44- worksheet : Worksheet ,
45+ worksheet : _WorkbookChild | ReadOnlyWorksheet ,
4546 row : int ,
4647 column : int ,
4748 value : str | float | datetime | None = None ,
@@ -86,10 +87,13 @@ class MergedCell(StyleableObject):
8687 hyperlink : Hyperlink | None
8788 row : int | None
8889 column : int | None
89- def __init__ (self , worksheet : Worksheet , row : int | None = None , column : int | None = None ) -> None : ...
90+ def __init__ (
91+ self , worksheet : _WorkbookChild | ReadOnlyWorksheet , row : int | None = None , column : int | None = None
92+ ) -> None : ...
9093 # Same as Cell.coordinate
94+ # https://github.com/python/mypy/issues/6700
9195 @property
9296 def coordinate (self ) -> str : ...
9397 value : str | float | int | datetime | None
9498
95- def WriteOnlyCell (ws : Worksheet | None = None , value : str | float | datetime | None = None ) -> Cell : ...
99+ def WriteOnlyCell (ws : _WorkbookChild | ReadOnlyWorksheet , value : str | float | datetime | None = None ) -> Cell : ...
0 commit comments