New flake8 version with new checks to conform to

This commit is contained in:
Stein Magnus Jodal 2014-03-29 20:47:42 +01:00
parent 9db9def367
commit 5583ca5aba
15 changed files with 37 additions and 36 deletions

View File

@ -38,7 +38,7 @@ _proxy_schema['username'] = String(optional=True)
_proxy_schema['password'] = Secret(optional=True) _proxy_schema['password'] = Secret(optional=True)
# NOTE: if multiple outputs ever comes something like LogLevelConfigSchema # NOTE: if multiple outputs ever comes something like LogLevelConfigSchema
#_outputs_schema = config.AudioOutputConfigSchema() # _outputs_schema = config.AudioOutputConfigSchema()
_schemas = [_logging_schema, _loglevels_schema, _audio_schema, _proxy_schema] _schemas = [_logging_schema, _loglevels_schema, _audio_schema, _proxy_schema]

View File

@ -30,7 +30,7 @@ class PlaybackController(object):
uri_scheme = urlparse.urlparse(uri).scheme uri_scheme = urlparse.urlparse(uri).scheme
return self.backends.with_playback.get(uri_scheme, None) return self.backends.with_playback.get(uri_scheme, None)
### Properties # Properties
def get_current_tl_track(self): def get_current_tl_track(self):
return self.current_tl_track return self.current_tl_track
@ -127,7 +127,7 @@ class PlaybackController(object):
mute = property(get_mute, set_mute) mute = property(get_mute, set_mute)
"""Mute state as a :class:`True` if muted, :class:`False` otherwise""" """Mute state as a :class:`True` if muted, :class:`False` otherwise"""
### Methods # Methods
def change_track(self, tl_track, on_error_step=1): def change_track(self, tl_track, on_error_step=1):
""" """

View File

@ -23,7 +23,7 @@ class TracklistController(object):
self._shuffled = [] self._shuffled = []
### Properties # Properties
def get_tl_tracks(self): def get_tl_tracks(self):
return self._tl_tracks[:] return self._tl_tracks[:]
@ -136,7 +136,7 @@ class TracklistController(object):
Playback continues after current song. Playback continues after current song.
""" """
### Methods # Methods
def index(self, tl_track): def index(self, tl_track):
""" """

View File

@ -68,7 +68,7 @@ class MpdDispatcher(object):
else: else:
return response return response
### Filter: catch MPD ACK errors # Filter: catch MPD ACK errors
def _catch_mpd_ack_errors_filter(self, request, response, filter_chain): def _catch_mpd_ack_errors_filter(self, request, response, filter_chain):
try: try:
@ -78,7 +78,7 @@ class MpdDispatcher(object):
mpd_ack_error.index = self.command_list_index mpd_ack_error.index = self.command_list_index
return [mpd_ack_error.get_mpd_ack()] return [mpd_ack_error.get_mpd_ack()]
### Filter: authenticate # Filter: authenticate
def _authenticate_filter(self, request, response, filter_chain): def _authenticate_filter(self, request, response, filter_chain):
if self.authenticated: if self.authenticated:
@ -94,7 +94,7 @@ class MpdDispatcher(object):
else: else:
raise exceptions.MpdPermissionError(command=command_name) raise exceptions.MpdPermissionError(command=command_name)
### Filter: command list # Filter: command list
def _command_list_filter(self, request, response, filter_chain): def _command_list_filter(self, request, response, filter_chain):
if self._is_receiving_command_list(request): if self._is_receiving_command_list(request):
@ -117,7 +117,7 @@ class MpdDispatcher(object):
self.command_list_index is not None and self.command_list_index is not None and
request != 'command_list_end') request != 'command_list_end')
### Filter: idle # Filter: idle
def _idle_filter(self, request, response, filter_chain): def _idle_filter(self, request, response, filter_chain):
if self._is_currently_idle() and not self._noidle.match(request): if self._is_currently_idle() and not self._noidle.match(request):
@ -140,7 +140,7 @@ class MpdDispatcher(object):
def _is_currently_idle(self): def _is_currently_idle(self):
return bool(self.context.subscriptions) return bool(self.context.subscriptions)
### Filter: add OK # Filter: add OK
def _add_ok_filter(self, request, response, filter_chain): def _add_ok_filter(self, request, response, filter_chain):
response = self._call_next_filter(request, response, filter_chain) response = self._call_next_filter(request, response, filter_chain)
@ -151,7 +151,7 @@ class MpdDispatcher(object):
def _has_error(self, response): def _has_error(self, response):
return response and response[-1].startswith('ACK') return response and response[-1].startswith('ACK')
### Filter: call handler # Filter: call handler
def _call_handler_filter(self, request, response, filter_chain): def _call_handler_filter(self, request, response, filter_chain):
try: try:

View File

@ -34,7 +34,7 @@ def enableoutput(context, outputid):
# TODO: implement and test # TODO: implement and test
#@protocol.commands.add('toggleoutput', outputid=protocol.UINT) # @protocol.commands.add('toggleoutput', outputid=protocol.UINT)
def toggleoutput(context, outputid): def toggleoutput(context, outputid):
""" """
*musicpd.org, audio output section:* *musicpd.org, audio output section:*

View File

@ -360,8 +360,8 @@ def swapid(context, tlid1, tlid2):
# TODO: add at least reflection tests before adding NotImplemented version # TODO: add at least reflection tests before adding NotImplemented version
#@protocol.commands.add( # @protocol.commands.add(
# 'prio', priority=protocol.UINT, position=protocol.RANGE) # 'prio', priority=protocol.UINT, position=protocol.RANGE)
def prio(context, priority, position): def prio(context, priority, position):
""" """
*musicpd.org, current playlist section:* *musicpd.org, current playlist section:*
@ -378,7 +378,7 @@ def prio(context, priority, position):
# TODO: add at least reflection tests before adding NotImplemented version # TODO: add at least reflection tests before adding NotImplemented version
#@protocol.commands.add('prioid') # @protocol.commands.add('prioid')
def prioid(context, *args): def prioid(context, *args):
""" """
*musicpd.org, current playlist section:* *musicpd.org, current playlist section:*
@ -391,7 +391,7 @@ def prioid(context, *args):
# TODO: add at least reflection tests before adding NotImplemented version # TODO: add at least reflection tests before adding NotImplemented version
#@protocol.commands.add('addtagid', tlid=protocol.UINT) # @protocol.commands.add('addtagid', tlid=protocol.UINT)
def addtagid(context, tlid, tag, value): def addtagid(context, tlid, tag, value):
""" """
*musicpd.org, current playlist section:* *musicpd.org, current playlist section:*
@ -407,7 +407,7 @@ def addtagid(context, tlid, tag, value):
# TODO: add at least reflection tests before adding NotImplemented version # TODO: add at least reflection tests before adding NotImplemented version
#@protocol.commands.add('cleartagid', tlid=protocol.UINT) # @protocol.commands.add('cleartagid', tlid=protocol.UINT)
def cleartagid(context, tlid, tag): def cleartagid(context, tlid, tag):
""" """
*musicpd.org, current playlist section:* *musicpd.org, current playlist section:*

View File

@ -550,7 +550,7 @@ def update(context, uri=None):
# TODO: add at least reflection tests before adding NotImplemented version # TODO: add at least reflection tests before adding NotImplemented version
#@protocol.commands.add('readcomments') # @protocol.commands.add('readcomments')
def readcomments(context, uri): def readcomments(context, uri):
""" """
*musicpd.org, music database section:* *musicpd.org, music database section:*

View File

@ -33,7 +33,7 @@ def crossfade(context, seconds):
# TODO: add at least reflection tests before adding NotImplemented version # TODO: add at least reflection tests before adding NotImplemented version
#@protocol.commands.add('mixrampdb') # @protocol.commands.add('mixrampdb')
def mixrampdb(context, decibels): def mixrampdb(context, decibels):
""" """
*musicpd.org, playback section:* *musicpd.org, playback section:*
@ -50,7 +50,7 @@ def mixrampdb(context, decibels):
# TODO: add at least reflection tests before adding NotImplemented version # TODO: add at least reflection tests before adding NotImplemented version
#@protocol.commands.add('mixrampdelay', seconds=protocol.UINT) # @protocol.commands.add('mixrampdelay', seconds=protocol.UINT)
def mixrampdelay(context, seconds): def mixrampdelay(context, seconds):
""" """
*musicpd.org, playback section:* *musicpd.org, playback section:*

View File

@ -155,13 +155,13 @@ class JsonRpcWrapper(object):
if not isinstance(request, dict): if not isinstance(request, dict):
raise JsonRpcInvalidRequestError( raise JsonRpcInvalidRequestError(
data='Request must be an object') data='Request must be an object')
if not 'jsonrpc' in request: if 'jsonrpc' not in request:
raise JsonRpcInvalidRequestError( raise JsonRpcInvalidRequestError(
data='"jsonrpc" member must be included') data='"jsonrpc" member must be included')
if request['jsonrpc'] != '2.0': if request['jsonrpc'] != '2.0':
raise JsonRpcInvalidRequestError( raise JsonRpcInvalidRequestError(
data='"jsonrpc" value must be "2.0"') data='"jsonrpc" value must be "2.0"')
if not 'method' in request: if 'method' not in request:
raise JsonRpcInvalidRequestError( raise JsonRpcInvalidRequestError(
data='"method" member must be included') data='"method" member must be included')
if not isinstance(request['method'], unicode): if not isinstance(request['method'], unicode):
@ -169,7 +169,7 @@ class JsonRpcWrapper(object):
data='"method" must be a string') data='"method" must be a string')
def _get_params(self, request): def _get_params(self, request):
if not 'params' in request: if 'params' not in request:
return [], {} return [], {}
params = request['params'] params = request['params']
if isinstance(params, list): if isinstance(params, list):

View File

@ -154,7 +154,7 @@ class AudioStateTest(unittest.TestCase):
self.audio._on_playbin_state_changed( self.audio._on_playbin_state_changed(
gst.STATE_PAUSED, gst.STATE_READY, gst.STATE_NULL) gst.STATE_PAUSED, gst.STATE_READY, gst.STATE_NULL)
# We never get the following call, so the logic must work without it # We never get the following call, so the logic must work without it
#self.audio._on_playbin_state_changed( # self.audio._on_playbin_state_changed(
# gst.STATE_READY, gst.STATE_NULL, gst.STATE_VOID_PENDING) # gst.STATE_READY, gst.STATE_NULL, gst.STATE_VOID_PENDING)
self.assertEqual(audio.PlaybackState.STOPPED, self.audio.state) self.assertEqual(audio.PlaybackState.STOPPED, self.audio.state)

View File

@ -1,4 +1,4 @@
#encoding: utf-8 # encoding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -559,7 +559,7 @@ class MusicDatabaseListTest(protocol.BaseTestCase):
self.sendRequest('list "foo"') self.sendRequest('list "foo"')
self.assertEqualResponse('ACK [2@0] {list} incorrect arguments') self.assertEqualResponse('ACK [2@0] {list} incorrect arguments')
### Artist # Artist
def test_list_artist_with_quotes(self): def test_list_artist_with_quotes(self):
self.sendRequest('list "artist"') self.sendRequest('list "artist"')
@ -619,7 +619,7 @@ class MusicDatabaseListTest(protocol.BaseTestCase):
self.assertNotInResponse('Artist: ') self.assertNotInResponse('Artist: ')
self.assertInResponse('OK') self.assertInResponse('OK')
### Albumartist # Albumartist
def test_list_albumartist_with_quotes(self): def test_list_albumartist_with_quotes(self):
self.sendRequest('list "albumartist"') self.sendRequest('list "albumartist"')
@ -682,7 +682,7 @@ class MusicDatabaseListTest(protocol.BaseTestCase):
self.assertNotInResponse('Performer: ') self.assertNotInResponse('Performer: ')
self.assertInResponse('OK') self.assertInResponse('OK')
### Composer # Composer
def test_list_composer_with_quotes(self): def test_list_composer_with_quotes(self):
self.sendRequest('list "composer"') self.sendRequest('list "composer"')
@ -745,7 +745,7 @@ class MusicDatabaseListTest(protocol.BaseTestCase):
self.assertNotInResponse('Performer: ') self.assertNotInResponse('Performer: ')
self.assertInResponse('OK') self.assertInResponse('OK')
### Performer # Performer
def test_list_performer_with_quotes(self): def test_list_performer_with_quotes(self):
self.sendRequest('list "performer"') self.sendRequest('list "performer"')
@ -808,7 +808,7 @@ class MusicDatabaseListTest(protocol.BaseTestCase):
self.assertNotInResponse('Performer: ') self.assertNotInResponse('Performer: ')
self.assertInResponse('OK') self.assertInResponse('OK')
### Album # Album
def test_list_album_with_quotes(self): def test_list_album_with_quotes(self):
self.sendRequest('list "album"') self.sendRequest('list "album"')
@ -879,7 +879,7 @@ class MusicDatabaseListTest(protocol.BaseTestCase):
self.assertNotInResponse('Album: ') self.assertNotInResponse('Album: ')
self.assertInResponse('OK') self.assertInResponse('OK')
### Date # Date
def test_list_date_with_quotes(self): def test_list_date_with_quotes(self):
self.sendRequest('list "date"') self.sendRequest('list "date"')
@ -934,7 +934,7 @@ class MusicDatabaseListTest(protocol.BaseTestCase):
self.assertNotInResponse('Date: ') self.assertNotInResponse('Date: ')
self.assertInResponse('OK') self.assertInResponse('OK')
### Genre # Genre
def test_list_genre_with_quotes(self): def test_list_genre_with_quotes(self):
self.sendRequest('list "genre"') self.sendRequest('list "genre"')

View File

@ -1,4 +1,4 @@
#encoding: utf-8 # encoding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -1,4 +1,4 @@
#encoding: utf-8 # encoding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals

View File

@ -13,7 +13,8 @@ class TrackMpdFormatTest(unittest.TestCase):
uri='a uri', uri='a uri',
artists=[Artist(name='an artist')], artists=[Artist(name='an artist')],
name='a name', name='a name',
album=Album(name='an album', num_tracks=13, album=Album(
name='an album', num_tracks=13,
artists=[Artist(name='an other artist')]), artists=[Artist(name='an other artist')]),
track_no=7, track_no=7,
composers=[Artist(name='a composer')], composers=[Artist(name='a composer')],