mirror of
https://github.com/beetbox/beets.git
synced 2026-02-20 06:14:22 +01:00
drop old Python: rm python 2 leftovers in library.FileOperationError.__str__
This commit is contained in:
parent
632698680f
commit
5cdb0c5c5c
1 changed files with 5 additions and 13 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue