autopep8 with 120 chars line length on my modules

This commit is contained in:
Julien Veyssier 2013-03-16 01:39:35 +01:00
commit 5d923bc73b
39 changed files with 434 additions and 426 deletions

View file

@ -43,7 +43,8 @@ class ResultsPage(BasePage):
imgs = self.parser.select(div, 'img.recipe-image') imgs = self.parser.select(div, 'img.recipe-image')
if len(imgs) > 0: if len(imgs) > 0:
thumbnail_url = unicode(imgs[0].attrib.get('src', '')) thumbnail_url = unicode(imgs[0].attrib.get('src', ''))
short_description = unicode(' '.join(self.parser.select(div,'div.infos_column',1).text_content().split()).strip()) short_description = unicode(' '.join(self.parser.select(
div, 'div.infos_column', 1).text_content().split()).strip())
imgs_cost = self.parser.select(div, 'div.infos_column img') imgs_cost = self.parser.select(div, 'div.infos_column img')
cost_tot = len(imgs_cost) cost_tot = len(imgs_cost)
cost_on = 0 cost_on = 0

View file

@ -37,7 +37,8 @@ class AttilasubBrowser(BaseBrowser):
} }
def iter_subtitles(self, language, pattern): def iter_subtitles(self, language, pattern):
self.location('http://search.freefind.com/find.html?id=81131980&_charset_=&bcd=%%F7&scs=1&pageid=r&query=%s&mode=Find%%20pages%%20matching%%20ALL%%20words' % pattern.encode('utf-8')) self.location('http://search.freefind.com/find.html?id=81131980&_charset_=&bcd=%%F7&scs=1&pageid=r&query=%s&mode=Find%%20pages%%20matching%%20ALL%%20words' %
pattern.encode('utf-8'))
assert self.is_on_page(SearchPage) assert self.is_on_page(SearchPage)
return self.page.iter_subtitles(language, pattern) return self.page.iter_subtitles(language, pattern)

View file

@ -52,7 +52,8 @@ class ImdbBrowser(BaseBrowser):
for m in jres[cat]: for m in jres[cat]:
tdesc = unicode(m['title_description']) tdesc = unicode(m['title_description'])
if '<a' in tdesc and '>' in tdesc: if '<a' in tdesc and '>' in tdesc:
short_description = u'%s %s'%(tdesc.split('<')[0].strip(', '), tdesc.split('>')[1].split('<')[0]) short_description = u'%s %s' % (tdesc.split('<')[
0].strip(', '), tdesc.split('>')[1].split('<')[0])
else: else:
short_description = tdesc.strip(', ') short_description = tdesc.strip(', ')
movie = Movie(m['id'], latin2unicode(m['title'])) movie = Movie(m['id'], latin2unicode(m['title']))
@ -88,7 +89,8 @@ class ImdbBrowser(BaseBrowser):
yield person yield person
def get_movie(self, id): def get_movie(self, id):
res = self.readurl('http://imdbapi.org/?id=%s&type=json&plot=simple&episode=1&lang=en-US&aka=full&release=simple&business=0&tech=0' % id ) res = self.readurl(
'http://imdbapi.org/?id=%s&type=json&plot=simple&episode=1&lang=en-US&aka=full&release=simple&business=0&tech=0' % id)
if res is not None: if res is not None:
jres = json.loads(res) jres = json.loads(res)
else: else:

View file

@ -73,7 +73,8 @@ class TorrentPage(BasePage):
title = NotAvailable title = NotAvailable
size = NotAvailable size = NotAvailable
url = 'https://isohunt.com/download/%s/%s.torrent' % (id, id) url = 'https://isohunt.com/download/%s/%s.torrent' % (id, id)
title = unicode(self.parser.select(self.document.getroot(),'head > meta[name=title]',1).attrib.get('content','')) title = unicode(self.parser.select(
self.document.getroot(), 'head > meta[name=title]', 1).attrib.get('content', ''))
seed = NotAvailable seed = NotAvailable
leech = NotAvailable leech = NotAvailable
tip_id = "none" tip_id = "none"

View file

@ -42,7 +42,8 @@ class ResultsPage(BasePage):
link = self.parser.select(tds[1], 'div.m_search_titre_recette a', 1) link = self.parser.select(tds[1], 'div.m_search_titre_recette a', 1)
title = unicode(link.text) title = unicode(link.text)
id = link.attrib.get('href', '').replace('.aspx', '').replace('/recettes/recette_', '') id = link.attrib.get('href', '').replace('.aspx', '').replace('/recettes/recette_', '')
short_description = unicode(' '.join(self.parser.select(tds[1],'div.m_search_result_part4',1).text.strip().split('\n'))) short_description = unicode(' '.join(self.parser.select(tds[
1], 'div.m_search_result_part4', 1).text.strip().split('\n')))
recipe = Recipe(id, title) recipe = Recipe(id, title)
recipe.thumbnail_url = thumbnail_url recipe.thumbnail_url = thumbnail_url

View file

@ -41,7 +41,8 @@ class OpensubtitlesBrowser(BaseBrowser):
def iter_subtitles(self, language, pattern): def iter_subtitles(self, language, pattern):
lang = LANGUAGE_CONV[language] lang = LANGUAGE_CONV[language]
self.location('http://www.opensubtitles.org/search2/sublanguageid-%s/moviename-%s' % (lang,pattern.encode('utf-8'))) self.location('http://www.opensubtitles.org/search2/sublanguageid-%s/moviename-%s' % (
lang, pattern.encode('utf-8')))
assert self.is_on_page(SearchPage) or self.is_on_page(SubtitlesPage) or self.is_on_page(SubtitlePage) assert self.is_on_page(SearchPage) or self.is_on_page(SubtitlesPage) or self.is_on_page(SubtitlePage)
return self.page.iter_subtitles() return self.page.iter_subtitles()

View file

@ -62,7 +62,8 @@ class SeriePage(BasePage):
if amount > 0: if amount > 0:
my_lang_img = self.parser.select(last_table_line, 'img[alt=%s]' % language) my_lang_img = self.parser.select(last_table_line, 'img[alt=%s]' % language)
if len(my_lang_img) > 0: if len(my_lang_img) > 0:
url_current_season = self.browser.geturl().split('/')[-1].replace('tvshow','subtitle').replace('.html','-%s.html'%language) url_current_season = self.browser.geturl().split('/')[-1].replace(
'tvshow', 'subtitle').replace('.html', '-%s.html' % language)
self.browser.location(url_current_season) self.browser.location(url_current_season)
assert self.browser.is_on_page(SeasonPage) assert self.browser.is_on_page(SeasonPage)
yield self.browser.page.iter_subtitles() yield self.browser.page.iter_subtitles()