mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Add type hints for ImageMode
This commit is contained in:
parent
e9453a7b88
commit
76809f09ef
|
@ -23,18 +23,25 @@ _modes = None
|
|||
class ModeDescriptor:
|
||||
"""Wrapper for mode strings."""
|
||||
|
||||
def __init__(self, mode, bands, basemode, basetype, typestr):
|
||||
def __init__(
|
||||
self,
|
||||
mode: str,
|
||||
bands: str | tuple[str, ...],
|
||||
basemode: str,
|
||||
basetype: str | tuple[str, ...],
|
||||
typestr: str,
|
||||
) -> None:
|
||||
self.mode = mode
|
||||
self.bands = bands
|
||||
self.basemode = basemode
|
||||
self.basetype = basetype
|
||||
self.typestr = typestr
|
||||
|
||||
def __str__(self):
|
||||
def __str__(self) -> str:
|
||||
return self.mode
|
||||
|
||||
|
||||
def getmode(mode):
|
||||
def getmode(mode: str) -> ModeDescriptor:
|
||||
"""Gets a mode descriptor for the given mode."""
|
||||
global _modes
|
||||
if not _modes:
|
||||
|
|
Loading…
Reference in New Issue
Block a user