Fix flake8 warnings
This commit is contained in:
parent
74ab07cc6c
commit
5c7a496dc2
@ -35,8 +35,8 @@ MB = 1 << 20
|
|||||||
# GST_PLAY_FLAG_SOFT_COLORBALANCE (1<<10)
|
# GST_PLAY_FLAG_SOFT_COLORBALANCE (1<<10)
|
||||||
|
|
||||||
# Default flags to use for playbin: AUDIO, SOFT_VOLUME, DOWNLOAD
|
# Default flags to use for playbin: AUDIO, SOFT_VOLUME, DOWNLOAD
|
||||||
PLAYBIN_FLAGS = (1<<1) | (1<<4) | (1<<7)
|
PLAYBIN_FLAGS = (1 << 1) | (1 << 4) | (1 << 7)
|
||||||
PLAYBIN_VIS_FLAGS = PLAYBIN_FLAGS | (1<<3)
|
PLAYBIN_VIS_FLAGS = PLAYBIN_FLAGS | (1 << 3)
|
||||||
|
|
||||||
|
|
||||||
class Audio(pykka.ThreadingActor):
|
class Audio(pykka.ThreadingActor):
|
||||||
@ -175,7 +175,8 @@ class Audio(pykka.ThreadingActor):
|
|||||||
logger.info('Audio visualizer set to "%s"', visualizer_element)
|
logger.info('Audio visualizer set to "%s"', visualizer_element)
|
||||||
except gobject.GError as ex:
|
except gobject.GError as ex:
|
||||||
logger.error(
|
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):
|
def _setup_mixer(self):
|
||||||
mixer_desc = self._config['audio']['mixer']
|
mixer_desc = self._config['audio']['mixer']
|
||||||
|
|||||||
@ -2,7 +2,6 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import urllib
|
|
||||||
import urlparse
|
import urlparse
|
||||||
|
|
||||||
from mopidy.models import Track, Artist, Album
|
from mopidy.models import Track, Artist, Album
|
||||||
|
|||||||
@ -67,7 +67,8 @@ def to_mopidy_track(spotify_track, bitrate=None):
|
|||||||
return track_cache[uri]
|
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':
|
if spotify_playlist is None or spotify_playlist.type() != 'playlist':
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -111,7 +111,8 @@ class Secret(ConfigValue):
|
|||||||
class Integer(ConfigValue):
|
class Integer(ConfigValue):
|
||||||
"""Integer value."""
|
"""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._required = not optional
|
||||||
self._minimum = minimum
|
self._minimum = minimum
|
||||||
self._maximum = maximum
|
self._maximum = maximum
|
||||||
|
|||||||
@ -69,8 +69,9 @@ class LibraryController(object):
|
|||||||
"""
|
"""
|
||||||
query = query or kwargs
|
query = query or kwargs
|
||||||
futures = [
|
futures = [
|
||||||
backend.library.find_exact(query=query, uris=uris)
|
backend.library.find_exact(query=query, uris=backend_uris)
|
||||||
for (backend, uris) in self._get_backends_to_uris(uris).items()]
|
for (backend, backend_uris)
|
||||||
|
in self._get_backends_to_uris(uris).items()]
|
||||||
return [result for result in pykka.get_all(futures) if result]
|
return [result for result in pykka.get_all(futures) if result]
|
||||||
|
|
||||||
def lookup(self, uri):
|
def lookup(self, uri):
|
||||||
@ -145,6 +146,7 @@ class LibraryController(object):
|
|||||||
"""
|
"""
|
||||||
query = query or kwargs
|
query = query or kwargs
|
||||||
futures = [
|
futures = [
|
||||||
backend.library.search(query=query, uris=uris)
|
backend.library.search(query=query, uris=backend_uris)
|
||||||
for (backend, uris) in self._get_backends_to_uris(uris).items()]
|
for (backend, backend_uris)
|
||||||
|
in self._get_backends_to_uris(uris).items()]
|
||||||
return [result for result in pykka.get_all(futures) if result]
|
return [result for result in pykka.get_all(futures) if result]
|
||||||
|
|||||||
@ -82,7 +82,8 @@ class Extension(object):
|
|||||||
def get_library_updaters(self):
|
def get_library_updaters(self):
|
||||||
"""List of library updater classes
|
"""List of library updater classes
|
||||||
|
|
||||||
:returns: list of :class:`~mopidy.backends.base.BaseLibraryUpdateProvider`
|
:returns: list of
|
||||||
|
:class:`~mopidy.backends.base.BaseLibraryUpdateProvider`
|
||||||
subclasses
|
subclasses
|
||||||
"""
|
"""
|
||||||
return []
|
return []
|
||||||
|
|||||||
@ -192,7 +192,8 @@ def translator(data):
|
|||||||
|
|
||||||
|
|
||||||
class Scanner(object):
|
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.data = {}
|
||||||
self.uris = iter(uris)
|
self.uris = iter(uris)
|
||||||
self.data_callback = data_callback
|
self.data_callback = data_callback
|
||||||
@ -298,7 +299,8 @@ class Scanner(object):
|
|||||||
return False
|
return False
|
||||||
self.pipe.set_state(gst.STATE_NULL)
|
self.pipe.set_state(gst.STATE_NULL)
|
||||||
self.uribin.set_property('uri', uri)
|
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)
|
self.pipe.set_state(gst.STATE_PLAYING)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import unittest
|
|||||||
|
|
||||||
from mopidy.backends.local import actor
|
from mopidy.backends.local import actor
|
||||||
from mopidy.models import Track
|
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 import path_to_data_dir
|
||||||
from tests.backends.base.playlists import (
|
from tests.backends.base.playlists import (
|
||||||
@ -100,8 +99,6 @@ class LocalPlaylistsControllerTest(
|
|||||||
self.assertEqual(track.uri, contents.strip())
|
self.assertEqual(track.uri, contents.strip())
|
||||||
|
|
||||||
def test_playlists_are_loaded_at_startup(self):
|
def test_playlists_are_loaded_at_startup(self):
|
||||||
playlist_path = os.path.join(self.playlists_dir, 'test.m3u')
|
|
||||||
|
|
||||||
track = Track(uri='local:track:path2')
|
track = Track(uri='local:track:path2')
|
||||||
playlist = self.core.playlists.create('test')
|
playlist = self.core.playlists.create('test')
|
||||||
playlist = playlist.copy(tracks=[track])
|
playlist = playlist.copy(tracks=[track])
|
||||||
|
|||||||
@ -81,7 +81,8 @@ class ConfigSchemaTest(unittest.TestCase):
|
|||||||
class LogLevelConfigSchemaTest(unittest.TestCase):
|
class LogLevelConfigSchemaTest(unittest.TestCase):
|
||||||
def test_conversion(self):
|
def test_conversion(self):
|
||||||
schema = schemas.LogLevelConfigSchema('test')
|
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.DEBUG, result['foo.bar'])
|
||||||
self.assertEqual(logging.INFO, result['baz'])
|
self.assertEqual(logging.INFO, result['baz'])
|
||||||
|
|||||||
@ -10,8 +10,8 @@ from tests.frontends.mpd import protocol
|
|||||||
class PlaylistsHandlerTest(protocol.BaseTestCase):
|
class PlaylistsHandlerTest(protocol.BaseTestCase):
|
||||||
def test_listplaylist(self):
|
def test_listplaylist(self):
|
||||||
self.backend.playlists.playlists = [
|
self.backend.playlists.playlists = [
|
||||||
Playlist(name='name', uri='dummy:name',
|
Playlist(
|
||||||
tracks=[Track(uri='dummy:a')])]
|
name='name', uri='dummy:name', tracks=[Track(uri='dummy:a')])]
|
||||||
|
|
||||||
self.sendRequest('listplaylist "name"')
|
self.sendRequest('listplaylist "name"')
|
||||||
self.assertInResponse('file: dummy:a')
|
self.assertInResponse('file: dummy:a')
|
||||||
@ -19,8 +19,8 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
|||||||
|
|
||||||
def test_listplaylist_without_quotes(self):
|
def test_listplaylist_without_quotes(self):
|
||||||
self.backend.playlists.playlists = [
|
self.backend.playlists.playlists = [
|
||||||
Playlist(name='name', uri='dummy:name',
|
Playlist(
|
||||||
tracks=[Track(uri='dummy:a')])]
|
name='name', uri='dummy:name', tracks=[Track(uri='dummy:a')])]
|
||||||
|
|
||||||
self.sendRequest('listplaylist name')
|
self.sendRequest('listplaylist name')
|
||||||
self.assertInResponse('file: dummy:a')
|
self.assertInResponse('file: dummy:a')
|
||||||
@ -41,8 +41,8 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
|||||||
|
|
||||||
def test_listplaylistinfo(self):
|
def test_listplaylistinfo(self):
|
||||||
self.backend.playlists.playlists = [
|
self.backend.playlists.playlists = [
|
||||||
Playlist(name='name', uri='dummy:name',
|
Playlist(
|
||||||
tracks=[Track(uri='dummy:a')])]
|
name='name', uri='dummy:name', tracks=[Track(uri='dummy:a')])]
|
||||||
|
|
||||||
self.sendRequest('listplaylistinfo "name"')
|
self.sendRequest('listplaylistinfo "name"')
|
||||||
self.assertInResponse('file: dummy:a')
|
self.assertInResponse('file: dummy:a')
|
||||||
@ -52,8 +52,8 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
|||||||
|
|
||||||
def test_listplaylistinfo_without_quotes(self):
|
def test_listplaylistinfo_without_quotes(self):
|
||||||
self.backend.playlists.playlists = [
|
self.backend.playlists.playlists = [
|
||||||
Playlist(name='name', uri='dummy:name',
|
Playlist(
|
||||||
tracks=[Track(uri='dummy:a')])]
|
name='name', uri='dummy:name', tracks=[Track(uri='dummy:a')])]
|
||||||
|
|
||||||
self.sendRequest('listplaylistinfo name')
|
self.sendRequest('listplaylistinfo name')
|
||||||
self.assertInResponse('file: dummy:a')
|
self.assertInResponse('file: dummy:a')
|
||||||
@ -109,7 +109,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
|||||||
|
|
||||||
def test_listplaylists_replaces_newline_with_space(self):
|
def test_listplaylists_replaces_newline_with_space(self):
|
||||||
self.backend.playlists.playlists = [
|
self.backend.playlists.playlists = [
|
||||||
Playlist(name='a\n', uri='dummy:')]
|
Playlist(name='a\n', uri='dummy:')]
|
||||||
self.sendRequest('listplaylists')
|
self.sendRequest('listplaylists')
|
||||||
self.assertInResponse('playlist: a ')
|
self.assertInResponse('playlist: a ')
|
||||||
self.assertNotInResponse('playlist: a\n')
|
self.assertNotInResponse('playlist: a\n')
|
||||||
@ -117,7 +117,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
|||||||
|
|
||||||
def test_listplaylists_replaces_carriage_return_with_space(self):
|
def test_listplaylists_replaces_carriage_return_with_space(self):
|
||||||
self.backend.playlists.playlists = [
|
self.backend.playlists.playlists = [
|
||||||
Playlist(name='a\r', uri='dummy:')]
|
Playlist(name='a\r', uri='dummy:')]
|
||||||
self.sendRequest('listplaylists')
|
self.sendRequest('listplaylists')
|
||||||
self.assertInResponse('playlist: a ')
|
self.assertInResponse('playlist: a ')
|
||||||
self.assertNotInResponse('playlist: a\r')
|
self.assertNotInResponse('playlist: a\r')
|
||||||
@ -125,7 +125,7 @@ class PlaylistsHandlerTest(protocol.BaseTestCase):
|
|||||||
|
|
||||||
def test_listplaylists_replaces_forward_slash_with_space(self):
|
def test_listplaylists_replaces_forward_slash_with_space(self):
|
||||||
self.backend.playlists.playlists = [
|
self.backend.playlists.playlists = [
|
||||||
Playlist(name='a/', uri='dummy:')]
|
Playlist(name='a/', uri='dummy:')]
|
||||||
self.sendRequest('listplaylists')
|
self.sendRequest('listplaylists')
|
||||||
self.assertInResponse('playlist: a ')
|
self.assertInResponse('playlist: a ')
|
||||||
self.assertNotInResponse('playlist: a/')
|
self.assertNotInResponse('playlist: a/')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user