pep8 fixes

This commit is contained in:
Tomas Groth 2015-10-19 23:32:26 +01:00
parent 7470205185
commit b4669e0bf6

View File

@ -28,7 +28,7 @@ from http.cookiejar import CookieJar
from urllib.parse import urlencode from urllib.parse import urlencode
from urllib.request import HTTPCookieProcessor, URLError, build_opener from urllib.request import HTTPCookieProcessor, URLError, build_opener
from html.parser import HTMLParser from html.parser import HTMLParser
if sys.version_info > (3,4): if sys.version_info > (3, 4):
from html import unescape from html import unescape
@ -132,7 +132,7 @@ class SongSelectImport(object):
if not search_results: if not search_results:
break break
for result in search_results: for result in search_results:
if sys.version_info > (3,4): if sys.version_info > (3, 4):
song = { song = {
'title': unescape(result.find('h3').string), 'title': unescape(result.find('h3').string),
'authors': [unescape(author.string) for author in result.find_all('li')], 'authors': [unescape(author.string) for author in result.find_all('li')],
@ -177,7 +177,7 @@ class SongSelectImport(object):
if callback: if callback:
callback() callback()
song['copyright'] = '/'.join([li.string for li in song_page.find('ul', 'copyright').find_all('li')]) song['copyright'] = '/'.join([li.string for li in song_page.find('ul', 'copyright').find_all('li')])
if sys.version_info > (3,4): if sys.version_info > (3, 4):
song['copyright'] = unescape(song['copyright']) song['copyright'] = unescape(song['copyright'])
else: else:
song['copyright'] = self.html_parser.unescape(song['copyright']) song['copyright'] = self.html_parser.unescape(song['copyright'])
@ -193,12 +193,12 @@ class SongSelectImport(object):
else: else:
verse['lyrics'] += '\n' verse['lyrics'] += '\n'
verse['lyrics'] = verse['lyrics'].strip(' \n\r\t') verse['lyrics'] = verse['lyrics'].strip(' \n\r\t')
if sys.version_info > (3,4): if sys.version_info > (3, 4):
song['verses'].append(unescape(verse)) song['verses'].append(unescape(verse))
else: else:
song['verses'].append(self.html_parser.unescape(verse)) song['verses'].append(self.html_parser.unescape(verse))
for counter, author in enumerate(song['authors']): for counter, author in enumerate(song['authors']):
if sys.version_info > (3,4): if sys.version_info > (3, 4):
song['authors'][counter] = unescape(author) song['authors'][counter] = unescape(author)
else: else:
song['authors'][counter] = self.html_parser.unescape(author) song['authors'][counter] = self.html_parser.unescape(author)