mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 17:54:32 +03:00
Merge pull request #7633 from hugovk/type-imagemode
Add type hints for ImageMode
This commit is contained in:
commit
41e45b5f95
|
@ -23,18 +23,25 @@ _modes = None
|
||||||
class ModeDescriptor:
|
class ModeDescriptor:
|
||||||
"""Wrapper for mode strings."""
|
"""Wrapper for mode strings."""
|
||||||
|
|
||||||
def __init__(self, mode, bands, basemode, basetype, typestr):
|
def __init__(
|
||||||
|
self,
|
||||||
|
mode: str,
|
||||||
|
bands: tuple[str, ...],
|
||||||
|
basemode: str,
|
||||||
|
basetype: str,
|
||||||
|
typestr: str,
|
||||||
|
) -> None:
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.bands = bands
|
self.bands = bands
|
||||||
self.basemode = basemode
|
self.basemode = basemode
|
||||||
self.basetype = basetype
|
self.basetype = basetype
|
||||||
self.typestr = typestr
|
self.typestr = typestr
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self) -> str:
|
||||||
return self.mode
|
return self.mode
|
||||||
|
|
||||||
|
|
||||||
def getmode(mode):
|
def getmode(mode: str) -> ModeDescriptor:
|
||||||
"""Gets a mode descriptor for the given mode."""
|
"""Gets a mode descriptor for the given mode."""
|
||||||
global _modes
|
global _modes
|
||||||
if not _modes:
|
if not _modes:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user