Openpyxl fixes for worksheet and image. (#12363)

This commit is contained in:
Noam
2024-07-18 17:41:45 +03:00
committed by GitHub
parent 6b919d76e2
commit cc7c950381
2 changed files with 5 additions and 3 deletions

View File

@@ -4,6 +4,8 @@ from types import ModuleType
from typing import Any, Literal
from typing_extensions import TypeAlias
from openpyxl.drawing.spreadsheet_drawing import _AnchorBase
# Is actually PIL.Image.Image
_PILImageImage: TypeAlias = Any
# same as first parameter of PIL.Image.open
@@ -12,7 +14,7 @@ _PILImageFilePath: TypeAlias = str | bytes | Path | SupportsRead[bytes]
PILImage: ModuleType | Literal[False]
class Image:
anchor: str
anchor: str | _AnchorBase
ref: _PILImageImage | _PILImageFilePath
width: int
height: int

View File

@@ -86,7 +86,7 @@ class Worksheet(_WorkbookChild):
def freeze_panes(self) -> str | None: ...
@freeze_panes.setter
def freeze_panes(self, topLeftCell: str | Cell | None = ...) -> None: ...
def cell(self, row: int, column: int, value: str | None = None) -> Cell: ...
def cell(self, row: int, column: int, value: _CellValue | None = None) -> Cell: ...
# An int is necessarily a row selection
@overload
def __getitem__(self, key: int) -> tuple[Cell, ...]: ...
@@ -96,7 +96,7 @@ class Worksheet(_WorkbookChild):
# A str could be an individual cell, row, column or full range
@overload
def __getitem__(self, key: str) -> Any: ... # AnyOf[Cell, tuple[Cell, ...], tuple[tuple[Cell, ...], ...]]
def __setitem__(self, key: str, value: str) -> None: ...
def __setitem__(self, key: str, value: _CellValue) -> None: ...
def __iter__(self) -> Iterator[tuple[Cell, ...]]: ...
def __delitem__(self, key: str) -> None: ...
@property