diff --git a/stubs/openpyxl/openpyxl/__init__.pyi b/stubs/openpyxl/openpyxl/__init__.pyi index 0c1f04c63..de5224812 100644 --- a/stubs/openpyxl/openpyxl/__init__.pyi +++ b/stubs/openpyxl/openpyxl/__init__.pyi @@ -1,4 +1,4 @@ -from _typeshed import StrPath, SupportsRead +from _typeshed import StrPath, SupportsRead, SupportsWrite from typing import IO, Literal, Protocol from typing_extensions import TypeAlias @@ -25,6 +25,7 @@ _VisibilityType: TypeAlias = Literal["visible", "hidden", "veryHidden"] # noqa: # TODO: Use a proper protocol from ZipFile. See: #10880 # This alias is to minimize false-positives _ZipFileFileProtocol: TypeAlias = StrPath | IO[bytes] | SupportsRead[bytes] # noqa: Y047 +_ZipFileFileWriteProtocol: TypeAlias = StrPath | IO[bytes] | SupportsWrite[bytes] # noqa: Y047 class _Decodable(Protocol): # noqa: Y046 def decode(self, encoding: str, /) -> str: ... diff --git a/stubs/openpyxl/openpyxl/workbook/workbook.pyi b/stubs/openpyxl/openpyxl/workbook/workbook.pyi index 9756e5f7a..f93f63479 100644 --- a/stubs/openpyxl/openpyxl/workbook/workbook.pyi +++ b/stubs/openpyxl/openpyxl/workbook/workbook.pyi @@ -5,7 +5,7 @@ from typing import Any, Final, type_check_only from typing_extensions import TypeAlias, deprecated from zipfile import ZipFile -from openpyxl import _Decodable, _ZipFileFileProtocol +from openpyxl import _Decodable, _ZipFileFileWriteProtocol from openpyxl.chartsheet.chartsheet import Chartsheet from openpyxl.styles.named_styles import NamedStyle from openpyxl.utils.indexed_list import IndexedList @@ -112,7 +112,7 @@ class Workbook: def named_styles(self) -> list[str]: ... @property def mime_type(self) -> str: ... - def save(self, filename: _ZipFileFileProtocol) -> None: ... + def save(self, filename: _ZipFileFileWriteProtocol) -> None: ... @property def style_names(self) -> list[str]: ... # A write_only and read_only workbooks can't use this method as it requires both reading and writing.