From fcee48fb0a11003afab1f4eb7334dca1e4842606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Mon, 6 Jul 2026 04:37:36 +0100 Subject: [PATCH] typing: type beets.library.exceptions --- beets/library/exceptions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/beets/library/exceptions.py b/beets/library/exceptions.py index 39725a4e4..df095aeb8 100644 --- a/beets/library/exceptions.py +++ b/beets/library/exceptions.py @@ -8,7 +8,7 @@ class FileOperationError(Exception): error, and an unhandled Mutagen exception. """ - def __init__(self, path, reason): + def __init__(self, path: bytes, reason: Exception) -> None: """Create an exception describing an operation on the file at `path` with the underlying (chained) exception `reason`. """ @@ -16,7 +16,7 @@ class FileOperationError(Exception): self.path = path self.reason = reason - def __str__(self): + def __str__(self) -> str: """Get a string representing the error. Describe both the underlying reason and the file path in question. @@ -27,7 +27,7 @@ class FileOperationError(Exception): class ReadError(FileOperationError): """An error while reading a file (i.e. in `Item.read`).""" - def __str__(self): + def __str__(self) -> str: # Formatting super() directly stringifies the proxy object, so call # __str__ explicitly to forward to FileOperationError.__str__. return f"error reading {super().__str__()}" @@ -36,7 +36,7 @@ class ReadError(FileOperationError): class WriteError(FileOperationError): """An error while writing a file (i.e. in `Item.write`).""" - def __str__(self): + def __str__(self) -> str: # Formatting super() directly stringifies the proxy object, so call # __str__ explicitly to forward to FileOperationError.__str__. return f"error writing {super().__str__()}"