Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove import of unicode_literals #1887

Merged
merged 85 commits into from
Mar 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
49b8534
Started remove import of unicode_literals
pkess Feb 17, 2016
f300667
Enabled travis on all branches
pkess Feb 17, 2016
4f0352f
Removed unicode_literals from module autotag
pkess Feb 19, 2016
32d26d8
Removed unicode_literals form module dbcore
pkess Feb 19, 2016
26c3cca
Removed unicode_literales from importer
pkess Feb 19, 2016
4b7b961
fixed broken test
pkess Feb 19, 2016
43572f5
Removed unicode_literals from library, logging and mediafile
pkess Feb 19, 2016
9918cbb
Removed unicode_literals from plugins and vfs
pkess Feb 19, 2016
2048a4f
Removed unicode_literals from ui
pkess Feb 19, 2016
95e940b
Removed unicode_literals from module util
pkess Feb 20, 2016
6852ab5
Removed unicode_literals from plugins
pkess Feb 20, 2016
5db57bd
Removed unicode_literals from plugin bpd
pkess Feb 20, 2016
40900aa
Removed unicode_literals from plugins
pkess Feb 20, 2016
5547a82
Removed unicode_literals from plugin duplicates
pkess Feb 20, 2016
53d2c8d
Removed unicode_literals from plugins
pkess Feb 20, 2016
7d00ab3
Removed unicode_literals from plugins
pkess Feb 20, 2016
fc3d10d
Removed unicode_literals from plugins
pkess Feb 20, 2016
f2fc1a7
Removed import of unicode_literals from plugins
pkess Feb 20, 2016
48098c3
Removed import of unicode_literals from plugins
pkess Feb 20, 2016
feab3df
Removed import of unicode_literals from plugins
pkess Feb 20, 2016
456565b
Removed import of unicode_literals from plugins
pkess Feb 20, 2016
30cf407
Removed import of unicode_literals from plugins
pkess Feb 20, 2016
7155999
Removed import of unicode_literals from plugins
pkess Feb 20, 2016
c2e7d59
Removed import of unicode_literals from plugin web
pkess Feb 20, 2016
a5ce7a2
Removed import of unicode_literals from testsuite
pkess Feb 20, 2016
302ca94
Removed import of unicode_literals
pkess Feb 20, 2016
68dbbba
Removed import of unicode_literals from tests
pkess Feb 20, 2016
908f684
Removed import of unicode_literals from test_bucket
pkess Feb 22, 2016
a94bfa9
Removed import of unicode_literals from test_mb
pkess Feb 22, 2016
9507bfb
Removed unicode_literals from test_lyrics
pkess Feb 22, 2016
1162082
Removed unicode_literals from test_info
pkess Feb 22, 2016
3b83209
Removed unicode_literals from test_config_command
pkess Feb 22, 2016
14fc530
Removed unicode_literals from test_convert
pkess Feb 22, 2016
ad32107
Fixed test in test_lyrics
pkess Feb 22, 2016
5fda42c
Removed unicode_literals from test_datequery
pkess Feb 22, 2016
bdaafdb
Removed unicode_literals from test_dbcore
pkess Feb 22, 2016
59f670a
Removed unicode_literals form test_echonest
pkess Feb 22, 2016
b4d7ad1
Removed unicode_literals from test_edit
pkess Feb 22, 2016
4d1a02a
Removed unicode_literals from test_embedart
pkess Feb 22, 2016
fc521ef
Removed unicode_literals from test_embyupdate
pkess Feb 22, 2016
690498e
Removed unicode_literals from test_fetchart
pkess Feb 22, 2016
0fececd
Removed unicode_literals from test_files
pkess Feb 22, 2016
e1356be
Removed unicode_literals from test_ftintitle
pkess Feb 22, 2016
99f6457
Removed unicode_literals from test_ihate
pkess Feb 22, 2016
c39a8ce
Removed unicode_literals from test_importadded
pkess Feb 22, 2016
df0d51e
Removed unicode_literals from test_keyfinder
pkess Feb 22, 2016
d3d02e1
Removed unicode_literals from test_lastgenere
pkess Feb 22, 2016
5abe1fd
Removed unicode_literals from test_web
pkess Feb 23, 2016
a627fd4
Removed unicode_literals from test_the
pkess Feb 23, 2016
7135fac
Removed unicode_literals from test_importfeeds
pkess Feb 23, 2016
955eae4
Removed unicode_literals from test_logging
pkess Feb 23, 2016
cc50f41
Removed unicode_literals from test_mbsubmit
pkess Feb 23, 2016
2ac27e7
Removed unicode_literals from test_mbsync
pkess Feb 23, 2016
00a8ffe
Removed unicode_literals from test_mediafile
pkess Feb 23, 2016
6b6600d
Removed unicode_literals from test_zero
pkess Feb 23, 2016
fe1e8b5
Removed unicode_literals from test_mediafile_edge
pkess Feb 24, 2016
495de65
Removed unicode_literals from test_mpdstats
pkess Feb 24, 2016
9fffd26
Removed unicode_literals from test_permissions
pkess Feb 24, 2016
945c4e2
Removed unicode_literals form test_pipeline
pkess Feb 24, 2016
a77d320
Removed unicode_literals from test_player
pkess Feb 24, 2016
04e6377
Removed unicode_literals from test_plexupdate
pkess Feb 24, 2016
be8feed
Removed unicode_literals from test_plugins
pkess Feb 24, 2016
a313817
Removed unicode_literals from test_spotify
pkess Feb 24, 2016
f33d922
Removed unicode_literals from test_query
pkess Feb 24, 2016
e1890f8
Removed unicode_literals from test_types_plugin
pkess Feb 25, 2016
867dafe
Removed unicode_literals form test_sort
pkess Feb 25, 2016
27c6c3d
Removed unicode_literals from test_replaygain
pkess Feb 25, 2016
47e5d15
Removed unicode_literals from test_smartplaylist
pkess Feb 25, 2016
b4e7f7c
Removed unicode_literals from test_template
pkess Feb 25, 2016
6ec70d6
Removed unicode_literals from test_ui_importer
pkess Feb 25, 2016
ccc61a6
Removed unicode_literals from test_util
pkess Feb 25, 2016
ad07365
Removed unicode_literals from test_thumbnails
pkess Feb 28, 2016
92a9c6f
Removed unicode_literals from test_library
pkess Feb 28, 2016
3b4bf17
Removed unicode_literals from test_vfs
pkess Feb 28, 2016
07a2259
Removed unicode_literals from test_play
pkess Feb 28, 2016
df7241e
Removed unicode_literals from test_importer
pkess Feb 28, 2016
b6e0696
Removed unicode_literals from test_ui
pkess Feb 28, 2016
a07b98a
Fix leftover literals
untitaker Feb 28, 2016
c16201a
Keep raw literals for regular expressions
sampsyo Feb 28, 2016
7c30f56
Another regex literal
sampsyo Feb 28, 2016
ad1bab6
Fiddle with whitespace
sampsyo Feb 28, 2016
1478ba7
__repr__ and __str__ return "native" strings
sampsyo Feb 28, 2016
d53019f
Further whitespace fiddling
sampsyo Feb 28, 2016
e54c7ee
Standardize __future__ imports without parentheses
sampsyo Feb 28, 2016
eac7d64
Merge branch 'master' into no_unicode_literals
sampsyo Feb 28, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
language: python
sudo: false

branches:
only:
- master

matrix:
include:
- python: 2.7
Expand Down
6 changes: 3 additions & 3 deletions beets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.

from __future__ import absolute_import, unicode_literals
from __future__ import division, absolute_import, print_function

import os

import beets.library
from beets.util import confit

__version__ = '1.3.18'
__author__ = 'Adrian Sampson <adrian@radbox.org>'
__version__ = u'1.3.18'
__author__ = u'Adrian Sampson <adrian@radbox.org>'

Library = beets.library.Library

Expand Down
3 changes: 1 addition & 2 deletions beets/autotag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"""Facilities for automatically determining files' correct metadata.
"""

from __future__ import (division, absolute_import, print_function,
unicode_literals)
from __future__ import division, absolute_import, print_function

from beets import logging
from beets import config
Expand Down
19 changes: 9 additions & 10 deletions beets/autotag/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
# included in all copies or substantial portions of the Software.

"""Glue between metadata sources and the matching logic."""
from __future__ import (division, absolute_import, print_function,
unicode_literals)
from __future__ import division, absolute_import, print_function

from collections import namedtuple
import re
Expand Down Expand Up @@ -394,7 +393,7 @@ def update(self, dist):
"""
if not isinstance(dist, Distance):
raise ValueError(
'`dist` must be a Distance object, not {0}'.format(type(dist))
u'`dist` must be a Distance object, not {0}'.format(type(dist))
)
for key, penalties in dist._penalties.iteritems():
self._penalties.setdefault(key, []).extend(penalties)
Expand All @@ -418,7 +417,7 @@ def add(self, key, dist):
"""
if not 0.0 <= dist <= 1.0:
raise ValueError(
'`dist` must be between 0.0 and 1.0, not {0}'.format(dist)
u'`dist` must be between 0.0 and 1.0, not {0}'.format(dist)
)
self._penalties.setdefault(key, []).append(dist)

Expand Down Expand Up @@ -514,7 +513,7 @@ def album_for_mbid(release_id):
try:
album = mb.album_for_id(release_id)
if album:
plugins.send('albuminfo_received', info=album)
plugins.send(u'albuminfo_received', info=album)
return album
except mb.MusicBrainzAPIError as exc:
exc.log(log)
Expand All @@ -527,7 +526,7 @@ def track_for_mbid(recording_id):
try:
track = mb.track_for_id(recording_id)
if track:
plugins.send('trackinfo_received', info=track)
plugins.send(u'trackinfo_received', info=track)
return track
except mb.MusicBrainzAPIError as exc:
exc.log(log)
Expand All @@ -538,7 +537,7 @@ def albums_for_id(album_id):
candidates = [album_for_mbid(album_id)]
plugin_albums = plugins.album_for_id(album_id)
for a in plugin_albums:
plugins.send('albuminfo_received', info=a)
plugins.send(u'albuminfo_received', info=a)
candidates.extend(plugin_albums)
return filter(None, candidates)

Expand All @@ -548,7 +547,7 @@ def tracks_for_id(track_id):
candidates = [track_for_mbid(track_id)]
plugin_tracks = plugins.track_for_id(track_id)
for t in plugin_tracks:
plugins.send('trackinfo_received', info=t)
plugins.send(u'trackinfo_received', info=t)
candidates.extend(plugin_tracks)
return filter(None, candidates)

Expand Down Expand Up @@ -581,7 +580,7 @@ def album_candidates(items, artist, album, va_likely):

# Notify subscribed plugins about fetched album info
for a in out:
plugins.send('albuminfo_received', info=a)
plugins.send(u'albuminfo_received', info=a)

return out

Expand All @@ -605,6 +604,6 @@ def item_candidates(item, artist, title):

# Notify subscribed plugins about fetched track info
for i in out:
plugins.send('trackinfo_received', info=i)
plugins.send(u'trackinfo_received', info=i)

return out
5 changes: 2 additions & 3 deletions beets/autotag/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
releases and tracks.
"""

from __future__ import (division, absolute_import, print_function,
unicode_literals)
from __future__ import division, absolute_import, print_function

import datetime
import re
Expand Down Expand Up @@ -337,7 +336,7 @@ def _add_candidate(items, results, info):

# Discard albums with zero tracks.
if not info.tracks:
log.debug('No tracks.')
log.debug(u'No tracks.')
return

# Don't duplicate.
Expand Down
15 changes: 7 additions & 8 deletions beets/autotag/mb.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

"""Searches for albums in the MusicBrainz database.
"""
from __future__ import (division, absolute_import, print_function,
unicode_literals)
from __future__ import division, absolute_import, print_function

import musicbrainzngs
import re
Expand All @@ -43,7 +42,7 @@ class MusicBrainzAPIError(util.HumanReadableException):
def __init__(self, reason, verb, query, tb=None):
self.query = query
if isinstance(reason, musicbrainzngs.WebServiceError):
reason = 'MusicBrainz not reachable'
reason = u'MusicBrainz not reachable'
super(MusicBrainzAPIError, self).__init__(reason, verb, tb)

def get_message(self):
Expand Down Expand Up @@ -162,7 +161,7 @@ def track_info(recording, index=None, medium=None, medium_index=None,
medium=medium,
medium_index=medium_index,
medium_total=medium_total,
data_source='MusicBrainz',
data_source=u'MusicBrainz',
data_url=track_url(recording['id']),
)

Expand Down Expand Up @@ -256,7 +255,7 @@ def album_info(release):
mediums=len(release['medium-list']),
artist_sort=artist_sort_name,
artist_credit=artist_credit_name,
data_source='MusicBrainz',
data_source=u'MusicBrainz',
data_url=album_url(release['id']),
)
info.va = info.artist_id == VARIOUS_ARTISTS_ID
Expand Down Expand Up @@ -377,7 +376,7 @@ def _parse_id(s):
no ID can be found, return None.
"""
# Find the first thing that looks like a UUID/MBID.
match = re.search('[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12}', s)
match = re.search(ur'[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12}', s)
if match:
return match.group()

Expand All @@ -398,7 +397,7 @@ def album_for_id(releaseid):
log.debug(u'Album ID match failed.')
return None
except musicbrainzngs.MusicBrainzError as exc:
raise MusicBrainzAPIError(exc, 'get release by ID', albumid,
raise MusicBrainzAPIError(exc, u'get release by ID', albumid,
traceback.format_exc())
return album_info(res['release'])

Expand All @@ -417,6 +416,6 @@ def track_for_id(releaseid):
log.debug(u'Track ID match failed.')
return None
except musicbrainzngs.MusicBrainzError as exc:
raise MusicBrainzAPIError(exc, 'get recording by ID', trackid,
raise MusicBrainzAPIError(exc, u'get recording by ID', trackid,
traceback.format_exc())
return track_info(res['recording'])
2 changes: 1 addition & 1 deletion beets/dbcore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"""DBCore is an abstract database package that forms the basis for beets'
Library.
"""
from __future__ import absolute_import
from __future__ import division, absolute_import, print_function

from .db import Model, Database
from .query import Query, FieldQuery, MatchQuery, AndQuery, OrQuery
Expand Down
25 changes: 13 additions & 12 deletions beets/dbcore/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

"""The central Model and Database constructs for DBCore.
"""
from __future__ import (division, absolute_import, print_function,
unicode_literals)
from __future__ import division, absolute_import, print_function

import time
import os
Expand Down Expand Up @@ -201,9 +200,11 @@ def _check_db(self, need_id=True):
exception is raised otherwise.
"""
if not self._db:
raise ValueError('{0} has no database'.format(type(self).__name__))
raise ValueError(
u'{0} has no database'.format(type(self).__name__)
)
if need_id and not self.id:
raise ValueError('{0} has no id'.format(type(self).__name__))
raise ValueError(u'{0} has no id'.format(type(self).__name__))

# Essential field accessors.

Expand Down Expand Up @@ -255,11 +256,11 @@ def __delitem__(self, key):
del self._values_flex[key]
self._dirty.add(key) # Mark for dropping on store.
elif key in self._getters(): # Computed.
raise KeyError('computed field {0} cannot be deleted'.format(key))
raise KeyError(u'computed field {0} cannot be deleted'.format(key))
elif key in self._fields: # Fixed.
raise KeyError('fixed field {0} cannot be deleted'.format(key))
raise KeyError(u'fixed field {0} cannot be deleted'.format(key))
else:
raise KeyError('no such field {0}'.format(key))
raise KeyError(u'no such field {0}'.format(key))

def keys(self, computed=False):
"""Get a list of available field names for this object. The
Expand Down Expand Up @@ -318,12 +319,12 @@ def __iter__(self):

def __getattr__(self, key):
if key.startswith('_'):
raise AttributeError('model has no attribute {0!r}'.format(key))
raise AttributeError(u'model has no attribute {0!r}'.format(key))
else:
try:
return self[key]
except KeyError:
raise AttributeError('no such field {0!r}'.format(key))
raise AttributeError(u'no such field {0!r}'.format(key))

def __setattr__(self, key, value):
if key.startswith('_'):
Expand Down Expand Up @@ -390,7 +391,7 @@ def load(self):
"""
self._check_db()
stored_obj = self._db._get(type(self), self.id)
assert stored_obj is not None, "object {0} not in DB".format(self.id)
assert stored_obj is not None, u"object {0} not in DB".format(self.id)
self._values_fixed = {}
self._values_flex = {}
self.update(dict(stored_obj))
Expand Down Expand Up @@ -463,7 +464,7 @@ def _parse(cls, key, string):
"""Parse a string as a value for the given key.
"""
if not isinstance(string, basestring):
raise TypeError("_parse() argument must be a string")
raise TypeError(u"_parse() argument must be a string")

return cls._type(key).parse(string)

Expand Down Expand Up @@ -611,7 +612,7 @@ def __getitem__(self, n):
it.next()
return it.next()
except StopIteration:
raise IndexError('result index {0} out of range'.format(n))
raise IndexError(u'result index {0} out of range'.format(n))

def get(self):
"""Return the first matching object, or None if no objects
Expand Down
Loading