From 8756c2bff550c0c8f3b4625ee98c6e0c70b8640d Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Sun, 16 Feb 2014 23:17:46 +0100 Subject: [PATCH] review: Type fixing --- mopidy/mpd/protocol/__init__.py | 20 ++++++++++---------- mopidy/mpd/protocol/stickers.py | 1 - tests/mpd/protocol/test_music_db.py | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/mopidy/mpd/protocol/__init__.py b/mopidy/mpd/protocol/__init__.py index 7d009022..e24af565 100644 --- a/mopidy/mpd/protocol/__init__.py +++ b/mopidy/mpd/protocol/__init__.py @@ -29,7 +29,7 @@ VERSION = '0.17.0' def load_protocol_modules(): """ The protocol modules must be imported to get them registered in - :attr:`request_handlers` and :attr:`mpd_commands`. + :attr:`commands`. """ from . import ( # noqa audio_output, channels, command_list, connection, current_playlist, @@ -45,7 +45,7 @@ def INT(value): def UINT(value): - """Converts a value that matches \d+ into and integer.""" + """Converts a value that matches \d+ into an integer.""" if value is None: raise ValueError('None is not a valid integer') if not value.isdigit(): @@ -63,9 +63,9 @@ def BOOL(value): def RANGE(value): """Convert a single integer or range spec into a slice - `n` should become `slice(n, n+1)` - `n:` should become `slice(n, None)` - `n:m` should become `slice(n, m)` and `m > n` must hold + ``n`` should become ``slice(n, n+1)`` + ``n:`` should become ``slice(n, None)`` + ``n:m`` should become ``slice(n, m)`` and ``m > n`` must hold """ if ':' in value: start, stop = value.split(':', 1) @@ -95,10 +95,10 @@ class Commands(object): # TODO: consider removing auth_required and list_command in favour of # additional command instances to register in? def add(self, name, auth_required=True, list_command=True, **validators): - """Create a decorator that registers a handler + validation rules. + """Create a decorator that registers a handler and validation rules. - Additional keyword arguments are treated as converts/validators to - apply to tokens converting them to proper python types. + Additional keyword arguments are treated as converters/validators to + apply to tokens converting them to proper Python type`s. Requirements for valid handlers: @@ -127,7 +127,7 @@ class Commands(object): if len(args) > 1 and varargs: raise TypeError( - '*args may not be combined with regular argmuments') + '*args may not be combined with regular arguments') if not set(validators.keys()).issubset(args): raise TypeError('Validator for non-existent arg passed') @@ -157,7 +157,7 @@ class Commands(object): def call(self, tokens, context=None): """Find and run the handler registered for the given command. - If the handler was registered with any converters/validators there will + If the handler was registered with any converters/validators they will be run before calling the real handler. :param list tokens: List of tokens to process diff --git a/mopidy/mpd/protocol/stickers.py b/mopidy/mpd/protocol/stickers.py index e8718f1d..4d535423 100644 --- a/mopidy/mpd/protocol/stickers.py +++ b/mopidy/mpd/protocol/stickers.py @@ -22,7 +22,6 @@ def sticker(context, action, field, uri, name=None, value=None): Reads a sticker value for the specified object. - ``sticker set {TYPE} {URI} {NAME} {VALUE}`` Adds a sticker value to the specified object. If a sticker item diff --git a/tests/mpd/protocol/test_music_db.py b/tests/mpd/protocol/test_music_db.py index 6ea18caf..93e45a2e 100644 --- a/tests/mpd/protocol/test_music_db.py +++ b/tests/mpd/protocol/test_music_db.py @@ -323,7 +323,7 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.assertNotInResponse('file: dummy:/a') self.assertInResponse('OK') - def test_lsinfo_for_dir_does_not_self(self): + def test_lsinfo_for_dir_does_not_include_self(self): self.backend.library.dummy_browse_result = { 'dummy:/': [Ref.directory(uri='dummy:/foo', name='foo')], 'dummy:/foo': [Ref.track(uri='dummy:/a', name='a')]}