mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
add type hints for Image.save
This commit is contained in:
parent
8c14a394c1
commit
819e1b9dd2
|
@ -2374,7 +2374,9 @@ class Image:
|
|||
(w, h), Transform.AFFINE, matrix, resample, fillcolor=fillcolor
|
||||
)
|
||||
|
||||
def save(self, fp, format=None, **params) -> None:
|
||||
def save(
|
||||
self, fp: StrOrBytesPath | IO[bytes], format: str | None = None, **params: Any
|
||||
) -> None:
|
||||
"""
|
||||
Saves this image under the given filename. If no format is
|
||||
specified, the format to use is determined from the filename
|
||||
|
@ -2455,6 +2457,8 @@ class Image:
|
|||
fp = builtins.open(filename, "r+b")
|
||||
else:
|
||||
fp = builtins.open(filename, "w+b")
|
||||
else:
|
||||
fp = cast(IO[bytes], fp)
|
||||
|
||||
try:
|
||||
save_handler(self, fp, filename)
|
||||
|
|
Loading…
Reference in New Issue
Block a user