mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
artresizer: add some missing typings
This commit is contained in:
parent
996a116a62
commit
7acfe8932a
1 changed files with 9 additions and 5 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue