Skip to content

Commit

Permalink
Merge pull request #7633 from hugovk/type-imagemode
Browse files Browse the repository at this point in the history
Add type hints for ImageMode
  • Loading branch information
radarhere authored Dec 23, 2023
2 parents e9453a7 + 17af8ec commit 41e45b5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/PIL/ImageMode.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,25 @@
class ModeDescriptor:
"""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.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:
Expand Down

0 comments on commit 41e45b5

Please sign in to comment.