From 7acfe8932a9dc6af34979a06722af395a9b183bf Mon Sep 17 00:00:00 2001 From: Serene-Arc Date: Sun, 22 Jan 2023 12:12:44 +1000 Subject: [PATCH] artresizer: add some missing typings --- beets/util/artresizer.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/beets/util/artresizer.py b/beets/util/artresizer.py index 18a5ef82d..24c8e5e68 100644 --- a/beets/util/artresizer.py +++ b/beets/util/artresizer.py @@ -58,7 +58,7 @@ _NOT_AVAILABLE = object() class LocalBackend: @classmethod - def available(cls): + def available(cls) -> bool: try: cls.version() return True @@ -76,7 +76,7 @@ class IMBackend(LocalBackend): _legacy = None @classmethod - def version(cls): + def version(cls) -> Optional[Union[object, Tuple[int, int, int]]]: """Obtain and cache ImageMagick version. Raises `LocalBackendNotAvailableError` if not available. @@ -206,7 +206,11 @@ class IMBackend(LocalBackend): log.warning("Could not understand IM output: {0!r}", out) return None - def deinterlace(self, path_in: AnyStr, path_out: Optional[AnyStr] = None) -> AnyStr: + def deinterlace( + self, + path_in: AnyStr, + path_out: Optional[AnyStr] = None, + ) -> AnyStr: if not path_out: path_out = get_temp_filename(__name__, "deinterlace_IM_", path_in) @@ -603,7 +607,7 @@ class ArtResizer(metaclass=Shareable): path_out: Optional[AnyStr]=None, quality: int = 0, max_filesize: int = 0, - ): + ) -> AnyStr: """Manipulate an image file according to the method, returning a new path. For PIL or IMAGEMAGIC methods, resizes the image to a temporary file and encodes with the specified quality level. @@ -636,7 +640,7 @@ class ArtResizer(metaclass=Shareable): # FIXME: Should probably issue a warning? return path_in - def proxy_url(self, maxwidth: int, url: str, quality: int = 0): + def proxy_url(self, maxwidth: int, url: str, quality: int = 0) -> str: """Modifies an image URL according the method, returning a new URL. For WEBPROXY, a URL on the proxy server is returned. Otherwise, the URL is returned unmodified.