mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-13 05:31:43 +08:00
Support Writeable Zipfile on workbook.save (#13009)
This commit is contained in:
@@ -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: ...
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user