Various pylint fixes

This commit is contained in:
Thomas Adamcik 2010-04-29 20:37:22 +02:00
parent 53bc3cec6a
commit 0bcda9920b
7 changed files with 15 additions and 12 deletions

View File

@ -176,7 +176,8 @@ class BaseCurrentPlaylistController(object):
assert start >= 0, 'start must be at least zero' assert start >= 0, 'start must be at least zero'
assert end <= len(tracks), 'end can not be larger than playlist length' assert end <= len(tracks), 'end can not be larger than playlist length'
assert to_position >= 0, 'to_position must be at least zero' assert to_position >= 0, 'to_position must be at least zero'
assert to_position <= len(tracks), 'to_position can not be larger than playlist length' assert to_position <= len(tracks), 'to_position can not be larger ' + \
'than playlist length'
new_tracks = tracks[:start] + tracks[end:] new_tracks = tracks[:start] + tracks[end:]
for track in tracks[start:end]: for track in tracks[start:end]:
@ -218,7 +219,8 @@ class BaseCurrentPlaylistController(object):
assert start >= 0, 'start must be at least zero' assert start >= 0, 'start must be at least zero'
if end is not None: if end is not None:
assert end <= len(tracks), 'end can not be larger than playlist length' assert end <= len(tracks), 'end can not be larger than ' + \
'playlist length'
before = tracks[:start or 0] before = tracks[:start or 0]
shuffled = tracks[start:end] shuffled = tracks[start:end]

View File

@ -37,7 +37,7 @@ class DenonMixer(BaseMixer):
self._lock = Lock() self._lock = Lock()
def _get_volume(self): def _get_volume(self):
self._lock.acquire(); self._lock.acquire()
self.ensure_open_device() self.ensure_open_device()
self._device.write('MV?\r') self._device.write('MV?\r')
vol = str(self._device.readline()[2:4]) vol = str(self._device.readline()[2:4])

View File

@ -17,7 +17,7 @@ class OsaMixer(BaseMixer):
and (int(time.time() - self._last_update) < self.CACHE_TTL)) and (int(time.time() - self._last_update) < self.CACHE_TTL))
def _get_volume(self): def _get_volume(self):
if not self._valid_cache(): if not self._valid_cache():
try: try:
self._cache = int(Popen( self._cache = int(Popen(
['osascript', '-e', ['osascript', '-e',

View File

@ -18,10 +18,10 @@ class ImmutableObject(object):
raise AttributeError('Object is immutable.') raise AttributeError('Object is immutable.')
def __hash__(self): def __hash__(self):
sum = 0 hash_sum = 0
for key,value in self.__dict__.items(): for key, value in self.__dict__.items():
sum += hash(key) + hash(value) hash_sum += hash(key) + hash(value)
return sum return hash_sum
def __eq__(self, other): def __eq__(self, other):
if not isinstance(other, self.__class__): if not isinstance(other, self.__class__):

View File

@ -643,7 +643,7 @@ class MpdFrontend(object):
- capitalizes the type argument. - capitalizes the type argument.
""" """
type = type.lower() type = type.lower()
pass # TODO # TODO
@handle_pattern(r'^listall "(?P<uri>[^"]+)"') @handle_pattern(r'^listall "(?P<uri>[^"]+)"')
def _music_db_listall(self, uri): def _music_db_listall(self, uri):

View File

@ -26,7 +26,8 @@ BACKENDS = (
#: The log format used on the console. See #: The log format used on the console. See
#: http://docs.python.org/library/logging.html#formatter-objects for details on #: http://docs.python.org/library/logging.html#formatter-objects for details on
#: the format. #: the format.
CONSOLE_LOG_FORMAT = u'%(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n %(message)s' CONSOLE_LOG_FORMAT = u'%(levelname)-8s %(asctime)s' + \
' [%(process)d:%(threadName)s] %(name)s\n %(message)s'
#: Protocol frontend to use. Default:: #: Protocol frontend to use. Default::
#: #:

View File

@ -130,8 +130,8 @@ def parse_m3u(file_path):
if line.startswith('file://'): if line.startswith('file://'):
uris.append(line) uris.append(line)
else: else:
file = os.path.join(folder, line) path = os.path.join(folder, line)
path = urllib.pathname2url(file.encode('utf-8')) path = urllib.pathname2url(path.encode('utf-8'))
uris.append('file://' + path) uris.append('file://' + path)
return uris return uris