Merge branch 'develop' into tidy-up-core
Git was not correctly identifying the merge and threw a conflict
This commit is contained in:
commit
7af86d65ac
@ -1,15 +1,18 @@
|
||||
language: python
|
||||
|
||||
install:
|
||||
- "wget -q -O - http://apt.mopidy.com/mopidy.gpg | sudo apt-key add -"
|
||||
- "sudo wget -q -O /etc/apt/sources.list.d/mopidy.list http://apt.mopidy.com/mopidy.list"
|
||||
- "wget -O - http://apt.mopidy.com/mopidy.gpg | sudo apt-key add -"
|
||||
- "sudo wget -O /etc/apt/sources.list.d/mopidy.list http://apt.mopidy.com/mopidy.list"
|
||||
- "sudo apt-get update || true"
|
||||
- "sudo apt-get install $(apt-cache depends mopidy | awk '$2 !~ /mopidy/ {print $2}')"
|
||||
- "pip install flake8"
|
||||
|
||||
before_script:
|
||||
- "rm $VIRTUAL_ENV/lib/python$TRAVIS_PYTHON_VERSION/no-global-site-packages.txt"
|
||||
|
||||
script: nosetests
|
||||
script:
|
||||
- "flake8 $(find . -iname '*.py')"
|
||||
- "nosetests"
|
||||
|
||||
notifications:
|
||||
irc:
|
||||
|
||||
@ -22,8 +22,8 @@ tested by Jenkins before it is merged into the ``develop`` branch, which is a
|
||||
bit late, but good enough to get broad testing before new code is released.
|
||||
|
||||
In addition to running tests, the Jenkins CI server also gathers coverage
|
||||
statistics and uses pylint to check for errors and possible improvements in our
|
||||
code. So, if you're out of work, the code coverage and pylint data at the CI
|
||||
statistics and uses flake8 to check for errors and possible improvements in our
|
||||
code. So, if you're out of work, the code coverage and flake8 data at the CI
|
||||
server should give you a place to start.
|
||||
|
||||
|
||||
|
||||
11
fabfile.py
vendored
11
fabfile.py
vendored
@ -35,6 +35,17 @@ def autocoverage(path=None):
|
||||
auto(coverage, path=path)
|
||||
|
||||
|
||||
@task
|
||||
def lint(path=None):
|
||||
path = path or '.'
|
||||
local('flake8 $(find %s -iname "*.py")' % path)
|
||||
|
||||
|
||||
@task
|
||||
def autolint(path=None):
|
||||
auto(lint, path=path)
|
||||
|
||||
|
||||
def auto(task, *args, **kwargs):
|
||||
while True:
|
||||
local('clear')
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# pylint: disable = E0611,F0401
|
||||
from distutils.version import StrictVersion as SV
|
||||
# pylint: enable = E0611,F0401
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
|
||||
@ -35,8 +35,8 @@ MB = 1 << 20
|
||||
# GST_PLAY_FLAG_SOFT_COLORBALANCE (1<<10)
|
||||
|
||||
# Default flags to use for playbin: AUDIO, SOFT_VOLUME, DOWNLOAD
|
||||
PLAYBIN_FLAGS = (1<<1) | (1<<4) | (1<<7)
|
||||
PLAYBIN_VIS_FLAGS = PLAYBIN_FLAGS | (1<<3)
|
||||
PLAYBIN_FLAGS = (1 << 1) | (1 << 4) | (1 << 7)
|
||||
PLAYBIN_VIS_FLAGS = PLAYBIN_FLAGS | (1 << 3)
|
||||
|
||||
|
||||
class Audio(pykka.ThreadingActor):
|
||||
@ -175,7 +175,8 @@ class Audio(pykka.ThreadingActor):
|
||||
logger.info('Audio visualizer set to "%s"', visualizer_element)
|
||||
except gobject.GError as ex:
|
||||
logger.error(
|
||||
'Failed to create audio visualizer "%s": %s', visualizer_element, ex)
|
||||
'Failed to create audio visualizer "%s": %s',
|
||||
visualizer_element, ex)
|
||||
|
||||
def _setup_mixer(self):
|
||||
mixer_desc = self._config['audio']['mixer']
|
||||
|
||||
@ -29,9 +29,7 @@ class AutoAudioMixer(gst.Bin):
|
||||
gst.Bin.__init__(self)
|
||||
mixer = self._find_mixer()
|
||||
if mixer:
|
||||
# pylint: disable=E1101
|
||||
self.add(mixer)
|
||||
# pylint: enable=E1101
|
||||
logger.debug('AutoAudioMixer chose: %s', mixer.get_name())
|
||||
else:
|
||||
logger.debug('AutoAudioMixer did not find any usable mixers')
|
||||
|
||||
@ -2,7 +2,6 @@ from __future__ import unicode_literals
|
||||
|
||||
import logging
|
||||
import os
|
||||
import urllib
|
||||
import urlparse
|
||||
|
||||
from mopidy.models import Track, Artist, Album
|
||||
|
||||
@ -18,9 +18,6 @@ logger = logging.getLogger('mopidy.backends.spotify')
|
||||
|
||||
BITRATES = {96: 2, 160: 0, 320: 1}
|
||||
|
||||
# pylint: disable = R0901
|
||||
# SpotifySessionManager: Too many ancestors (9/7)
|
||||
|
||||
|
||||
class SpotifySessionManager(process.BaseThread, PyspotifySessionManager):
|
||||
cache_location = None
|
||||
@ -116,9 +113,6 @@ class SpotifySessionManager(process.BaseThread, PyspotifySessionManager):
|
||||
def music_delivery(self, session, frames, frame_size, num_frames,
|
||||
sample_type, sample_rate, channels):
|
||||
"""Callback used by pyspotify"""
|
||||
# pylint: disable = R0913
|
||||
# Too many arguments (8/5)
|
||||
|
||||
if not self.push_audio_data:
|
||||
return 0
|
||||
|
||||
|
||||
@ -67,7 +67,8 @@ def to_mopidy_track(spotify_track, bitrate=None):
|
||||
return track_cache[uri]
|
||||
|
||||
|
||||
def to_mopidy_playlist(spotify_playlist, folders=None, bitrate=None, username=None):
|
||||
def to_mopidy_playlist(
|
||||
spotify_playlist, folders=None, bitrate=None, username=None):
|
||||
if spotify_playlist is None or spotify_playlist.type() != 'playlist':
|
||||
return
|
||||
try:
|
||||
|
||||
@ -111,7 +111,8 @@ class Secret(ConfigValue):
|
||||
class Integer(ConfigValue):
|
||||
"""Integer value."""
|
||||
|
||||
def __init__(self, minimum=None, maximum=None, choices=None, optional=False):
|
||||
def __init__(
|
||||
self, minimum=None, maximum=None, choices=None, optional=False):
|
||||
self._required = not optional
|
||||
self._minimum = minimum
|
||||
self._maximum = maximum
|
||||
|
||||
@ -69,8 +69,9 @@ class LibraryController(object):
|
||||
"""
|
||||
query = query or kwargs
|
||||
futures = [
|
||||
backend.library.find_exact(query=query, uris=uris)
|
||||
for (backend, uris) in self._get_backends_to_uris(uris).items()]
|
||||
backend.library.find_exact(query=query, uris=backend_uris)
|
||||
for (backend, backend_uris)
|
||||
in self._get_backends_to_uris(uris).items()]
|
||||
return [result for result in pykka.get_all(futures) if result]
|
||||
|
||||
def lookup(self, uri):
|
||||
@ -145,6 +146,7 @@ class LibraryController(object):
|
||||
"""
|
||||
query = query or kwargs
|
||||
futures = [
|
||||
backend.library.search(query=query, uris=uris)
|
||||
for (backend, uris) in self._get_backends_to_uris(uris).items()]
|
||||
backend.library.search(query=query, uris=backend_uris)
|
||||
for (backend, backend_uris)
|
||||
in self._get_backends_to_uris(uris).items()]
|
||||
return [result for result in pykka.get_all(futures) if result]
|
||||
|
||||
@ -12,9 +12,6 @@ logger = logging.getLogger('mopidy.core')
|
||||
|
||||
|
||||
class PlaybackController(object):
|
||||
# pylint: disable = R0902
|
||||
# Too many instance attributes
|
||||
|
||||
pykka_traversable = True
|
||||
|
||||
def __init__(self, audio, backends, core):
|
||||
|
||||
@ -82,7 +82,8 @@ class Extension(object):
|
||||
def get_library_updaters(self):
|
||||
"""List of library updater classes
|
||||
|
||||
:returns: list of :class:`~mopidy.backends.base.BaseLibraryUpdateProvider`
|
||||
:returns: list of
|
||||
:class:`~mopidy.backends.base.BaseLibraryUpdateProvider`
|
||||
subclasses
|
||||
"""
|
||||
return []
|
||||
|
||||
@ -72,9 +72,7 @@ def load_protocol_modules():
|
||||
The protocol modules must be imported to get them registered in
|
||||
:attr:`request_handlers` and :attr:`mpd_commands`.
|
||||
"""
|
||||
# pylint: disable = W0612
|
||||
from . import ( # noqa
|
||||
audio_output, channels, command_list, connection, current_playlist,
|
||||
empty, music_db, playback, reflection, status, stickers,
|
||||
stored_playlists)
|
||||
# pylint: enable = W0612
|
||||
|
||||
@ -192,7 +192,8 @@ def translator(data):
|
||||
|
||||
|
||||
class Scanner(object):
|
||||
def __init__(self, uris, data_callback, error_callback=None, scan_timeout=1000):
|
||||
def __init__(
|
||||
self, uris, data_callback, error_callback=None, scan_timeout=1000):
|
||||
self.data = {}
|
||||
self.uris = iter(uris)
|
||||
self.data_callback = data_callback
|
||||
@ -298,7 +299,8 @@ class Scanner(object):
|
||||
return False
|
||||
self.pipe.set_state(gst.STATE_NULL)
|
||||
self.uribin.set_property('uri', uri)
|
||||
self.timeout_id = gobject.timeout_add(self.scan_timeout, self.process_timeout)
|
||||
self.timeout_id = gobject.timeout_add(
|
||||
self.scan_timeout, self.process_timeout)
|
||||
self.pipe.set_state(gst.STATE_PLAYING)
|
||||
return True
|
||||
|
||||
|
||||
@ -2,9 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
import logging
|
||||
import os
|
||||
# pylint: disable = W0402
|
||||
import string
|
||||
# pylint: enable = W0402
|
||||
import urllib
|
||||
import urlparse
|
||||
|
||||
|
||||
@ -14,11 +14,9 @@ def get_version():
|
||||
|
||||
def get_git_version():
|
||||
process = Popen(['git', 'describe'], stdout=PIPE, stderr=PIPE)
|
||||
# pylint: disable = E1101
|
||||
if process.wait() != 0:
|
||||
raise EnvironmentError('Execution of "git describe" failed')
|
||||
version = process.stdout.read().strip()
|
||||
# pylint: enable = E1101
|
||||
if version.startswith('v'):
|
||||
version = version[1:]
|
||||
return version
|
||||
|
||||
21
pylintrc
21
pylintrc
@ -1,21 +0,0 @@
|
||||
[MESSAGES CONTROL]
|
||||
#
|
||||
# Disabled messages
|
||||
# -----------------
|
||||
#
|
||||
# C0103 - Invalid name "%s" (should match %s)
|
||||
# C0111 - Missing docstring
|
||||
# R0201 - Method could be a function
|
||||
# R0801 - Similar lines in %s files
|
||||
# R0902 - Too many instance attributes (%s/%s)
|
||||
# R0903 - Too few public methods (%s/%s)
|
||||
# R0904 - Too many public methods (%s/%s)
|
||||
# R0912 - Too many branches (%s/%s)
|
||||
# R0913 - Too many arguments (%s/%s)
|
||||
# R0921 - Abstract class not referenced
|
||||
# W0141 - Used builtin function '%s'
|
||||
# W0142 - Used * or ** magic
|
||||
# W0511 - TODO, FIXME and XXX in the code
|
||||
# W0613 - Unused argument %r
|
||||
#
|
||||
disable = C0103,C0111,R0201,R0801,R0902,R0903,R0904,R0912,R0913,R0921,W0141,W0142,W0511,W0613
|
||||
@ -2,4 +2,3 @@ coverage
|
||||
flake8
|
||||
mock >= 1.0
|
||||
nose
|
||||
pylint
|
||||
|
||||
@ -7,7 +7,6 @@ import unittest
|
||||
|
||||
from mopidy.backends.local import actor
|
||||
from mopidy.models import Track
|
||||
from mopidy.utils.path import path_to_uri, uri_to_path
|
||||
|
||||
from tests import path_to_data_dir
|
||||
from tests.backends.base.playlists import (
|
||||
@ -100,8 +99,6 @@ class LocalPlaylistsControllerTest(
|
||||
self.assertEqual(track.uri, contents.strip())
|
||||
|
||||
def test_playlists_are_loaded_at_startup(self):
|
||||
playlist_path = os.path.join(self.playlists_dir, 'test.m3u')
|
||||
|
||||
track = Track(uri='local:track:path2')
|
||||
playlist = self.core.playlists.create('test')
|
||||
playlist = playlist.copy(tracks=[track])
|
||||
|
||||
@ -81,7 +81,8 @@ class ConfigSchemaTest(unittest.TestCase):
|
||||
class LogLevelConfigSchemaTest(unittest.TestCase):
|
||||
def test_conversion(self):
|
||||
schema = schemas.LogLevelConfigSchema('test')
|
||||
result, errors = schema.deserialize({'foo.bar': 'DEBUG', 'baz': 'INFO'})
|
||||
result, errors = schema.deserialize(
|
||||
{'foo.bar': 'DEBUG', 'baz': 'INFO'})
|
||||
|
||||
self.assertEqual(logging.DEBUG, result['foo.bar'])
|
||||
self.assertEqual(logging.INFO, result['baz'])
|
||||
|
||||
@ -10,8 +10,8 @@ from tests.frontends.mpd import protocol
|
||||
class PlaylistsHandlerTest(protocol.BaseTestCase):
|
||||
def test_listplaylist(self):
|
||||
self.backend.playlists.playlists = [
|
||||
Playlist(name='name', uri='dummy:name',
|
||||
tracks=[Track(uri='dummy:a')])]
|
||||
Playlist(
|
||||
name='name', uri='dummy:name', tracks=[Track(uri='dummy:a')])]
|
||||
|
||||
self.sendRequest('listplaylist "name"')
|
||||
self.assertInResponse('file: dummy:a')
|
||||
@ -19,8 +19,8 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
||||
|
||||
def test_listplaylist_without_quotes(self):
|
||||
self.backend.playlists.playlists = [
|
||||
Playlist(name='name', uri='dummy:name',
|
||||
tracks=[Track(uri='dummy:a')])]
|
||||
Playlist(
|
||||
name='name', uri='dummy:name', tracks=[Track(uri='dummy:a')])]
|
||||
|
||||
self.sendRequest('listplaylist name')
|
||||
self.assertInResponse('file: dummy:a')
|
||||
@ -41,8 +41,8 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
||||
|
||||
def test_listplaylistinfo(self):
|
||||
self.backend.playlists.playlists = [
|
||||
Playlist(name='name', uri='dummy:name',
|
||||
tracks=[Track(uri='dummy:a')])]
|
||||
Playlist(
|
||||
name='name', uri='dummy:name', tracks=[Track(uri='dummy:a')])]
|
||||
|
||||
self.sendRequest('listplaylistinfo "name"')
|
||||
self.assertInResponse('file: dummy:a')
|
||||
@ -52,8 +52,8 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
||||
|
||||
def test_listplaylistinfo_without_quotes(self):
|
||||
self.backend.playlists.playlists = [
|
||||
Playlist(name='name', uri='dummy:name',
|
||||
tracks=[Track(uri='dummy:a')])]
|
||||
Playlist(
|
||||
name='name', uri='dummy:name', tracks=[Track(uri='dummy:a')])]
|
||||
|
||||
self.sendRequest('listplaylistinfo name')
|
||||
self.assertInResponse('file: dummy:a')
|
||||
@ -109,7 +109,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
||||
|
||||
def test_listplaylists_replaces_newline_with_space(self):
|
||||
self.backend.playlists.playlists = [
|
||||
Playlist(name='a\n', uri='dummy:')]
|
||||
Playlist(name='a\n', uri='dummy:')]
|
||||
self.sendRequest('listplaylists')
|
||||
self.assertInResponse('playlist: a ')
|
||||
self.assertNotInResponse('playlist: a\n')
|
||||
@ -117,7 +117,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
||||
|
||||
def test_listplaylists_replaces_carriage_return_with_space(self):
|
||||
self.backend.playlists.playlists = [
|
||||
Playlist(name='a\r', uri='dummy:')]
|
||||
Playlist(name='a\r', uri='dummy:')]
|
||||
self.sendRequest('listplaylists')
|
||||
self.assertInResponse('playlist: a ')
|
||||
self.assertNotInResponse('playlist: a\r')
|
||||
@ -125,7 +125,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
||||
|
||||
def test_listplaylists_replaces_forward_slash_with_space(self):
|
||||
self.backend.playlists.playlists = [
|
||||
Playlist(name='a/', uri='dummy:')]
|
||||
Playlist(name='a/', uri='dummy:')]
|
||||
self.sendRequest('listplaylists')
|
||||
self.assertInResponse('playlist: a ')
|
||||
self.assertNotInResponse('playlist: a/')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user