Fix formatting to new PEP8 version (1.6.2)

PEP8 1.6.2 (2015-02-15):
- added check for breaking around a binary operator

This caused Travis to fail on "W503 line break before binary operator"
This commit is contained in:
Tom Jaspers 2015-02-16 18:21:56 +01:00
parent d70a82449e
commit 12ecb2ce35
5 changed files with 12 additions and 13 deletions

View file

@ -602,11 +602,11 @@ class Dumper(yaml.SafeDumper):
for item_key, item_value in mapping:
node_key = self.represent_data(item_key)
node_value = self.represent_data(item_value)
if not (isinstance(node_key, yaml.ScalarNode)
and not node_key.style):
if not (isinstance(node_key, yaml.ScalarNode) and
not node_key.style):
best_style = False
if not (isinstance(node_value, yaml.ScalarNode)
and not node_value.style):
if not (isinstance(node_value, yaml.ScalarNode) and
not node_value.style):
best_style = False
value.append((node_key, node_value))
if flow_style is None:

View file

@ -309,8 +309,8 @@ class Parser(object):
# A non-special character. Skip to the next special
# character, treating the interstice as literal text.
next_pos = (
self.special_char_re.search(self.string[self.pos:]).start()
+ self.pos
self.special_char_re.search(
self.string[self.pos:]).start() + self.pos
)
text_parts.append(self.string[self.pos:next_pos])
self.pos = next_pos

View file

@ -166,8 +166,8 @@ class MPDStats(object):
else:
rolling = (rating + (1.0 - rating) / 2.0)
stable = (play_count + 1.0) / (play_count + skip_count + 2.0)
return (self.rating_mix * stable
+ (1.0 - self.rating_mix) * rolling)
return (self.rating_mix * stable +
(1.0 - self.rating_mix) * rolling)
def get_item(self, path):
"""Return the beets item related to path.

View file

@ -82,9 +82,8 @@ setup(
'unidecode',
'musicbrainzngs>=0.4',
'pyyaml',
]
+ (['colorama'] if (sys.platform == 'win32') else [])
+ (['ordereddict'] if sys.version_info < (2, 7, 0) else []),
] + (['colorama'] if (sys.platform == 'win32') else []) +
(['ordereddict'] if sys.version_info < (2, 7, 0) else []),
tests_require=[
'beautifulsoup4',

View file

@ -968,8 +968,8 @@ class ShowChangeTest(_common.TestCase):
self.items[0].title = u''
self.items[0].path = u'/path/to/caf\xe9.mp3'.encode('utf8')
msg = re.sub(r' +', ' ', self._show_change())
self.assertTrue(u'caf\xe9.mp3 -> the title' in msg
or u'caf.mp3 ->' in msg)
self.assertTrue(u'caf\xe9.mp3 -> the title' in msg or
u'caf.mp3 ->' in msg)
class PathFormatTest(_common.TestCase):