From 5cdb0c5c5cc9eb23be1d1a7a540b808b0a11ad16 Mon Sep 17 00:00:00 2001 From: wisp3rwind <17089248+wisp3rwind@users.noreply.github.com> Date: Tue, 14 Jun 2022 22:17:41 +0200 Subject: [PATCH] drop old Python: rm python 2 leftovers in library.FileOperationError.__str__ --- beets/library.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/beets/library.py b/beets/library.py index 981563974..030cf630e 100644 --- a/beets/library.py +++ b/beets/library.py @@ -300,34 +300,26 @@ class FileOperationError(Exception): self.path = path self.reason = reason - def text(self): + def __str__(self): """Get a string representing the error. - Describe both the underlying reason and the file path - in question. + Describe both the underlying reason and the file path in question. """ - return '{}: {}'.format( - util.displayable_path(self.path), - str(self.reason) - ) - - # define __str__ as text to avoid infinite loop on super() calls - # with @six.python_2_unicode_compatible - __str__ = text + return f"{util.displayable_path(self.path)}: {self.reason}" class ReadError(FileOperationError): """An error while reading a file (i.e. in `Item.read`).""" def __str__(self): - return 'error reading ' + super().text() + return 'error reading ' + str(super()) class WriteError(FileOperationError): """An error while writing a file (i.e. in `Item.write`).""" def __str__(self): - return 'error writing ' + super().text() + return 'error writing ' + str(super()) # Item and Album model classes.