From 13961abd16f2a693c8b8fbc545ca6f63aee8d4d5 Mon Sep 17 00:00:00 2001
From: Kovid Goyal
Date: Sat, 13 Apr 2019 07:49:43 +0530
Subject: [PATCH] Also check python files using python 3 flake8
---
recipes/al_monitor.recipe | 4 +-
recipes/ambito_financiero.recipe | 2 +-
recipes/american_thinker.recipe | 2 +-
recipes/apple_daily.recipe | 4 +-
recipes/appledaily_tw.recipe | 4 +-
recipes/berlin_policy_journal.recipe | 2 +-
recipes/big_oven.recipe | 2 +-
recipes/birmingham_evening_mail.recipe | 2 +-
recipes/camera_di_commercio_di_bari.recipe | 1 +
recipes/cdrinfo_pl.recipe | 2 +-
recipes/cnetjapan.recipe | 4 +-
recipes/cnetjapan_digital.recipe | 5 +-
recipes/cnetjapan_release.recipe | 5 +-
recipes/daily_mirror.recipe | 2 +-
recipes/democracy_journal.recipe | 2 +-
recipes/detroit_news.recipe | 2 +-
recipes/dobreprogamy.recipe | 2 +-
recipes/dunyahalleri_haftaninozeti.recipe | 4 +-
recipes/ecogeek.recipe | 2 +-
recipes/economist.recipe | 4 +-
recipes/economist_free.recipe | 4 +-
recipes/film_web.recipe | 2 +-
recipes/first_things.recipe | 2 +-
recipes/gazeta_wyborcza.recipe | 2 +-
recipes/good_to_know.recipe | 2 +-
recipes/granta.recipe | 6 +-
recipes/guardian.recipe | 2 +-
recipes/heavy_metal_it.recipe | 1 +
recipes/houston_chronicle.recipe | 2 +-
recipes/jazzpress.recipe | 2 +-
recipes/juve_la_stampa.recipe | 1 +
recipes/lega_nerd.recipe | 2 +
recipes/list_apart.recipe | 2 +-
recipes/ming_pao.recipe | 2 +-
recipes/ming_pao_toronto.recipe | 2 +-
recipes/ming_pao_vancouver.recipe | 2 +-
recipes/modoros.recipe | 4 +-
recipes/money_pl.recipe | 2 +-
recipes/navegalo.recipe | 1 +
recipes/newsweek_polska.recipe | 8 +-
recipes/non_leggerlo.recipe | 2 +
recipes/office_space.recipe | 4 +-
recipes/oreilly_premium.recipe | 2 +-
recipes/ourdailybread.recipe | 2 +-
recipes/pagina_12_print_ed.recipe | 2 +-
recipes/pambianco.recipe | 2 +
recipes/popscience.recipe | 2 +-
recipes/readitlater.recipe | 2 +-
recipes/rebelion.recipe | 2 +-
recipes/respekt_magazine.recipe | 4 +-
recipes/revista_muy.recipe | 4 +-
recipes/singtaohk.recipe | 2 +-
recipes/sol_haber.recipe | 4 +-
recipes/tanuki.recipe | 2 +-
recipes/the_age.recipe | 2 +-
recipes/thestar.recipe | 1 +
recipes/times_online.recipe | 2 +-
recipes/vignette.recipe | 1 +
recipes/zaobao.recipe | 8 +-
setup/check.py | 10 +-
src/calibre/customize/zipplugin.py | 2 +-
src/calibre/db/backend.py | 59 +++++++---
src/calibre/db/locking.py | 16 +--
src/calibre/db/tests/main.py | 1 +
src/calibre/db/tests/reading.py | 11 ++
src/calibre/devices/hanlin/driver.py | 4 +-
src/calibre/devices/kobo/driver.py | 1 -
src/calibre/devices/mtp/unix/driver.py | 4 +-
src/calibre/devices/prst1/driver.py | 2 +-
src/calibre/devices/usbms/device.py | 2 +-
src/calibre/devices/winusb.py | 2 +-
src/calibre/ebooks/comic/__init__.py | 1 +
src/calibre/ebooks/conversion/__init__.py | 1 +
src/calibre/ebooks/djvu/djvu.py | 15 +--
src/calibre/ebooks/djvu/djvubzzdec.py | 4 +-
src/calibre/ebooks/epub/cfi/parse.py | 4 +-
src/calibre/ebooks/lit/maps/html.py | 8 +-
src/calibre/ebooks/lrf/html/color_map.py | 6 +-
src/calibre/ebooks/lrf/pylrs/pylrf.py | 4 +-
src/calibre/ebooks/lrf/pylrs/pylrs.py | 2 +-
src/calibre/ebooks/metadata/docx.py | 3 +-
src/calibre/ebooks/metadata/opf3_test.py | 2 +-
src/calibre/ebooks/metadata/sources/amazon.py | 4 +-
src/calibre/ebooks/metadata/sources/cli.py | 6 +-
src/calibre/ebooks/mobi/__init__.py | 3 +-
src/calibre/ebooks/mobi/debug/mobi6.py | 18 ++--
src/calibre/ebooks/mobi/langcodes.py | 102 +++++++++---------
src/calibre/ebooks/mobi/writer8/skeleton.py | 6 +-
.../ebooks/oeb/display/test-cfi/run.py | 2 +-
src/calibre/ebooks/oeb/polish/parsing.py | 2 +-
src/calibre/ebooks/oeb/polish/tests/main.py | 1 +
src/calibre/ebooks/pdb/__init__.py | 4 +-
src/calibre/ebooks/pdf/pageoptions.py | 2 +
src/calibre/ebooks/readability/cleaners.py | 1 +
src/calibre/ebooks/readability/debug.py | 1 +
src/calibre/ebooks/readability/readability.py | 2 +-
src/calibre/ebooks/rtf/preprocess.py | 4 +-
src/calibre/ebooks/rtf2xml/get_char_map.py | 3 +-
src/calibre/ebooks/rtf2xml/paragraphs.py | 6 +-
src/calibre/gui2/dbus_export/gtk.py | 12 +--
src/calibre/gui2/device.py | 6 +-
.../gui2/device_drivers/mtp_folder_browser.py | 2 +-
.../device_drivers/tabbed_device_config.py | 2 +-
src/calibre/gui2/dialogs/authors_edit.py | 2 +-
src/calibre/gui2/dialogs/choose_format.py | 2 +-
src/calibre/gui2/dialogs/comments_dialog.py | 1 +
src/calibre/gui2/dialogs/duplicates.py | 2 +-
src/calibre/gui2/font_family_chooser.py | 2 +-
src/calibre/gui2/metadata/pdf_covers.py | 2 +-
src/calibre/gui2/preferences/device_debug.py | 1 +
src/calibre/gui2/preferences/sending.py | 2 +-
.../gui2/preferences/texture_chooser.py | 2 +-
src/calibre/gui2/store/loader.py | 2 +-
.../gui2/store/stores/amazon_au_plugin.py | 2 +-
.../gui2/store/stores/amazon_ca_plugin.py | 2 +-
.../gui2/store/stores/amazon_de_plugin.py | 2 +-
.../gui2/store/stores/amazon_es_plugin.py | 2 +-
.../gui2/store/stores/amazon_fr_plugin.py | 2 +-
.../gui2/store/stores/amazon_in_plugin.py | 2 +-
.../gui2/store/stores/amazon_it_plugin.py | 2 +-
.../gui2/store/stores/amazon_plugin.py | 2 +-
.../gui2/store/stores/amazon_uk_plugin.py | 2 +-
.../gui2/store/stores/google_books_plugin.py | 2 +-
.../gui2/store/stores/gutenberg_plugin.py | 2 +-
src/calibre/gui2/store/stores/kobo_plugin.py | 2 +-
.../gui2/store/stores/manybooks_plugin.py | 2 +-
.../gui2/tweak_book/completion/worker.py | 2 +-
.../gui2/tweak_book/editor/__init__.py | 3 +
src/calibre/gui2/tweak_book/editor/help.py | 2 +
.../gui2/tweak_book/editor/smarts/python.py | 1 +
src/calibre/gui2/viewer/position.py | 2 +-
src/calibre/library/database.py | 15 ++-
src/calibre/library/sqlite.py | 48 ++++++---
src/calibre/srv/pre_activated.py | 8 +-
src/calibre/srv/sendfile.py | 1 +
src/calibre/utils/Zeroconf.py | 1 +
src/calibre/utils/__init__.py | 2 +-
src/calibre/utils/certgen.py | 4 +-
src/calibre/utils/fonts/sfnt/common.py | 4 +-
src/calibre/utils/fonts/sfnt/subset.py | 28 ++---
src/calibre/utils/https.py | 2 +-
src/calibre/utils/icu.py | 2 +-
src/calibre/utils/ip_routing.py | 1 +
src/calibre/utils/ipc/worker.py | 2 +-
src/calibre/utils/iphlpapi.py | 4 +-
src/calibre/utils/short_uuid.py | 1 +
src/calibre/utils/smartypants.py | 6 +-
src/calibre/utils/smtp.py | 2 +-
src/calibre/utils/smtplib.py | 4 +-
src/calibre/utils/socket_inheritance.py | 3 +-
src/calibre/utils/wmf/parse.py | 2 +-
src/calibre/utils/zipfile.py | 4 +-
src/calibre/web/fetch/utils.py | 1 +
src/polyglot/builtins.py | 7 ++
154 files changed, 409 insertions(+), 308 deletions(-)
diff --git a/recipes/al_monitor.recipe b/recipes/al_monitor.recipe
index 0067f9ed2f..99b1ca2c76 100644
--- a/recipes/al_monitor.recipe
+++ b/recipes/al_monitor.recipe
@@ -1,6 +1,6 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
-from __future__ import print_function
+from __future__ import print_function, unicode_literals
__license__ = 'GPL v3'
__copyright__ = '2014, spswerling'
'''
@@ -162,7 +162,7 @@ class AlMonitor(BasicNewsRecipe):
def scrape_article_date(self, soup):
for span in soup.findAll('span'):
txt = self.text(span)
- rgx = re.compile(unicode(r'Posted ([a-zA-Z]+ \d\d?, \d\d\d\d).*'))
+ rgx = re.compile(r'Posted ([a-zA-Z]+ \d\d?, \d\d\d\d).*')
hit = rgx.match(txt)
if hit:
return self.date_from_string(txt)
diff --git a/recipes/ambito_financiero.recipe b/recipes/ambito_financiero.recipe
index 5718401e8f..e7605163b7 100644
--- a/recipes/ambito_financiero.recipe
+++ b/recipes/ambito_financiero.recipe
@@ -126,7 +126,7 @@ class Ambito_Financiero(BasicNewsRecipe):
cfind = smallsoup.find('div', id="contenido_data")
if cfind:
p.append(cfind)
- return unicode(soup)
+ return type(u'')(soup)
return raw_html
def cleanup(self):
diff --git a/recipes/american_thinker.recipe b/recipes/american_thinker.recipe
index ef022451c5..2917f2f322 100644
--- a/recipes/american_thinker.recipe
+++ b/recipes/american_thinker.recipe
@@ -34,7 +34,7 @@ class AmericanThinker(BasicNewsRecipe):
namespaceHTMLElements=False)
for x in root.xpath('''descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), ' article_body ') and (@class and contains(concat(' ', normalize-space(@class), ' '), ' bottom '))]'''): # noqa
x.getparent().remove(x)
- return etree.tostring(root, encoding=unicode)
+ return etree.tostring(root, encoding='unicode')
feeds = [(u'http://feeds.feedburner.com/americanthinker'),
(u'http://feeds.feedburner.com/AmericanThinkerBlog')
diff --git a/recipes/apple_daily.recipe b/recipes/apple_daily.recipe
index ebf7c33330..eaf284ab0e 100644
--- a/recipes/apple_daily.recipe
+++ b/recipes/apple_daily.recipe
@@ -161,7 +161,7 @@ class AppleDaily(BasicNewsRecipe):
article_titles.append(force_unicode(a.title, 'utf-8'))
mi.comments = self.description
- if not isinstance(mi.comments, unicode):
+ if not isinstance(mi.comments, type(u'')):
mi.comments = mi.comments.decode('utf-8', 'replace')
mi.comments += ('\n\n' + _('Articles in this issue: ') + '\n' +
'\n\n'.join(article_titles))
@@ -272,7 +272,7 @@ class AppleDaily(BasicNewsRecipe):
elem = BeautifulSoup(translatedTempl).find('div')
body.insert(len(body.contents), elem)
with open(last, 'wb') as fi:
- fi.write(unicode(soup).encode('utf-8'))
+ fi.write(type(u'')(soup).encode('utf-8'))
if len(feeds) == 0:
raise Exception('All feeds are empty, aborting.')
diff --git a/recipes/appledaily_tw.recipe b/recipes/appledaily_tw.recipe
index 700ee4c7f1..6964ed0191 100644
--- a/recipes/appledaily_tw.recipe
+++ b/recipes/appledaily_tw.recipe
@@ -104,7 +104,7 @@ class AppledailyTW(BasicNewsRecipe):
]
def preprocess_raw_html(self, raw_html, url):
- raw_html = re.sub(unicode(r'
.*?<\/a>'), '', raw_html)
raw_html = re.sub(
- unicode(r'(.*?)[\\s]+\|.*<\/title>', r'\1<\/title>'), raw_html)
+ (r'(.*?)[\\s]+\|.*<\/title>', r'\1<\/title>'), raw_html)
return raw_html
diff --git a/recipes/berlin_policy_journal.recipe b/recipes/berlin_policy_journal.recipe
index 9e832c90a5..b820a9f00c 100644
--- a/recipes/berlin_policy_journal.recipe
+++ b/recipes/berlin_policy_journal.recipe
@@ -85,7 +85,7 @@ class BerlinPolicyJournal(BasicNewsRecipe):
div.find('h3', {'class': 'entry-title'}).a)
article_url = div.find(
'h3', {'class': 'entry-title'}).a['href']
- article_date = unicode(time.strftime(
+ article_date = type(u'')(time.strftime(
' [%a, %d %b %H:%M]', timestamp))
article_desc = self.tag_to_string(
div.find('div', {'class': 'i-summary'}).p)
diff --git a/recipes/big_oven.recipe b/recipes/big_oven.recipe
index 4e1d1b48a3..cc0ebdb543 100644
--- a/recipes/big_oven.recipe
+++ b/recipes/big_oven.recipe
@@ -47,7 +47,7 @@ class BigOven(BasicNewsRecipe):
preprocess_regexps = [
(re.compile(r'Want detailed nutrition information?', re.DOTALL), lambda match: ''),
- (re.compile('\(You could win \$100 in our ', re.DOTALL), lambda match: ''),
+ (re.compile(r'\(You could win \$100 in our ', re.DOTALL), lambda match: ''),
]
def preprocess_html(self, soup):
diff --git a/recipes/birmingham_evening_mail.recipe b/recipes/birmingham_evening_mail.recipe
index b7cef45085..98d4fb38cf 100644
--- a/recipes/birmingham_evening_mail.recipe
+++ b/recipes/birmingham_evening_mail.recipe
@@ -60,7 +60,7 @@ class AdvancedUserRecipe1306097511(BasicNewsRecipe):
'http://images.icnetwork.co.uk/upl/birm')})
cov = str(cov)
cov2 = re.findall(
- 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', cov)
+ r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', cov)
cov = str(cov2)
cov = cov[2:len(cov) - 2]
diff --git a/recipes/camera_di_commercio_di_bari.recipe b/recipes/camera_di_commercio_di_bari.recipe
index 343291b749..f81bbea2a3 100644
--- a/recipes/camera_di_commercio_di_bari.recipe
+++ b/recipes/camera_di_commercio_di_bari.recipe
@@ -13,6 +13,7 @@ class AdvancedUserRecipe1331729727(BasicNewsRecipe):
feeds = [(u'Camera di Commercio di Bari',
u'http://feed43.com/4715147488845101.xml')]
+
__license__ = 'GPL v3'
__copyright__ = '2012, faber1971'
__version__ = 'v1.00'
diff --git a/recipes/cdrinfo_pl.recipe b/recipes/cdrinfo_pl.recipe
index 23b5178e7d..9fca8ce8af 100644
--- a/recipes/cdrinfo_pl.recipe
+++ b/recipes/cdrinfo_pl.recipe
@@ -22,7 +22,7 @@ class cdrinfo(BasicNewsRecipe):
remove_empty_feeds = True
remove_javascript = True
remove_attributes = ['style', 'onmouseover']
- preprocess_regexps = [(re.compile(u']*?>Uprzejmie prosimy o przestrzeganie netykiety.+?www\.gravatar\.com
\.
', re.DOTALL), lambda match: ''),
+ preprocess_regexps = [(re.compile(u']*?>Uprzejmie prosimy o przestrzeganie netykiety.+?www\\.gravatar\\.com\\.
', re.DOTALL), lambda match: ''),
(re.compile(u']*?>.{,2}
', re.DOTALL), lambda match: '')]
ignore_duplicate_articles = {'title', 'url'}
diff --git a/recipes/cnetjapan.recipe b/recipes/cnetjapan.recipe
index fa4494fc99..20d12fa56d 100644
--- a/recipes/cnetjapan.recipe
+++ b/recipes/cnetjapan.recipe
@@ -16,11 +16,11 @@ class CNetJapan(BasicNewsRecipe):
remove_javascript = True
preprocess_regexps = [
- (re.compile(unicode(r'.*