Use __future__ imports but unicode_literals everywhere

Include import of __future__ features division, absolute_imports and
print_function everywhere. Don't add unicode_literals yet for it is
harder to convert.

Goal is smoothing the transition to python 3.
This commit is contained in:
Bruno Cauet 2015-01-19 12:16:05 +01:00
parent 2902cda036
commit 90b388b775
119 changed files with 239 additions and 18 deletions

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
__version__ = '1.3.11'
__author__ = 'Adrian Sampson <adrian@radbox.org>'

View file

@ -15,6 +15,8 @@
"""Facilities for automatically determining files' correct metadata.
"""
from __future__ import division, absolute_import, print_function
from beets import logging
from beets import config

View file

@ -13,6 +13,8 @@
# 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
from collections import namedtuple
import re

View file

@ -15,7 +15,8 @@
"""Matches existing metadata with canonical information to identify
releases and tracks.
"""
from __future__ import division
from __future__ import division, absolute_import, print_function
import datetime
import re

View file

@ -14,6 +14,8 @@
"""Searches for albums in the MusicBrainz database.
"""
from __future__ import division, absolute_import, print_function
import musicbrainzngs
import re
import traceback

View file

@ -15,6 +15,8 @@
"""DBCore is an abstract database package that forms the basis for beets'
Library.
"""
from __future__ import division, absolute_import, print_function
from .db import Model, Database
from .query import Query, FieldQuery, MatchQuery, AndQuery, OrQuery
from .types import Type

View file

@ -14,6 +14,8 @@
"""The central Model and Database constructs for DBCore.
"""
from __future__ import division, absolute_import, print_function
import time
import os
from collections import defaultdict

View file

@ -14,6 +14,8 @@
"""The Query type hierarchy for DBCore.
"""
from __future__ import division, absolute_import, print_function
import re
from operator import attrgetter
from beets import util

View file

@ -14,6 +14,8 @@
"""Parsing of strings into DBCore queries.
"""
from __future__ import division, absolute_import, print_function
import re
import itertools
from . import query

View file

@ -14,6 +14,8 @@
"""Representation of type information for DBCore model fields.
"""
from __future__ import division, absolute_import, print_function
from . import query
from beets.util import str2bool

View file

@ -12,10 +12,11 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
"""Provides the basic, interface-agnostic workflow for importing and
autotagging music files.
"""
from __future__ import print_function
import os
import re

View file

@ -14,6 +14,8 @@
"""The core data store and collection logic for beets.
"""
from __future__ import division, absolute_import, print_function
import os
import sys
import shlex

View file

@ -20,7 +20,8 @@ that when getLogger(name) instantiates a logger that logger uses
{}-style formatting.
"""
from __future__ import absolute_import
from __future__ import division, absolute_import, print_function
from copy import copy
from logging import * # noqa
import sys

View file

@ -32,6 +32,8 @@ 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
import mutagen
import mutagen.mp3
import mutagen.oggopus

View file

@ -14,6 +14,8 @@
"""Support for beets plugins."""
from __future__ import division, absolute_import, print_function
import traceback
import inspect
import re

View file

@ -16,7 +16,8 @@
interface. To invoke the CLI, just call beets.ui.main(). The actual
CLI commands are implemented in the ui.commands module.
"""
from __future__ import print_function
from __future__ import division, absolute_import, print_function
import locale
import optparse

View file

@ -15,7 +15,8 @@
"""This module provides the default commands for beets' command-line
interface.
"""
from __future__ import print_function
from __future__ import division, absolute_import, print_function
import os
import platform

View file

@ -13,7 +13,8 @@
# included in all copies or substantial portions of the Software.
"""Miscellaneous utility functions."""
from __future__ import division
from __future__ import division, absolute_import, print_function
import os
import sys

View file

@ -15,6 +15,8 @@
"""Abstraction layer to resize images using PIL, ImageMagick, or a
public resizing proxy if neither is available.
"""
from __future__ import division, absolute_import, print_function
import urllib
import subprocess
import os

View file

@ -5,6 +5,8 @@ asyncore.
Bluelet: easy concurrency without all the messy parallelism.
"""
from __future__ import division, absolute_import, print_function
import socket
import select
import sys

View file

@ -14,7 +14,9 @@
"""Worry-free YAML configuration files.
"""
from __future__ import unicode_literals
from __future__ import (unicode_literals, absolute_import, print_function,
division)
import platform
import os
import pkgutil

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
from enum import Enum

View file

@ -25,7 +25,8 @@ library: unknown symbols are left intact.
This is sort of like a tiny, horrible degeneration of a real templating
engine like Jinja2 or Mustache.
"""
from __future__ import print_function
from __future__ import division, absolute_import, print_function
import re
import ast

View file

@ -30,7 +30,8 @@ up a bottleneck stage by dividing its work among multiple threads.
To do so, pass an iterable of coroutines to the Pipeline constructor
in place of any single coroutine.
"""
from __future__ import print_function
from __future__ import division, absolute_import, print_function
import Queue
from threading import Thread, Lock

View file

@ -15,6 +15,8 @@
"""A simple utility for constructing filesystem-like trees from beets
libraries.
"""
from __future__ import division, absolute_import, print_function
from collections import namedtuple
from beets import util

View file

@ -15,5 +15,7 @@
"""A namespace package for beets plugins."""
# Make this a namespace package.
from __future__ import division, absolute_import, print_function
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View file

@ -14,7 +14,8 @@
"""Some simple performance benchmarks for beets.
"""
from __future__ import print_function
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
from beets import ui

View file

@ -16,7 +16,8 @@
Beets library. Attempts to implement a compatible protocol to allow
use of the wide range of MPD clients.
"""
from __future__ import print_function
from __future__ import division, absolute_import, print_function
import re
from string import Template

View file

@ -15,7 +15,8 @@
"""A wrapper for the GStreamer Python bindings that exposes a simple
music player.
"""
from __future__ import print_function
from __future__ import division, absolute_import, print_function
import sys
import time

View file

@ -14,6 +14,8 @@
"""Determine BPM by pressing a key to the rhythm."""
from __future__ import division, absolute_import, print_function
import time
from beets import ui

View file

@ -15,6 +15,8 @@
"""Provides the %bucket{} function for path formatting.
"""
from __future__ import division, absolute_import, print_function
from datetime import datetime
import re
import string

View file

@ -15,6 +15,8 @@
"""Adds Chromaprint/Acoustid acoustic fingerprinting support to the
autotagger. Requires the pyacoustid library.
"""
from __future__ import division, absolute_import, print_function
from beets import plugins
from beets import ui
from beets import util

View file

@ -14,6 +14,8 @@
"""Converts tracks or albums to external directory
"""
from __future__ import division, absolute_import, print_function
import os
import threading
import subprocess

View file

@ -15,6 +15,8 @@
"""Adds Discogs album search support to the autotagger. Requires the
discogs-client library.
"""
from __future__ import division, absolute_import, print_function
import beets.ui
from beets import logging
from beets.autotag.hooks import AlbumInfo, TrackInfo, Distance

View file

@ -14,6 +14,8 @@
"""List duplicate tracks or albums.
"""
from __future__ import division, absolute_import, print_function
import shlex
from beets.plugins import BeetsPlugin

View file

@ -14,6 +14,8 @@
"""Fetch a variety of acoustic metrics from The Echo Nest.
"""
from __future__ import division, absolute_import, print_function
import time
import socket
import os

View file

@ -13,6 +13,8 @@
# included in all copies or substantial portions of the Software.
"""Allows beets to embed album art into file metadata."""
from __future__ import division, absolute_import, print_function
import os.path
import imghdr
import subprocess

View file

@ -14,6 +14,8 @@
"""Fetches album art.
"""
from __future__ import division, absolute_import, print_function
from contextlib import closing
import os
import re

View file

@ -15,6 +15,8 @@
"""Creates freedesktop.org-compliant .directory files on an album level.
"""
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
from beets.ui import Subcommand
from beets.ui import decargs

View file

@ -15,6 +15,8 @@
"""If the title is empty, try to extract track and title from the
filename.
"""
from __future__ import division, absolute_import, print_function
from beets import plugins
from beets.util import displayable_path
import os

View file

@ -14,6 +14,8 @@
"""Moves "featured" artists to the title from the artist field.
"""
from __future__ import division, absolute_import, print_function
import re
from beets import plugins

View file

@ -15,6 +15,8 @@
"""Provides a fuzzy matching query.
"""
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
from beets.dbcore.query import StringFieldQuery
import difflib

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
"""Warns you about things you hate (or even blocks import)."""
from beets.plugins import BeetsPlugin

View file

@ -3,8 +3,8 @@ modification time (mtime) of the item's source file before import.
Reimported albums and items are skipped.
"""
from __future__ import unicode_literals, absolute_import, print_function
from __future__ import (unicode_literals, absolute_import, print_function,
division)
import os

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
"""Write paths of imported files in various formats to ease later import in a
music player. Also allow printing the new file locations to stdout in case
one wants to manually add music to a player by its path.

View file

@ -15,6 +15,8 @@
"""Shows file metadata.
"""
from __future__ import division, absolute_import, print_function
import os
from beets.plugins import BeetsPlugin

View file

@ -14,6 +14,8 @@
"""Allows inline path template customization code in the config file.
"""
from __future__ import division, absolute_import, print_function
import traceback
import itertools

View file

@ -15,6 +15,8 @@
"""Uses the `KeyFinder` program to add the `initial_key` field.
"""
from __future__ import division, absolute_import, print_function
import subprocess
from beets import ui

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
"""Gets genres for imported music based on Last.fm tags.
Uses a provided whitelist file to determine which tags are valid genres.

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
import requests
from beets import ui
from beets import dbcore

View file

@ -14,7 +14,8 @@
"""Fetches, embeds, and displays lyrics.
"""
from __future__ import print_function
from __future__ import division, absolute_import, print_function
import re
import requests

View file

@ -12,6 +12,8 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
from beets.ui import Subcommand
from beets import ui

View file

@ -14,6 +14,8 @@
"""Update library's tags using MusicBrainz.
"""
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
from beets import autotag, library, ui, util
from beets.autotag import hooks

View file

@ -14,6 +14,8 @@
"""List missing tracks.
"""
from __future__ import division, absolute_import, print_function
from beets.autotag import hooks
from beets.library import Item
from beets.plugins import BeetsPlugin

View file

@ -13,6 +13,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
import mpd
import socket
import select

View file

@ -20,6 +20,8 @@ Put something like the following in your config.yaml to configure:
port: 6600
password: seekrit
"""
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
import os
import socket

View file

@ -1,3 +1,5 @@
from __future__ import division, absolute_import, print_function
"""Fixes file permissions after the file gets written on import. Put something
like the following in your config.yaml to configure:

View file

@ -14,6 +14,8 @@
"""Send the results of a query to the configured music player as a playlist.
"""
from __future__ import division, absolute_import, print_function
from functools import partial
from beets.plugins import BeetsPlugin

View file

@ -5,6 +5,8 @@ Put something like the following in your config.yaml to configure:
host: localhost
port: 32400
"""
from __future__ import division, absolute_import, print_function
import requests
from urlparse import urljoin
import xml.etree.ElementTree as ET

View file

@ -14,7 +14,8 @@
"""Get a random song or album from the library.
"""
from __future__ import absolute_import
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
from beets.ui import Subcommand, decargs, print_obj
from beets.util.functemplate import Template

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
import subprocess
import os
import collections

View file

@ -15,6 +15,8 @@
"""Uses user-specified rewriting rules to canonicalize names for path
formats.
"""
from __future__ import division, absolute_import, print_function
import re
from collections import defaultdict

View file

@ -16,6 +16,8 @@
automatically whenever tags are written.
"""
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
from beets import ui
from beets import util

View file

@ -14,7 +14,8 @@
"""Generates smart playlists based on beets queries.
"""
from __future__ import print_function
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
from beets import ui

View file

@ -1,4 +1,5 @@
from __future__ import print_function
from __future__ import division, absolute_import, print_function
import re
import webbrowser
import requests

View file

@ -14,6 +14,8 @@
"""Moves patterns in path formats (suitable for moving articles)."""
from __future__ import division, absolute_import, print_function
import re
from beets.plugins import BeetsPlugin

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
from beets.dbcore import types
from beets.util.confit import ConfigValueError

View file

@ -13,6 +13,8 @@
# included in all copies or substantial portions of the Software.
"""A Web interface to beets."""
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
from beets import ui
from beets import util

View file

@ -14,6 +14,8 @@
""" Clears tag fields in media files."""
from __future__ import division, absolute_import, print_function
import re
from beets.plugins import BeetsPlugin
from beets.mediafile import MediaFile

View file

@ -1,6 +1,8 @@
#!/usr/bin/env python3
"""A utility script for automating the beets release process.
"""
from __future__ import division, absolute_import, print_function
import click
import os
import re

View file

@ -14,6 +14,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
import os
import sys
import subprocess

View file

@ -13,6 +13,8 @@
# included in all copies or substantial portions of the Software.
"""Some common functionality for beets' test cases."""
from __future__ import division, absolute_import, print_function
import time
import sys
import os

View file

@ -23,6 +23,8 @@ information or mock the environment.
- The `generate_album_info` and `generate_track_info` functions return
fixtures to be used when mocking the autotagger.
from __future__ import division, absolute_import, print_function
- The `TestImportSession` allows one to run importer code while
controlling the interactions through code.

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
import os
import sys
import requests

View file

@ -1,3 +1,5 @@
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin
from beets import ui

View file

@ -14,6 +14,8 @@
"""Tests for the album art fetchers."""
from __future__ import division, absolute_import, print_function
import os
import shutil

View file

@ -14,6 +14,8 @@
"""Tests for autotagging functionality.
"""
from __future__ import division, absolute_import, print_function
import re
import copy

View file

@ -15,6 +15,8 @@
"""Tests for the 'bucket' plugin."""
from __future__ import division, absolute_import, print_function
from test._common import unittest
from beetsplug import bucket
from beets import config, ui

View file

@ -1,3 +1,5 @@
from __future__ import division, absolute_import, print_function
import os
import yaml
from mock import patch

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
import re
import os.path
from test import _common

View file

@ -14,6 +14,8 @@
"""Test for dbcore's date-based queries.
"""
from __future__ import division, absolute_import, print_function
from test import _common
from test._common import unittest
from datetime import datetime

View file

@ -14,6 +14,8 @@
"""Tests for the DBCore database abstraction.
"""
from __future__ import division, absolute_import, print_function
import os
import sqlite3

View file

@ -13,6 +13,8 @@
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
import os.path
from mock import Mock, patch

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
import os.path
from mock import Mock, patch

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
import os
from test._common import unittest
from test.helper import TestHelper

View file

@ -14,6 +14,8 @@
"""Test file manipulation functionality of Item.
"""
from __future__ import division, absolute_import, print_function
import shutil
import os
import stat

View file

@ -14,6 +14,8 @@
"""Tests for the 'ftintitle' plugin."""
from __future__ import division, absolute_import, print_function
from test._common import unittest
from beetsplug import ftintitle

View file

@ -1,5 +1,7 @@
"""Tests for the 'ihate' plugin"""
from __future__ import division, absolute_import, print_function
from test._common import unittest
from beets import importer
from beets.library import Item

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
"""Tests for the `importadded` plugin."""
import os

View file

@ -13,6 +13,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
"""Tests for the general importer functionality.
"""
import os

View file

@ -1,3 +1,5 @@
from __future__ import division, absolute_import, print_function
import os
import os.path
import tempfile

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
from test._common import unittest
from test.helper import TestHelper

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
from mock import patch
from test._common import unittest
from test.helper import TestHelper

View file

@ -14,6 +14,8 @@
"""Tests for the 'lastgenre' plugin."""
from __future__ import division, absolute_import, print_function
from mock import Mock
from test import _common

View file

@ -14,6 +14,8 @@
"""Tests for non-query database functions of Item.
"""
from __future__ import division, absolute_import, print_function
import os
import os.path
import stat

View file

@ -1,4 +1,6 @@
"""Stupid tests that ensure logging works as expected"""
from __future__ import division, absolute_import, print_function
import logging as log
from StringIO import StringIO

View file

@ -14,6 +14,8 @@
"""Tests for the 'lyrics' plugin."""
from __future__ import division, absolute_import, print_function
import os
from test import _common
import sys

View file

@ -14,6 +14,8 @@
"""Tests for MusicBrainz API wrapper.
"""
from __future__ import division, absolute_import, print_function
from test import _common
from test._common import unittest
from beets.autotag import mb

View file

@ -12,6 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
from __future__ import division, absolute_import, print_function
from mock import patch
from test._common import unittest

View file

@ -15,6 +15,8 @@
"""Automatically-generated blanket testing for the MediaFile metadata
layer.
"""
from __future__ import division, absolute_import, print_function
import os
import shutil
import tempfile

Some files were not shown because too many files have changed in this diff Show more