From 43572f50b0eb3522239d94149d91223e67d9a009 Mon Sep 17 00:00:00 2001
From: Peter Kessen
Date: Fri, 19 Feb 2016 22:29:31 +0100
Subject: [PATCH] Removed unicode_literals from library, logging and mediafile
---
beets/library.py | 20 ++++++++++----------
beets/logging.py | 3 +--
beets/mediafile.py | 15 +++++++--------
3 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/beets/library.py b/beets/library.py
index 1c2fac944..901c3c1b0 100644
--- a/beets/library.py
+++ b/beets/library.py
@@ -15,8 +15,7 @@
"""The core data store and collection logic for beets.
"""
-from __future__ import (division, absolute_import, print_function,
- unicode_literals)
+from __future__ import (division, absolute_import, print_function)
import os
import sys
@@ -627,7 +626,7 @@ class Item(LibModel):
self.write(path, tags)
return True
except FileOperationError as exc:
- log.error("{0}", exc)
+ log.error(u"{0}", exc)
return False
def try_sync(self, write, move, with_album=True):
@@ -647,7 +646,7 @@ class Item(LibModel):
if move:
# Check whether this file is inside the library directory.
if self._db and self._db.directory in util.ancestry(self.path):
- log.debug('moving {0} to synchronize path',
+ log.debug(u'moving {0} to synchronize path',
util.displayable_path(self.path))
self.move(with_album=with_album)
self.store()
@@ -796,7 +795,7 @@ class Item(LibModel):
if query == PF_KEY_DEFAULT:
break
else:
- assert False, "no default path format"
+ assert False, u"no default path format"
if isinstance(path_format, Template):
subpath_tmpl = path_format
else:
@@ -826,9 +825,10 @@ class Item(LibModel):
if fellback:
# Print an error message if legalization fell back to
# default replacements because of the maximum length.
- log.warning('Fell back to default replacements when naming '
- 'file {}. Configure replacements to avoid lengthening '
- 'the filename.', subpath)
+ log.warning(
+ u'Fell back to default replacements when naming '
+ u'file {}. Configure replacements to avoid lengthening '
+ u'the filename.', subpath)
if fragment:
return subpath
@@ -1016,7 +1016,7 @@ class Album(LibModel):
"""
item = self.items().get()
if not item:
- raise ValueError('empty album')
+ raise ValueError(u'empty album')
return os.path.dirname(item.path)
def _albumtotal(self):
@@ -1170,7 +1170,7 @@ def parse_query_string(s, model_cls):
The string is split into components using shell-like syntax.
"""
- assert isinstance(s, unicode), "Query is not unicode: {0!r}".format(s)
+ assert isinstance(s, unicode), u"Query is not unicode: {0!r}".format(s)
try:
parts = util.shlex_split(s)
except ValueError as exc:
diff --git a/beets/logging.py b/beets/logging.py
index 40748bc68..fc49cace7 100644
--- a/beets/logging.py
+++ b/beets/logging.py
@@ -21,8 +21,7 @@ that when getLogger(name) instantiates a logger that logger uses
{}-style formatting.
"""
-from __future__ import (division, absolute_import, print_function,
- unicode_literals)
+from __future__ import (division, absolute_import, print_function)
from copy import copy
from logging import * # noqa
diff --git a/beets/mediafile.py b/beets/mediafile.py
index 5010f8797..79223e70f 100644
--- a/beets/mediafile.py
+++ b/beets/mediafile.py
@@ -33,8 +33,7 @@ Internally ``MediaFile`` uses ``MediaField`` descriptors to access the
data from the tags. In turn ``MediaField`` uses a number of
``StorageStyle`` strategies to handle format specific logic.
"""
-from __future__ import (division, absolute_import, print_function,
- unicode_literals)
+from __future__ import (division, absolute_import, print_function)
import mutagen
import mutagen.mp3
@@ -645,13 +644,13 @@ class MP4BoolStorageStyle(MP4StorageStyle):
return None
def get_list(self, mutagen_file):
- raise NotImplementedError('MP4 bool storage does not support lists')
+ raise NotImplementedError(u'MP4 bool storage does not support lists')
def set(self, mutagen_file, value):
mutagen_file[self.key] = value
def set_list(self, mutagen_file, values):
- raise NotImplementedError('MP4 bool storage does not support lists')
+ raise NotImplementedError(u'MP4 bool storage does not support lists')
class MP4ImageStorageStyle(MP4ListStorageStyle):
@@ -669,7 +668,7 @@ class MP4ImageStorageStyle(MP4ListStorageStyle):
elif image.mime_type == 'image/jpeg':
kind = mutagen.mp4.MP4Cover.FORMAT_JPEG
else:
- raise ValueError('MP4 files only supports PNG and JPEG images')
+ raise ValueError(u'MP4 files only supports PNG and JPEG images')
return mutagen.mp4.MP4Cover(image.data, kind)
@@ -1359,11 +1358,11 @@ class MediaFile(object):
# anywhere else.
raise
else:
- log.debug('{}', traceback.format_exc())
+ log.debug(u'{}', traceback.format_exc())
raise MutagenError(path, exc)
except Exception as exc:
# Isolate bugs in Mutagen.
- log.debug('{}', traceback.format_exc())
+ log.debug(u'{}', traceback.format_exc())
log.error(u'uncaught Mutagen exception in open: {0}', exc)
raise MutagenError(path, exc)
@@ -1436,7 +1435,7 @@ class MediaFile(object):
# Propagate these through: they don't represent Mutagen bugs.
raise
except Exception as exc:
- log.debug('{}', traceback.format_exc())
+ log.debug(u'{}', traceback.format_exc())
log.error(u'uncaught Mutagen exception in save: {0}', exc)
raise MutagenError(self.path, exc)