diff --git a/manual/conf.py b/manual/conf.py index 35841a1f8e..98ac86e9ae 100644 --- a/manual/conf.py +++ b/manual/conf.py @@ -23,8 +23,9 @@ from setup import __appname__, __version__ sys.path.append(base) -import calibre.utils.img as cimg import custom + +import calibre.utils.img as cimg from calibre.utils.localization import localize_website_link del sys.path[0] diff --git a/manual/custom.py b/manual/custom.py index 55c5d43632..ee8f429cdd 100644 --- a/manual/custom.py +++ b/manual/custom.py @@ -299,7 +299,7 @@ def render_options(cmd, groups, options_header=True, add_program=True, header_le def mark_options(raw): - raw = re.sub(r'(\s+)--(\s+)', u'\\1``--``\\2', raw) + raw = re.sub(r'(\s+)--(\s+)', r'\1``--``\2', raw) def sub(m): opt = m.group() diff --git a/manual/epub.py b/manual/epub.py index c3cf010f3d..9fa088bc78 100644 --- a/manual/epub.py +++ b/manual/epub.py @@ -8,13 +8,13 @@ __docformat__ = 'restructuredtext en' import os +from sphinx.builders.epub3 import Epub3Builder as EpubBuilder + from calibre.ebooks.oeb.base import OPF from calibre.ebooks.oeb.polish.check.links import UnreferencedResource, check_links from calibre.ebooks.oeb.polish.container import OEB_DOCS, get_container from calibre.ebooks.oeb.polish.pretty import pretty_html_tree, pretty_opf from calibre.utils.imghdr import identify -from sphinx.builders.epub3 import Epub3Builder as EpubBuilder - from polyglot.builtins import iteritems diff --git a/manual/plugin_examples/editor_demo/main.py b/manual/plugin_examples/editor_demo/main.py index 1262c8720e..fecdc4dd91 100644 --- a/manual/plugin_examples/editor_demo/main.py +++ b/manual/plugin_examples/editor_demo/main.py @@ -7,14 +7,15 @@ __copyright__ = '2014, Kovid Goyal ' import re +from css_parser.css import CSSRule +from qt.core import QAction, QInputDialog + from calibre import force_unicode from calibre.ebooks.oeb.polish.container import OEB_DOCS, OEB_STYLES, serialize from calibre.gui2 import error_dialog # The base class that all tools must inherit from from calibre.gui2.tweak_book.plugin import Tool -from css_parser.css import CSSRule -from qt.core import QAction, QInputDialog class DemoTool(Tool): diff --git a/manual/plugin_examples/interface_demo/config.py b/manual/plugin_examples/interface_demo/config.py index 0dd8c8a473..53b3a6bbe4 100644 --- a/manual/plugin_examples/interface_demo/config.py +++ b/manual/plugin_examples/interface_demo/config.py @@ -6,9 +6,10 @@ __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal ' __docformat__ = 'restructuredtext en' -from calibre.utils.config import JSONConfig from qt.core import QHBoxLayout, QLabel, QLineEdit, QWidget +from calibre.utils.config import JSONConfig + # This is where all preferences for this plugin will be stored # Remember that this name (i.e. plugins/interface_demo) is also # in a global namespace, so make it as unique as possible. diff --git a/manual/plugin_examples/interface_demo/main.py b/manual/plugin_examples/interface_demo/main.py index a8dd3e658e..c3c35f714f 100644 --- a/manual/plugin_examples/interface_demo/main.py +++ b/manual/plugin_examples/interface_demo/main.py @@ -12,9 +12,10 @@ if False: # You do not need this code in your plugins get_icons = get_resources = None -from calibre_plugins.interface_demo.config import prefs from qt.core import QDialog, QLabel, QMessageBox, QPushButton, QVBoxLayout +from calibre_plugins.interface_demo.config import prefs + class DemoDialog(QDialog): diff --git a/pyproject.toml b/pyproject.toml index 168d649cfb..63d17ab66b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,24 +4,35 @@ requires-python = ">=3.8" [tool.ruff] line-length = 160 target-version = 'py38' -builtins = ['_'] - -[tool.ruff.lint] -ignore = ['E741', 'E402', 'E722', 'E401'] -select = ['E', 'F', 'I'] - -[tool.ruff.lint.per-file-ignores] -"src/calibre/ebooks/unihandecode/unicodepoints.py" = ["E501"] -"src/qt/__init__.py" = ["E501"] +builtins = ['_', 'I', 'P'] +include = ['*.py', '*.recipe'] +exclude = [ + "*_ui.py", + "bypy/*", + "setup/*", + "src/css_selectors/*", + "src/polyglot/*", + "src/templite/*", + "src/tinycss/*", +] [tool.ruff.format] quote-style = 'single' +[tool.ruff.lint] +ignore = ['E402', 'E722', 'E741', 'E401'] +select = ['E', 'F', 'I', 'W'] + +[tool.ruff.lint.per-file-ignores] +"src/calibre/ebooks/unihandecode/*codepoints.py" = ['E501', 'W191'] +"src/qt/*.py" = ['I'] +"src/qt/*.pyi" = ['I'] + [tool.ruff.lint.isort] detect-same-package = true -extra-standard-library = ['aes', 'elementmaker', 'encodings'] -known-first-party = ["calibre_extensions", 'polyglot'] -known-third-party = ["qt"] +extra-standard-library = ["aes", "elementmaker", "encodings"] +known-first-party = ["calibre_extensions", "calibre_plugins", "polyglot"] +known-third-party = ["odf", "qt", "templite", "tinycss", "css_selectors"] relative-imports-order = "closest-to-furthest" split-on-trailing-comma = false section-order = ['__python__', "future", "standard-library", "third-party", "first-party", "local-folder"] diff --git a/recipes/1843.recipe b/recipes/1843.recipe index 25d07f2145..df4b16f452 100644 --- a/recipes/1843.recipe +++ b/recipes/1843.recipe @@ -7,12 +7,13 @@ from collections import defaultdict from datetime import datetime, timedelta from urllib.parse import quote, urlencode +from html5_parser import parse +from lxml import etree + from calibre import replace_entities from calibre.ebooks.BeautifulSoup import NavigableString, Tag from calibre.ptempfile import PersistentTemporaryFile from calibre.web.feeds.news import BasicNewsRecipe -from html5_parser import parse -from lxml import etree use_archive = True diff --git a/recipes/american_thinker.recipe b/recipes/american_thinker.recipe index 8e68e7fde6..eb2277a226 100644 --- a/recipes/american_thinker.recipe +++ b/recipes/american_thinker.recipe @@ -4,9 +4,10 @@ __copyright__ = '2010, Walt Anthony ' www.americanthinker.com ''' import html5lib +from lxml import etree + from calibre.utils.cleantext import clean_xml_chars from calibre.web.feeds.news import BasicNewsRecipe -from lxml import etree class AmericanThinker(BasicNewsRecipe): diff --git a/recipes/amspec.recipe b/recipes/amspec.recipe index f7880d49c5..35b59d8e1e 100644 --- a/recipes/amspec.recipe +++ b/recipes/amspec.recipe @@ -4,9 +4,10 @@ __copyright__ = '2009-2010, Darko Miletic ' spectator.org ''' -from calibre.web.feeds.news import BasicNewsRecipe from css_selectors import Select +from calibre.web.feeds.news import BasicNewsRecipe + class TheAmericanSpectator(BasicNewsRecipe): title = 'The American Spectator' diff --git a/recipes/before_we_go.recipe b/recipes/before_we_go.recipe index 205e833a9f..062a02d62e 100644 --- a/recipes/before_we_go.recipe +++ b/recipes/before_we_go.recipe @@ -7,7 +7,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class BeforeWeGo(BasicNewsRecipe): - title = 'Before We Go' + title = 'Before We Go' __author__ = 'bugmen00t' description = 'Before We Go Blog is a collective of Fantasy, Sci-Fi and Graphic Novel fans from around the world, passionate about providing awesome, enjoyable reviews for anyone who loves a good book!' # noqa publisher = 'BEFOREWEGOBLOG' diff --git a/recipes/berfreunde_blog.recipe b/recipes/berfreunde_blog.recipe index d4d297fcd6..997588ecd8 100644 --- a/recipes/berfreunde_blog.recipe +++ b/recipes/berfreunde_blog.recipe @@ -14,7 +14,7 @@ class bergfreunde_blog(BasicNewsRecipe): max_articles_per_feed = 100 # clean up the mess auto_cleanup = True - # what's this? + # what's this? description = 'Blog der Bergfreunde Seite (Online Händler für Bergsport)' publisher = 'https://www.bergfreunde.de/ueber-die-bergfreunde/' language = 'de' @@ -31,4 +31,4 @@ class bergfreunde_blog(BasicNewsRecipe): feeds = [ ('Bergfreunde', 'https://www.bergfreunde.de/blog/feed'), - ] \ No newline at end of file + ] diff --git a/recipes/business_standard.recipe b/recipes/business_standard.recipe index ecd0acb24d..4e961240f6 100644 --- a/recipes/business_standard.recipe +++ b/recipes/business_standard.recipe @@ -3,9 +3,10 @@ import json from datetime import datetime -from calibre.web.feeds.news import BasicNewsRecipe from html5_parser import parse +from calibre.web.feeds.news import BasicNewsRecipe + class BusinessStandard(BasicNewsRecipe): title = 'Business Standard' @@ -97,9 +98,9 @@ class BusinessStandard(BasicNewsRecipe): date = (datetime.fromtimestamp(int(data['publishDate']))).strftime('%b %d, %Y | %I:%M %p') authors = [] - if 'articleMappedMultipleAuthors' in data: + if 'articleMappedMultipleAuthors' in data: for aut in data['articleMappedMultipleAuthors']: - authors.append(data['articleMappedMultipleAuthors'][str(aut)]) + authors.append(data['articleMappedMultipleAuthors'][str(aut)]) auth = '

' + ', '.join(authors) + ' | ' + data['placeName'] + ' | ' + date + '

' if 'featuredImageObj' in data: diff --git a/recipes/caravan_magazine.recipe b/recipes/caravan_magazine.recipe index 3de9e663f7..115424802d 100644 --- a/recipes/caravan_magazine.recipe +++ b/recipes/caravan_magazine.recipe @@ -3,9 +3,10 @@ import json from urllib.parse import quote, urlparse -from calibre.web.feeds.news import BasicNewsRecipe from mechanize import Request +from calibre.web.feeds.news import BasicNewsRecipe + def absurl(x): if x.startswith('//'): diff --git a/recipes/cato.recipe b/recipes/cato.recipe index b83c89dedc..c2d7332f17 100644 --- a/recipes/cato.recipe +++ b/recipes/cato.recipe @@ -5,7 +5,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class CATOInstitute(BasicNewsRecipe): title = u'The CATO Institute' - description = "The Cato Institute is a public policy research organization — a think tank — \ + description = "The Cato Institute is a public policy research organization — a think tank — \ dedicated to the principles of individual liberty, limited government, free markets and peace.\ Its scholars and analysts conduct independent, nonpartisan research on a wide range of policy issues." __author__ = '_reader' diff --git a/recipes/cherta.recipe b/recipes/cherta.recipe index 5585b2d32f..8496a543c4 100644 --- a/recipes/cherta.recipe +++ b/recipes/cherta.recipe @@ -5,7 +5,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class Cherta(BasicNewsRecipe): - title = '\u0427\u0435\u0440\u0442\u0430' + title = '\u0427\u0435\u0440\u0442\u0430' __author__ = 'bugmen00t' description = ' \u0418\u043D\u0442\u0435\u0440\u0435\u0441\u043D\u044B\u0435, \u0432\u0430\u0436\u043D\u044B\u0435 \u0438 \u0433\u043B\u0443\u0431\u043E\u043A\u0438\u0435 \u0442\u0435\u043A\u0441\u0442\u044B \u043F\u0440\u043E \u043D\u0430\u0441\u0438\u043B\u0438\u0435 \u0438 \u043D\u0435\u0440\u0430\u0432\u0435\u043D\u0441\u0442\u0432\u043E \u0432 \u0420\u043E\u0441\u0441\u0438\u0438.' # noqa publisher = 'cherta.media' diff --git a/recipes/courrierinternational.recipe b/recipes/courrierinternational.recipe index 63c6d800cf..5aa05d55dc 100644 --- a/recipes/courrierinternational.recipe +++ b/recipes/courrierinternational.recipe @@ -58,14 +58,14 @@ class CourrierInternational(BasicNewsRecipe): .info-date, .info-reserved { font-style: italic; - font-size: 0.9em; + font-size: 0.9em; display: block; } .strapline { font-size: 1.17em; font-weight: bold; - margin: 0.67em 0; + margin: 0.67em 0; line-height: 1.2; } ''' diff --git a/recipes/deccan_herald.recipe b/recipes/deccan_herald.recipe index bcf6bb12c2..81525ea8fa 100644 --- a/recipes/deccan_herald.recipe +++ b/recipes/deccan_herald.recipe @@ -18,7 +18,6 @@ class herald(BasicNewsRecipe): keep_only_tags = [ classes('article-title article-author__name'), dict(name='div', attrs={'id':'main-content'}) - ] remove_tags = [ diff --git a/recipes/deutsche_welle_bs.recipe b/recipes/deutsche_welle_bs.recipe index a81ee32935..d1d022f2a4 100644 --- a/recipes/deutsche_welle_bs.recipe +++ b/recipes/deutsche_welle_bs.recipe @@ -16,10 +16,10 @@ class DeutscheWelle_bs(BasicNewsRecipe): remove_empty_feeds = True remove_javascript = True masthead_url = 'http://www.dw-world.de/skins/std/channel1/pics/dw_logo1024.gif' - + ignore_duplicate_articles = {'title', 'url'} remove_attributes = ['height', 'width', 'style'] - + keep_only_tags = [ dict(name='article') ] diff --git a/recipes/deutsche_welle_de.recipe b/recipes/deutsche_welle_de.recipe index 500e0bb9cc..985b43e59c 100644 --- a/recipes/deutsche_welle_de.recipe +++ b/recipes/deutsche_welle_de.recipe @@ -40,7 +40,7 @@ class DeutscheWelle(BasicNewsRecipe): dict(attrs={'data-tracking-name':'sharing-icons-inline'}), classes('kicker advertisement vjs-wrapper') ] - + # watch out https://www.dw.com/de/service/rss/s-9773 for description of possible rss feeds feeds = [ ('Nachrichten', 'http://rss.dw.com/xml/rss-de-news'), @@ -53,7 +53,7 @@ class DeutscheWelle(BasicNewsRecipe): ('Kultur und Leben', 'http://rss.dw.com/xml/rss-de-cul'), ('Thema des Tages', 'http://rss.dw.com/xml/rss-de-top'), ] - + def preprocess_html(self, soup): for img in soup.findAll('img', srcset=True): img['src'] = img['srcset'].split()[6] diff --git a/recipes/deutsche_welle_en.recipe b/recipes/deutsche_welle_en.recipe index 634eab9b84..0003a5d90a 100644 --- a/recipes/deutsche_welle_en.recipe +++ b/recipes/deutsche_welle_en.recipe @@ -15,7 +15,7 @@ class DeutscheWelle_en(BasicNewsRecipe): remove_empty_feeds = True ignore_duplicate_articles = {'title', 'url'} remove_attributes = ['height', 'width', 'style'] - + recipe_specific_options = { 'days': { 'short': 'Oldest article to download from this news source. In days ', @@ -29,17 +29,17 @@ class DeutscheWelle_en(BasicNewsRecipe): d = self.recipe_specific_options.get('days') if d and isinstance(d, str): self.oldest_article = float(d) - + keep_only_tags = [ dict(name='article') ] - + remove_tags = [ dict(name=['footer', 'source']), dict(attrs={'data-tracking-name':'sharing-icons-inline'}), classes('kicker advertisement vjs-wrapper') ] - + feeds = [ ('World', 'http://rss.dw.de/rdf/rss-en-world'), ('Germany', 'http://rss.dw.de/rdf/rss-en-ger'), @@ -51,7 +51,7 @@ class DeutscheWelle_en(BasicNewsRecipe): ('Asia', 'http://rss.dw.de/rdf/rss-en-asia'), ('Top Stories', 'http://rss.dw-world.de/rdf/rss-en-top'), ] - + def preprocess_html(self, soup): for img in soup.findAll('img', srcset=True): img['src'] = img['srcset'].split()[6] diff --git a/recipes/deutsche_welle_pt.recipe b/recipes/deutsche_welle_pt.recipe index d2e5082854..b6f2edda16 100644 --- a/recipes/deutsche_welle_pt.recipe +++ b/recipes/deutsche_welle_pt.recipe @@ -19,7 +19,7 @@ class DeutscheWelle_pt(BasicNewsRecipe): remove_javascript = True ignore_duplicate_articles = {'title', 'url'} remove_attributes = ['height', 'width', 'style'] - + recipe_specific_options = { 'days': { 'short': 'Oldest article to download from this news source. In days ', diff --git a/recipes/deutsche_welle_ru.recipe b/recipes/deutsche_welle_ru.recipe index 38df7884b1..140722b3be 100644 --- a/recipes/deutsche_welle_ru.recipe +++ b/recipes/deutsche_welle_ru.recipe @@ -16,7 +16,7 @@ class DeutscheWelle(BasicNewsRecipe): remove_empty_feeds = True ignore_duplicate_articles = {'title', 'url'} remove_attributes = ['height', 'width', 'style'] - + recipe_specific_options = { 'days': { 'short': 'Oldest article to download from this news source. In days ', @@ -30,7 +30,7 @@ class DeutscheWelle(BasicNewsRecipe): d = self.recipe_specific_options.get('days') if d and isinstance(d, str): self.oldest_article = float(d) - + def preprocess_html(self, soup): for img in soup.findAll('img', srcset=True): img['src'] = img['srcset'].split()[6] @@ -39,7 +39,7 @@ class DeutscheWelle(BasicNewsRecipe): keep_only_tags = [ dict(name='article') ] - + remove_tags = [ dict(name=['footer', 'source']), dict(attrs={'data-tracking-name':'sharing-icons-inline'}), diff --git a/recipes/dev_ua.recipe b/recipes/dev_ua.recipe index 0eb8c482a5..ed778d908f 100644 --- a/recipes/dev_ua.recipe +++ b/recipes/dev_ua.recipe @@ -7,7 +7,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class WiComix(BasicNewsRecipe): - title = 'dev.ua' + title = 'dev.ua' __author__ = 'bugmen00t' publisher = '\u0422\u041E\u0412 \u00AB\u0414\u0435\u0432 \u0423\u043A\u0440\u0430\u0457\u043D\u0430\u00BB' category = 'news' diff --git a/recipes/discover_magazine_monthly.recipe b/recipes/discover_magazine_monthly.recipe index 2910de99b5..56db6633b9 100644 --- a/recipes/discover_magazine_monthly.recipe +++ b/recipes/discover_magazine_monthly.recipe @@ -16,6 +16,7 @@ try: except ImportError: from cookielib import Cookie import mechanize + from calibre.web.feeds.news import BasicNewsRecipe diff --git a/recipes/dr_dk.recipe b/recipes/dr_dk.recipe index cc3ad50025..4ab0a9726e 100644 --- a/recipes/dr_dk.recipe +++ b/recipes/dr_dk.recipe @@ -39,7 +39,7 @@ class DRNyheder(BasicNewsRecipe): publisher = 'DR Nyheder' description = 'Her finder du nyheder fra DR.' category = 'news, politics, money, culture, sport, science, Denmark' - publication_type = 'newspaper' + publication_type = 'newspaper' encoding = 'utf8' language = 'da' oldest_article = 4 # 2 might be best @@ -47,7 +47,7 @@ class DRNyheder(BasicNewsRecipe): no_stylesheets = True use_embedded_content = False auto_cleanup = False - remove_empty_feeds = True + remove_empty_feeds = True ignore_duplicate_articles = {'title', 'url'} simultaneous_downloads = 20 compress_news_images = True diff --git a/recipes/echo_moskvy.recipe b/recipes/echo_moskvy.recipe index 3689681ea5..303ca03858 100644 --- a/recipes/echo_moskvy.recipe +++ b/recipes/echo_moskvy.recipe @@ -4,7 +4,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class EchoMsk(BasicNewsRecipe): - title = '\u042D\u0425\u041E' + title = '\u042D\u0425\u041E' __author__ = 'bugmen00t' description = ('\u042D\u0425\u041E - \u043A\u0430\u043A \u043D\u0430 \u0441\u0442\u0430\u0440\u043E\u043C' ' \u0434\u043E\u0431\u0440\u043E\u043C \u0440\u0430\u0434\u0438\u043E') diff --git a/recipes/economist_espresso.recipe b/recipes/economist_espresso.recipe index 1c23907772..f976771790 100644 --- a/recipes/economist_espresso.recipe +++ b/recipes/economist_espresso.recipe @@ -53,7 +53,7 @@ class JSONHasNoContent(ValueError): def load_article_from_json(raw, root): - # open('/t/raw.json', 'w').write(raw) + # open('/t/raw.json', 'w').write(raw) data = json.loads(raw) body = root.xpath('//body')[0] article = E(body, 'article') diff --git a/recipes/epoch_times.recipe b/recipes/epoch_times.recipe index d0da409b37..26998ea5e3 100644 --- a/recipes/epoch_times.recipe +++ b/recipes/epoch_times.recipe @@ -42,7 +42,7 @@ class EpochTimes(BasicNewsRecipe): dict(name='img', attrs={'src':lambda x: x and x.endswith('svg')}) ] - # feeds can be found at https://www.theepochtimes.com/rssfeeds + # feeds can be found at https://www.theepochtimes.com/rssfeeds feeds = [ ('Special Series', 'https://feed.theepochtimes.com/health/special-series/feed'), ('US', 'https://feed.theepochtimes.com/us/feed'), diff --git a/recipes/esquire.recipe b/recipes/esquire.recipe index 8925ffcd0a..ab949ab052 100644 --- a/recipes/esquire.recipe +++ b/recipes/esquire.recipe @@ -5,9 +5,10 @@ www.esquire.com ''' from collections import defaultdict -from calibre.web.feeds.news import BasicNewsRecipe from css_selectors import Select +from calibre.web.feeds.news import BasicNewsRecipe + def absolutize(url): if url.startswith('/'): diff --git a/recipes/financial_times.recipe b/recipes/financial_times.recipe index 581ca3ab79..337f6ea949 100644 --- a/recipes/financial_times.recipe +++ b/recipes/financial_times.recipe @@ -4,9 +4,10 @@ import json import re from urllib.parse import quote +from html5_parser import parse + from calibre import browser from calibre.web.feeds.news import BasicNewsRecipe, classes -from html5_parser import parse class ft(BasicNewsRecipe): diff --git a/recipes/first_things.recipe b/recipes/first_things.recipe index b74538c7a0..c044afa125 100644 --- a/recipes/first_things.recipe +++ b/recipes/first_things.recipe @@ -7,9 +7,10 @@ __copyright__ = '2017, John Hutson ' firstthings.com ''' import html5lib -from calibre.web.feeds.news import BasicNewsRecipe from lxml import html +from calibre.web.feeds.news import BasicNewsRecipe + class FirstThings(BasicNewsRecipe): diff --git a/recipes/foreignaffairs.recipe b/recipes/foreignaffairs.recipe index 405d598fc7..c38b64fb46 100644 --- a/recipes/foreignaffairs.recipe +++ b/recipes/foreignaffairs.recipe @@ -4,9 +4,10 @@ import re import html5lib import mechanize -from calibre.web.feeds.news import BasicNewsRecipe, classes from lxml import html +from calibre.web.feeds.news import BasicNewsRecipe, classes + def as_article(source, log): url = source['url'] diff --git a/recipes/frontline.recipe b/recipes/frontline.recipe index 1a65aa2a03..f1a4d8af36 100644 --- a/recipes/frontline.recipe +++ b/recipes/frontline.recipe @@ -69,15 +69,15 @@ class Frontline(BasicNewsRecipe): issue_url = 'https://frontline.thehindu.com/magazine/issue/vol' + d soup = self.index_to_soup(issue_url) - + if cover := soup.find('div', attrs={'class':'magazine'}): self.cover_url = cover.find(**classes('sptar-image')).img['data-original'].replace('SQUARE_80', 'FREE_615') self.log('Cover ', self.cover_url) if desc := cover.find(**classes('sub-text')): self.description = self.tag_to_string(desc) - + feeds_dict = defaultdict(list) - + mag = soup.find(**classes('section-magazine')) for div in mag.findAll('div', attrs={'class':'content'}): a = div.find(**classes('title')).find('a') @@ -87,7 +87,7 @@ class Frontline(BasicNewsRecipe): if cat := div.find(**classes('label')): section = self.tag_to_string(cat) desc = '' - + if art := div.find(**classes('sub-text')): desc = self.tag_to_string(art) if auth := div.find(**classes('author')): diff --git a/recipes/google_news.recipe b/recipes/google_news.recipe index 39cc3aa62a..7eca31974a 100644 --- a/recipes/google_news.recipe +++ b/recipes/google_news.recipe @@ -20,9 +20,9 @@ class google_news_de(BasicNewsRecipe): cover_url = 'https://upload.wikimedia.org/wikipedia/commons/thumb/d/da/Google_News_icon.svg/500px-Google_News_icon.svg.png' # Author __author__ = 'Volker Heggemann, VoHe, unkn0wn' - # oldest article to download (in days) ---- can be edit by user + # oldest article to download (in days) ---- can be edit by user oldest_article = 1.25 - # describes itself, ---- can be edit by user + # describes itself, ---- can be edit by user max_articles_per_feed = 200 # speed up the download on fast computers be careful (I test max.20) # ---- can be edit by user @@ -31,7 +31,7 @@ class google_news_de(BasicNewsRecipe): description = u'Google News filter by your own recipe. Please read it in calibre software!' # What is the content of? category = u'NEWS' - # describes itself, ---- can be edit by user + # describes itself, ---- can be edit by user use_embedded_content = False remove_javascript = True # Removes empty feeds - why keep them!? @@ -39,7 +39,7 @@ class google_news_de(BasicNewsRecipe): # remove the rubbish (in ebook) auto_cleanup = True - + articles_are_obfuscated = True def get_obfuscated_article(self, url): @@ -65,7 +65,7 @@ class google_news_de(BasicNewsRecipe): return pt.name # now the content description and URL follows - # feel free to add, wipe out what you need ---- can be edit by user + # feel free to add, wipe out what you need ---- can be edit by user # def get_feeds(self): url = "https://geolocation-db.com/json" diff --git a/recipes/gorky.recipe b/recipes/gorky.recipe index 3177072fd1..e5e671449a 100644 --- a/recipes/gorky.recipe +++ b/recipes/gorky.recipe @@ -5,7 +5,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class Gorky(BasicNewsRecipe): - title = '\u0413\u043E\u0440\u044C\u043A\u0438\u0439' + title = '\u0413\u043E\u0440\u044C\u043A\u0438\u0439' __author__ = 'bugmen00t' description = '\u041D\u0435\u043A\u043E\u043C\u043C\u0435\u0440\u0447\u0435\u0441\u043A\u0438\u0439 \u043F\u0440\u043E\u0435\u043A\u0442 \u043E \u043A\u043D\u0438\u0433\u0430\u0445 \u0438 \u0447\u0442\u0435\u043D\u0438\u0438.' # noqa publisher = '\u0410\u041D\u041E "\u0426\u0435\u043D\u0442\u0440 \u043F\u043E \u0441\u043E\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044E \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044F \u043A\u0443\u043B\u044C\u0442\u0443\u0440\u044B \u0447\u0442\u0435\u043D\u0438\u044F \u0438 \u043A\u043D\u0438\u0433\u043E\u0438\u0437\u0434\u0430\u043D\u0438\u044F \u00AB\u0413\u043E\u0440\u044C\u043A\u0438\u0439 \u041C\u0435\u0434\u0438\u0430\u00BB"' # noqa diff --git a/recipes/gosc_full.recipe b/recipes/gosc_full.recipe index a611a10f2c..2f1752f5be 100644 --- a/recipes/gosc_full.recipe +++ b/recipes/gosc_full.recipe @@ -8,9 +8,10 @@ __copyright__ = '2011, Piotr Kontek, piotr.kontek@gmail.com \ import re import time -from calibre.web.feeds.news import BasicNewsRecipe from lxml import html +from calibre.web.feeds.news import BasicNewsRecipe + class GN(BasicNewsRecipe): __author__ = 'Piotr Kontek, Tomasz Długosz' diff --git a/recipes/gosc_niedzielny.recipe b/recipes/gosc_niedzielny.recipe index fa973b2535..773b25aefa 100644 --- a/recipes/gosc_niedzielny.recipe +++ b/recipes/gosc_niedzielny.recipe @@ -7,9 +7,10 @@ __copyright__ = '2011, Piotr Kontek, piotr.kontek@gmail.com \ import re -from calibre.web.feeds.news import BasicNewsRecipe from lxml import html +from calibre.web.feeds.news import BasicNewsRecipe + class GN(BasicNewsRecipe): __author__ = 'Piotr Kontek, Tomasz Długosz' diff --git a/recipes/hbr.recipe b/recipes/hbr.recipe index e3a441d814..4dcde07c4e 100644 --- a/recipes/hbr.recipe +++ b/recipes/hbr.recipe @@ -5,9 +5,10 @@ import re from collections import OrderedDict from urllib.parse import urlencode, urljoin +from mechanize import Request + from calibre import browser, random_user_agent from calibre.web.feeds.news import BasicNewsRecipe, classes -from mechanize import Request class HBR(BasicNewsRecipe): diff --git a/recipes/himal_southasian.recipe b/recipes/himal_southasian.recipe index 85188e0af9..f384bd40b6 100644 --- a/recipes/himal_southasian.recipe +++ b/recipes/himal_southasian.recipe @@ -2,9 +2,10 @@ # vim:fileencoding=utf-8 import json -from calibre.web.feeds.news import BasicNewsRecipe from html5_parser import parse +from calibre.web.feeds.news import BasicNewsRecipe + def get_story(story): str_type = story.get('type', '') diff --git a/recipes/hindutamil.recipe b/recipes/hindutamil.recipe index 9c1af06f90..bcd539d11c 100644 --- a/recipes/hindutamil.recipe +++ b/recipes/hindutamil.recipe @@ -15,10 +15,10 @@ class hindutamil(BasicNewsRecipe): language = 'ta' remove_attributes = ['style', 'height', 'width'] masthead_url = 'https://static.hindutamil.in/hindu/static/store/images/logo.png' - + def get_browser(self): - return BasicNewsRecipe.get_browser(self, user_agent='common_words/based') - + return BasicNewsRecipe.get_browser(self, user_agent='common_words/based') + keep_only_tags = [ classes('main-article') ] diff --git a/recipes/horizons.recipe b/recipes/horizons.recipe index f48d825f03..baa007e5fd 100644 --- a/recipes/horizons.recipe +++ b/recipes/horizons.recipe @@ -37,7 +37,7 @@ class horizons(BasicNewsRecipe): 'long': 'For example, https://www.cirsd.org/en/horizons/horizons-winter-2024--issue-no-25', } } - + def get_browser(self): return BasicNewsRecipe.get_browser(self, verify_ssl_certificates=False) diff --git a/recipes/hurriyet.recipe b/recipes/hurriyet.recipe index 80fb7548f7..26577b4faa 100644 --- a/recipes/hurriyet.recipe +++ b/recipes/hurriyet.recipe @@ -41,7 +41,7 @@ class Hurriyet(BasicNewsRecipe): keep_only_tags = [ # title {'class': 'news-detail-title'}, - # date + # date {'class': 'news-detail-text'}, # media {'class': 'news-media'}, diff --git a/recipes/hvg.recipe b/recipes/hvg.recipe index ab4692d367..a268c21054 100644 --- a/recipes/hvg.recipe +++ b/recipes/hvg.recipe @@ -1,7 +1,7 @@ ########################################################################## -# Description: http://hvg.hu/ RSS channel -# Author: Bigpapa (bigpapabig@hotmail.com) -# Date: 2011.12.20. - V1.1 +# Description: http://hvg.hu/ RSS channel +# Author: Bigpapa (bigpapabig@hotmail.com) +# Date: 2011.12.20. - V1.1 ########################################################################## from calibre.web.feeds.news import BasicNewsRecipe @@ -11,7 +11,7 @@ class hvg(BasicNewsRecipe): title = u'HVG' __author__ = 'Bigpapa' language = 'hu' - oldest_article = 5 # Hany napos legyen a legregebbi cikk amit leszedjen. + oldest_article = 5 # Hany napos legyen a legregebbi cikk amit leszedjen. # Az adott e-bookban tarolt cikkek feedenkenti maximalis szamat adja meg. max_articles_per_feed = 5 no_stylesheets = True diff --git a/recipes/inc42.recipe b/recipes/inc42.recipe index 254cd6b1ec..ec43ebdfbe 100644 --- a/recipes/inc42.recipe +++ b/recipes/inc42.recipe @@ -12,18 +12,18 @@ class inc42(BasicNewsRecipe): language = 'en_IN' remove_attributes = ['style', 'height', 'width'] masthead_url = 'https://omcdn.inc42.com/users/d0ffd8ffa0d2/images/4477fc48bee71659696918-color-black-1-e1576150264134.png?width=224' - + keep_only_tags = [ classes('entry-header entry-content'), ] - + remove_tags = [ dict(name='button'), classes('also-read slick-list slides-three common-card'), ] ignore_duplicate_articles = {'title', 'url'} - remove_empty_feeds = True + remove_empty_feeds = True def parse_index(self): index = 'https://inc42.com/' diff --git a/recipes/journalofaccountancy.recipe b/recipes/journalofaccountancy.recipe index 005d772e67..4415bcea1a 100644 --- a/recipes/journalofaccountancy.recipe +++ b/recipes/journalofaccountancy.recipe @@ -8,9 +8,10 @@ import json from contextlib import closing from time import sleep -from calibre.web.feeds.news import BasicNewsRecipe from mechanize import Request +from calibre.web.feeds.news import BasicNewsRecipe + def absolutize(url): if url.startswith('/'): diff --git a/recipes/kompiutierra.recipe b/recipes/kompiutierra.recipe index 333c9dc9d9..d34a60b365 100644 --- a/recipes/kompiutierra.recipe +++ b/recipes/kompiutierra.recipe @@ -38,4 +38,4 @@ class Computerra(BasicNewsRecipe): feeds = [( u'\u041A\u043E\u043C\u043F\u044C\u044E\u0442\u0435\u0440\u0440\u0430', 'https://www.computerra.ru/feed/' - )] \ No newline at end of file + )] diff --git a/recipes/le_gorafi.recipe b/recipes/le_gorafi.recipe index c8a4d4a7ab..ee3adcecce 100644 --- a/recipes/le_gorafi.recipe +++ b/recipes/le_gorafi.recipe @@ -26,7 +26,7 @@ class LeGorafi(BasicNewsRecipe): height: auto !important; } ''' - + keep_only_tags = [ dict(name='h1'), dict(name='img', attrs={'class': 'attachment- size- wp-post-image'}), @@ -36,16 +36,16 @@ class LeGorafi(BasicNewsRecipe): dict(name='div', attrs={'class': 'heateor_sss_sharing_container'}), ] feeds = ['http://www.legorafi.fr/feed/'] - + def preprocess_html(self, soup): for img in soup.findAll('img'): if 'svg' in img['src']: img.decompose() # Removes the tag entirely return soup - + def is_cover(article): return 'gorafi-magazine' in article.url - + def get_cover_url(self): feeds = BasicNewsRecipe.parse_feeds(self) for feed in feeds: @@ -55,12 +55,12 @@ class LeGorafi(BasicNewsRecipe): img = soup.select_one('#mvp-post-feat-img img') return img['data-lazy-src'] print("No cover found") - return None - + return None + def parse_feeds(self): feeds = BasicNewsRecipe.parse_feeds(self) for feed in feeds: for article in feed.articles: if LeGorafi.is_cover(article): feed.articles.remove(article) - return feeds \ No newline at end of file + return feeds diff --git a/recipes/le_monde.recipe b/recipes/le_monde.recipe index 72d90b77e6..42f4e8774e 100644 --- a/recipes/le_monde.recipe +++ b/recipes/le_monde.recipe @@ -129,11 +129,11 @@ class LeMonde(BasicNewsRecipe): dict(name=['footer', 'link', 'meta', 'svg', 'button', 'source']), dict(name='img', attrs={'class': ['article__author-picture']}), dict(name='section', attrs={'class': - [ - 'inread js-services-inread', 'catcher catcher--inline', 'inread inread--NL js-services-inread', - 'article__reactions', 'author', 'catcher', 'portfolio', 'services-inread' - ] - }) + [ + 'inread js-services-inread', 'catcher catcher--inline', 'inread inread--NL js-services-inread', + 'article__reactions', 'author', 'catcher', 'portfolio', 'services-inread' + ] + }) ] remove_attributes = [ diff --git a/recipes/linux_news_de.recipe b/recipes/linux_news_de.recipe index dd0c391482..24a36bc503 100644 --- a/recipes/linux_news_de.recipe +++ b/recipes/linux_news_de.recipe @@ -30,7 +30,7 @@ class AdvancedUserRecipe1591780224(BasicNewsRecipe): # remove the rubbish (in ebook) auto_cleanup = True # now the content description and URL follows - # feel free to add, wipe out what you need ---- can be edit by user + # feel free to add, wipe out what you need ---- can be edit by user # # some of this are double # diff --git a/recipes/mediapart.recipe b/recipes/mediapart.recipe index 11f5e17782..239e385c06 100644 --- a/recipes/mediapart.recipe +++ b/recipes/mediapart.recipe @@ -111,16 +111,17 @@ class Mediapart(BasicNewsRecipe): br['email'] = self.username br['password'] = self.password br.submit() - + return br def default_cover(self, cover_file): ''' Create a generic cover for recipes that don't have a cover ''' - from calibre.gui2 import ensure_app, load_builtin_fonts, pixmap_to_data from qt.core import QFont, QImage, QPainter, QPen, QRect, Qt + from calibre.gui2 import ensure_app, load_builtin_fonts, pixmap_to_data + def init_environment(): ensure_app() load_builtin_fonts() diff --git a/recipes/mit_technology_review.recipe b/recipes/mit_technology_review.recipe index d9f00e42c4..dc14af12e2 100644 --- a/recipes/mit_technology_review.recipe +++ b/recipes/mit_technology_review.recipe @@ -74,7 +74,7 @@ class MitTechnologyReview(BasicNewsRecipe): } def parse_index(self): - # for past editions, change the issue link below + # for past editions, change the issue link below issue = 'http://www.technologyreview.com/magazine/' d = self.recipe_specific_options.get('issue_url') if d and isinstance(d, str): diff --git a/recipes/moneycontrol.recipe b/recipes/moneycontrol.recipe index fa5ca524e4..98d7c15350 100644 --- a/recipes/moneycontrol.recipe +++ b/recipes/moneycontrol.recipe @@ -53,7 +53,7 @@ class MoneyControlRecipe(BasicNewsRecipe): index = 'https://www.moneycontrol.com/' business_sections = [ - 'markets', 'stocks', 'ipo', 'budget', 'banks', 'moneycontrol-research', 'economy', 'earnings', 'real-estate', + 'markets', 'stocks', 'ipo', 'budget', 'banks', 'moneycontrol-research', 'economy', 'earnings', 'real-estate', 'personal-finance', 'commodities', 'trade', 'companies' ] diff --git a/recipes/moscowtimes_en.recipe b/recipes/moscowtimes_en.recipe index ab69025ab4..9fca9a29c2 100644 --- a/recipes/moscowtimes_en.recipe +++ b/recipes/moscowtimes_en.recipe @@ -5,7 +5,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class MoscowTimes(BasicNewsRecipe): - title = 'The Moscow Times' + title = 'The Moscow Times' __author__ = 'bugmen00t' description = 'The Moscow Times is Russia’s leading, independent English-language media outlet. Our team of Russian and English journalists provide readers across the world with breaking news, engaging stories and balanced reporting about the largest country on Earth.' # noqa publisher = 'Tiamti LLC' diff --git a/recipes/my_dealz_de.recipe b/recipes/my_dealz_de.recipe index f9a349a505..d06b4e9baf 100644 --- a/recipes/my_dealz_de.recipe +++ b/recipes/my_dealz_de.recipe @@ -9,9 +9,9 @@ class MyDealzDE(BasicNewsRecipe): title = 'MyDealz' # Author __author__ = 'Volker Heggemann, VoHe' - # oldest article to download (in days) ---- can be edit by user + # oldest article to download (in days) ---- can be edit by user oldest_article = 5 - # describes itself, ---- can be edit by user + # describes itself, ---- can be edit by user max_articles_per_feed = 100 # Cover Picture cover_url = 'https://pbs.twimg.com/profile_images/817053687545741313/0wFqvfqC_400x400.jpg' @@ -24,9 +24,9 @@ class MyDealzDE(BasicNewsRecipe): publisher = u'https://www.mydealz.de' # What is the content of? category = u'Shopping' - # describes itself, ---- can be edit by user + # describes itself, ---- can be edit by user use_embedded_content = False - # describes itself, ---- can be edit by user + # describes itself, ---- can be edit by user language = 'de' # encoding of content. e.g. utf-8, None, ... # ---- can be edit by user @@ -39,7 +39,7 @@ class MyDealzDE(BasicNewsRecipe): # remove the rubbish (in ebook) auto_cleanup = True # now the content description and URL follows - # feel free to add, wipe out what you need ---- can be edit by user + # feel free to add, wipe out what you need ---- can be edit by user # # some of this are double # diff --git a/recipes/new_scientist_mag.recipe b/recipes/new_scientist_mag.recipe index 7984b24769..9aa04e4ecd 100644 --- a/recipes/new_scientist_mag.recipe +++ b/recipes/new_scientist_mag.recipe @@ -84,7 +84,7 @@ class NewScientist(BasicNewsRecipe): d = self.recipe_specific_options.get('issue') if d and isinstance(d, str): issue_url = 'https://www.newscientist.com/issue/' + d - + soup = self.index_to_soup(issue_url) div = soup.find('div', attrs={'class':'ThisWeeksMagazineHero__CoverInfo'}) tme = div.find(**classes('ThisWeeksMagazineHero__MagInfoHeading')) diff --git a/recipes/nol.recipe b/recipes/nol.recipe index b354e0e798..8f60ca86eb 100644 --- a/recipes/nol.recipe +++ b/recipes/nol.recipe @@ -1,7 +1,7 @@ ########################################################################## -# Description: http://nol.hu/ RSS channel -# Author: Bigpapa (bigpapabig@hotmail.com) -# Date: 2011.12.18. - V1.1 +# Description: http://nol.hu/ RSS channel +# Author: Bigpapa (bigpapabig@hotmail.com) +# Date: 2011.12.18. - V1.1 ########################################################################## from calibre.web.feeds.recipes import BasicNewsRecipe diff --git a/recipes/nrc.nl.recipe b/recipes/nrc.nl.recipe index 880f2b427d..a03fb6269e 100644 --- a/recipes/nrc.nl.recipe +++ b/recipes/nrc.nl.recipe @@ -4,9 +4,10 @@ import json import re from contextlib import closing -from calibre.web.feeds.recipes import BasicNewsRecipe from mechanize import Request +from calibre.web.feeds.recipes import BasicNewsRecipe + class NRC(BasicNewsRecipe): title = 'NRC' diff --git a/recipes/nzz_ger.recipe b/recipes/nzz_ger.recipe index fd16eac5f0..3c7a1c15fd 100644 --- a/recipes/nzz_ger.recipe +++ b/recipes/nzz_ger.recipe @@ -1,9 +1,10 @@ import json from datetime import datetime -from calibre.web.feeds.recipes import BasicNewsRecipe from mechanize import Request +from calibre.web.feeds.recipes import BasicNewsRecipe + class Nzz(BasicNewsRecipe): title = 'NZZ' diff --git a/recipes/ourdailybread.recipe b/recipes/ourdailybread.recipe index ac3785ae12..1bbb87f984 100644 --- a/recipes/ourdailybread.recipe +++ b/recipes/ourdailybread.recipe @@ -7,9 +7,10 @@ odb.org import uuid -from calibre.web.feeds.news import BasicNewsRecipe from lxml import html +from calibre.web.feeds.news import BasicNewsRecipe + class OurDailyBread(BasicNewsRecipe): title = 'Our Daily Bread' diff --git a/recipes/paperpaper.recipe b/recipes/paperpaper.recipe index 1c7d045c79..dbe6fc7c5f 100644 --- a/recipes/paperpaper.recipe +++ b/recipes/paperpaper.recipe @@ -7,7 +7,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class PaperPaper(BasicNewsRecipe): - title = '\u0411\u0443\u043C\u0430\u0433\u0430' + title = '\u0411\u0443\u043C\u0430\u0433\u0430' __author__ = 'bugmen00t' description = '\u0418\u0437\u0434\u0430\u043D\u0438\u0435 \u043E \u043F\u0440\u0435\u043A\u0440\u0430\u0441\u043D\u043E\u043C \u0433\u043E\u0440\u043E\u0434\u0435 \u0421\u0430\u043D\u043A\u0442-\u041F\u0435\u0442\u0435\u0440\u0431\u0443\u0440\u0433\u0435, \u0432 \u043A\u043E\u0442\u043E\u0440\u043E\u043C, \u043A\u043E\u043D\u0435\u0447\u043D\u043E, \u0434\u0430\u043B\u0435\u043A\u043E \u043D\u0435 \u0432\u0441\u0451 \u0438\u0434\u0435\u0430\u043B\u044C\u043D\u043E, \u2014 \u0438 \u043F\u043E\u044D\u0442\u043E\u043C\u0443 \u043C\u044B \u0437\u0430\u043D\u0438\u043C\u0430\u0435\u043C\u0441\u044F \u0436\u0443\u0440\u043D\u0430\u043B\u0438\u0441\u0442\u0438\u043A\u043E\u0439, \u0447\u0442\u043E\u0431\u044B \u043F\u0440\u0438\u0432\u043B\u0435\u043A\u0430\u0442\u044C \u0432\u043D\u0438\u043C\u0430\u043D\u0438\u0435 \u043A \u0432\u0430\u0436\u043D\u044B\u043C \u0434\u043B\u044F \u0432\u0441\u0435\u0445 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0430\u043C \u0438 \u0432\u043B\u0438\u044F\u0442\u044C \u043D\u0430 \u0438\u0445 \u0440\u0435\u0448\u0435\u043D\u0438\u0435.' # noqa publisher = '\u041A\u0438\u0440\u0438\u043B\u043B \u0410\u0440\u0442\u0451\u043C\u0435\u043D\u043A\u043E, \u0422\u0430\u0442\u044C\u044F\u043D\u0430 \u0418\u0432\u0430\u043D\u043E\u0432\u0430' # noqa diff --git a/recipes/parool.recipe b/recipes/parool.recipe index 4f19e35d39..fd674d1522 100644 --- a/recipes/parool.recipe +++ b/recipes/parool.recipe @@ -3,9 +3,10 @@ import json import uuid from contextlib import closing -from calibre.web.feeds.recipes import BasicNewsRecipe from mechanize import Request +from calibre.web.feeds.recipes import BasicNewsRecipe + class Parool(BasicNewsRecipe): title = 'Het Parool' diff --git a/recipes/phillosophy_now.recipe b/recipes/phillosophy_now.recipe index 14d044e489..21fa9ef565 100644 --- a/recipes/phillosophy_now.recipe +++ b/recipes/phillosophy_now.recipe @@ -33,7 +33,7 @@ class PhilosophyNow(BasicNewsRecipe): .articleImageCaption { font-size:small; text-align:center; } em, blockquote { color:#202020; } ''' - + recipe_specific_options = { 'issue': { 'short': 'Enter the Issue Number you want to download ', diff --git a/recipes/poligon.recipe b/recipes/poligon.recipe index 1a799888fb..acd9c4ff93 100644 --- a/recipes/poligon.recipe +++ b/recipes/poligon.recipe @@ -7,7 +7,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class Poligon(BasicNewsRecipe): - title = '\u041F\u043E\u043B\u0438\u0433\u043E\u043D' + title = '\u041F\u043E\u043B\u0438\u0433\u043E\u043D' __author__ = 'bugmen00t' description = '\u041D\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043C\u043E\u0435 \u0438\u043D\u0442\u0435\u0440\u043D\u0435\u0442-\u0438\u0437\u0434\u0430\u043D\u0438\u0435, \u0432\u044B\u043F\u0443\u0441\u043A\u0430\u0435\u043C\u043E\u0435 \u0436\u0443\u0440\u043D\u0430\u043B\u0438\u0441\u0442\u0430\u043C\u0438 \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u0438\u0445 \u0440\u043E\u0441\u0441\u0438\u0439\u0441\u043A\u0438\u0445 \u0438\u0437\u0434\u0430\u043D\u0438\u0439, \u043F\u043E\u0434\u0432\u0435\u0440\u0433\u0448\u0438\u0445\u0441\u044F \u0434\u0430\u0432\u043B\u0435\u043D\u0438\u044E \u0441\u043E \u0441\u0442\u043E\u0440\u043E\u043D\u044B \u0433\u043E\u0441\u0443\u0434\u0430\u0440\u0441\u0442\u0432\u0430. \u041F\u0438\u0448\u0435\u043C \u043E \u0420\u043E\u0441\u0441\u0438\u0438 \u0438 \u043D\u0435 \u0442\u043E\u043B\u044C\u043A\u043E.' # noqa publisher = 'poligon.media' diff --git a/recipes/presse_portal.recipe b/recipes/presse_portal.recipe index 71f398f87b..eda9430236 100644 --- a/recipes/presse_portal.recipe +++ b/recipes/presse_portal.recipe @@ -12,9 +12,9 @@ class PressePortalDE(BasicNewsRecipe): title = 'Presseportal DE' # Author __author__ = 'Volker Heggemann, VoHe' - # oldest article to download (in days) ---- can be edit by user + # oldest article to download (in days) ---- can be edit by user oldest_article = 1 - # describes itself, ---- can be edit by user + # describes itself, ---- can be edit by user max_articles_per_feed = 100 # speed up the download on fast computers be careful (I test max.20) # ---- can be edit by user @@ -29,9 +29,9 @@ class PressePortalDE(BasicNewsRecipe): publisher = u'Presseportal.de' # What is the content of? category = u'latest news, national Police, Germany' - # describes itself, ---- can be edit by user + # describes itself, ---- can be edit by user use_embedded_content = False - # describes itself, ---- can be edit by user + # describes itself, ---- can be edit by user language = 'de' # encoding of content. e.g. utf-8, None, ... # ---- can be edit by user @@ -44,7 +44,7 @@ class PressePortalDE(BasicNewsRecipe): # remove the rubbish (in ebook) auto_cleanup = True # now the content description and URL follows - # feel free to add, wipe out what you need ---- can be edit by user + # feel free to add, wipe out what you need ---- can be edit by user # # some of this are double # so if you load "Alle Ressort" you don't need "Wirtschaft, Finanzen, Politik, Vermischtes..." at all. diff --git a/recipes/pro_physik.recipe b/recipes/pro_physik.recipe index ab9474179c..c81ff56558 100644 --- a/recipes/pro_physik.recipe +++ b/recipes/pro_physik.recipe @@ -10,27 +10,27 @@ from calibre.web.feeds.recipes import BasicNewsRecipe class AdvancedUserRecipe1303841067(BasicNewsRecipe): title = u'Pro Physik' - __author__ = 'schuster, Armin Geller' + __author__ = 'schuster, Armin Geller' # AGE Upd. 2012-11-28, 2019-02-09, # 2019-02-18, 2024-02-11 # https://www.mobileread.com/forums/showthread.php?t=133184 - + oldest_article = 7 max_articles_per_feed = 100 no_stylesheets = True remove_javascript = True remove_empty_feeds = True - language = 'de_DE' - + language = 'de_DE' + # In case you want to assign a cover picture to this recipe. # Copy the file Pro_Physik.png to: # c:/Users/YOUR_USERNAME/AppData/Roaming/calibre/resources/images/news_covers/ # where YOUR_USERNAME needs to be replaced with your username. # Then remove # in front of cover_url and replace YOUR_USERNAME with your username as well - + # cover_url = file:///c:/Users/YOUR_USERNAME/AppData/Roaming/calibre/resources/images/news_covers/Pro_Physik.png - + extra_css = ''' h1 {font-size: 1.6em; text-align: left} h2, h3 {font-size: 1.3em;text-align: left} @@ -43,7 +43,7 @@ class AdvancedUserRecipe1303841067(BasicNewsRecipe): dict(name='article', attrs={'id':['story']}), dict(name='div', attrs={'class':['event-item view-mode-default']}) ] - + remove_tags = [ dict(name='ul', attrs={'class':["wj-share-buttons"]}), #Block social media ] @@ -51,4 +51,4 @@ class AdvancedUserRecipe1303841067(BasicNewsRecipe): feeds = [ (u'Nachrichten', u'https://pro-physik.de/rss/news/'), # (u'Veranstaltungen', u'https://pro-physik.de/rss/events/'), # AGe 2024-02-11 - ] \ No newline at end of file + ] diff --git a/recipes/prosleduet.recipe b/recipes/prosleduet.recipe index 6fbd9c0e98..e7ed9666b8 100644 --- a/recipes/prosleduet.recipe +++ b/recipes/prosleduet.recipe @@ -7,7 +7,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class ProSleduet(BasicNewsRecipe): - title = '\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0435\u043D\u0438\u0435 \u0441\u043B\u0435\u0434\u0443\u0435\u0442' + title = '\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0435\u043D\u0438\u0435 \u0441\u043B\u0435\u0434\u0443\u0435\u0442' __author__ = 'bugmen00t' description = ('\u0414\u0438\u0434\u0436\u0438\u0442\u0430\u043B-\u043F\u0440\u043E\u0435\u043A\u0442' ' \u0436\u0443\u0440\u043D\u0430\u043B\u0438\u0441\u0442\u043E\u0432' diff --git a/recipes/publico.recipe b/recipes/publico.recipe index f450f2629e..d79c9d28a2 100644 --- a/recipes/publico.recipe +++ b/recipes/publico.recipe @@ -9,7 +9,6 @@ publico.pt ''' from calibre.web.feeds.news import BasicNewsRecipe - from polyglot.urllib import urlencode diff --git a/recipes/queueacmorg.recipe b/recipes/queueacmorg.recipe index 8f5e523674..e58878f435 100644 --- a/recipes/queueacmorg.recipe +++ b/recipes/queueacmorg.recipe @@ -35,4 +35,4 @@ class QueueAcmOrg(BasicNewsRecipe): ) if len(imgs) > 0: self.cover_url = 'https://queue.acm.org/' + imgs[0]['src'] - return getattr(self, 'cover_url', self.cover_url) \ No newline at end of file + return getattr(self, 'cover_url', self.cover_url) diff --git a/recipes/radio_canada.recipe b/recipes/radio_canada.recipe index 60cd36f522..765c40920b 100644 --- a/recipes/radio_canada.recipe +++ b/recipes/radio_canada.recipe @@ -82,70 +82,70 @@ class RadioCanada(BasicNewsRecipe): # From the list situated at https://ici.radio-canada.ca/rss feeds = [ # Information - ('Grands titres', 'https://ici.radio-canada.ca/rss/4159'), - ('En continu', 'https://ici.radio-canada.ca/rss/1000524'), + ('Grands titres', 'https://ici.radio-canada.ca/rss/4159'), + ('En continu', 'https://ici.radio-canada.ca/rss/1000524'), # Thématiques - ('Alimentation', 'https://ici.radio-canada.ca/rss/7239'), - ('Art de vivre', 'https://ici.radio-canada.ca/rss/4163'), - ('Économie', 'https://ici.radio-canada.ca/rss/5717'), - ('Environnement', 'https://ici.radio-canada.ca/rss/92408'), - ('International', 'https://ici.radio-canada.ca/rss/96'), + ('Alimentation', 'https://ici.radio-canada.ca/rss/7239'), + ('Art de vivre', 'https://ici.radio-canada.ca/rss/4163'), + ('Économie', 'https://ici.radio-canada.ca/rss/5717'), + ('Environnement', 'https://ici.radio-canada.ca/rss/92408'), + ('International', 'https://ici.radio-canada.ca/rss/96'), ('Justice et faits divers', 'https://ici.radio-canada.ca/rss/92411'), - ('Politique', 'https://ici.radio-canada.ca/rss/4175'), - ('Santé', 'https://ici.radio-canada.ca/rss/4171'), - ('Science', 'https://ici.radio-canada.ca/rss/4165'), - ('Société', 'https://ici.radio-canada.ca/rss/7110'), - ('Techno', 'https://ici.radio-canada.ca/rss/4169'), + ('Politique', 'https://ici.radio-canada.ca/rss/4175'), + ('Santé', 'https://ici.radio-canada.ca/rss/4171'), + ('Science', 'https://ici.radio-canada.ca/rss/4165'), + ('Société', 'https://ici.radio-canada.ca/rss/7110'), + ('Techno', 'https://ici.radio-canada.ca/rss/4169'), # Sports - ('Grands titres', 'https://ici.radio-canada.ca/rss/771'), - ('Football', 'https://ici.radio-canada.ca/rss/1000057'), - ('Hockey', 'https://ici.radio-canada.ca/rss/1000056'), - ('Olympiques', 'https://ici.radio-canada.ca/rss/64852'), - ('Podium', 'https://ici.radio-canada.ca/rss/555082'), - ('Soccer', 'https://ici.radio-canada.ca/rss/1000058'), - ('Tennis', 'https://ici.radio-canada.ca/rss/1000059'), + ('Grands titres', 'https://ici.radio-canada.ca/rss/771'), + ('Football', 'https://ici.radio-canada.ca/rss/1000057'), + ('Hockey', 'https://ici.radio-canada.ca/rss/1000056'), + ('Olympiques', 'https://ici.radio-canada.ca/rss/64852'), + ('Podium', 'https://ici.radio-canada.ca/rss/555082'), + ('Soccer', 'https://ici.radio-canada.ca/rss/1000058'), + ('Tennis', 'https://ici.radio-canada.ca/rss/1000059'), # Arts - ('Grands Titres', 'https://ici.radio-canada.ca/rss/4167'), - ('Célébrités', 'https://ici.radio-canada.ca/rss/1000232'), - ('Cinéma', 'https://ici.radio-canada.ca/rss/1000229'), - ('Humour', 'https://ici.radio-canada.ca/rss/1000231'), - ('Livres', 'https://ici.radio-canada.ca/rss/1000083'), - ('Musique', 'https://ici.radio-canada.ca/rss/1000230'), - ('Télé', 'https://ici.radio-canada.ca/rss/1000233'), + ('Grands Titres', 'https://ici.radio-canada.ca/rss/4167'), + ('Célébrités', 'https://ici.radio-canada.ca/rss/1000232'), + ('Cinéma', 'https://ici.radio-canada.ca/rss/1000229'), + ('Humour', 'https://ici.radio-canada.ca/rss/1000231'), + ('Livres', 'https://ici.radio-canada.ca/rss/1000083'), + ('Musique', 'https://ici.radio-canada.ca/rss/1000230'), + ('Télé', 'https://ici.radio-canada.ca/rss/1000233'), # Régions - ('Abitibi-Témiscamingue', 'https://ici.radio-canada.ca/rss/5763'), - ('Alberta', 'https://ici.radio-canada.ca/rss/5767'), - ('Bas-Saint-Laurent', 'https://ici.radio-canada.ca/rss/35004'), - ('Colombie-Brittanique', 'https://ici.radio-canada.ca/rss/5769'), - ('Côte-Nord', 'https://ici.radio-canada.ca/rss/35019'), - ('Estrie', 'https://ici.radio-canada.ca/rss/5773'), - ('Gaspésie-Îles-de-la-Madeleine', 'https://ici.radio-canada.ca/rss/35015'), - ('Grand Montréal', 'https://ici.radio-canada.ca/rss/4201'), - ('Grand Nord', 'https://ici.radio-canada.ca/rss/1001049'), - ('Île-du-Prince-Édouard', 'https://ici.radio-canada.ca/rss/1000814'), - ('Manitoba', 'https://ici.radio-canada.ca/rss/5775'), - ('Mauricie–Centre-du-Québec', 'https://ici.radio-canada.ca/rss/5777'), - ('Nord de l’Ontario', 'https://ici.radio-canada.ca/rss/36518'), - ('Nouveau-Brunswick', 'https://ici.radio-canada.ca/rss/5765'), - ('Nouvelle-Écosse', 'https://ici.radio-canada.ca/rss/1000813'), - ('Ottawa-Gatineau', 'https://ici.radio-canada.ca/rss/6102'), - ('Québec', 'https://ici.radio-canada.ca/rss/6104'), - ('Saguenay-Lac-St-Jean', 'https://ici.radio-canada.ca/rss/6106'), - ('Saskatchewan', 'https://ici.radio-canada.ca/rss/6108'), - ('Terre-Neuve-et-Labrador', 'https://ici.radio-canada.ca/rss/1000815'), - ('Toronto', 'https://ici.radio-canada.ca/rss/5779'), - ('Windsor', 'https://ici.radio-canada.ca/rss/475289'), + ('Abitibi-Témiscamingue', 'https://ici.radio-canada.ca/rss/5763'), + ('Alberta', 'https://ici.radio-canada.ca/rss/5767'), + ('Bas-Saint-Laurent', 'https://ici.radio-canada.ca/rss/35004'), + ('Colombie-Brittanique', 'https://ici.radio-canada.ca/rss/5769'), + ('Côte-Nord', 'https://ici.radio-canada.ca/rss/35019'), + ('Estrie', 'https://ici.radio-canada.ca/rss/5773'), + ('Gaspésie-Îles-de-la-Madeleine', 'https://ici.radio-canada.ca/rss/35015'), + ('Grand Montréal', 'https://ici.radio-canada.ca/rss/4201'), + ('Grand Nord', 'https://ici.radio-canada.ca/rss/1001049'), + ('Île-du-Prince-Édouard', 'https://ici.radio-canada.ca/rss/1000814'), + ('Manitoba', 'https://ici.radio-canada.ca/rss/5775'), + ('Mauricie–Centre-du-Québec', 'https://ici.radio-canada.ca/rss/5777'), + ('Nord de l’Ontario', 'https://ici.radio-canada.ca/rss/36518'), + ('Nouveau-Brunswick', 'https://ici.radio-canada.ca/rss/5765'), + ('Nouvelle-Écosse', 'https://ici.radio-canada.ca/rss/1000813'), + ('Ottawa-Gatineau', 'https://ici.radio-canada.ca/rss/6102'), + ('Québec', 'https://ici.radio-canada.ca/rss/6104'), + ('Saguenay-Lac-St-Jean', 'https://ici.radio-canada.ca/rss/6106'), + ('Saskatchewan', 'https://ici.radio-canada.ca/rss/6108'), + ('Terre-Neuve-et-Labrador', 'https://ici.radio-canada.ca/rss/1000815'), + ('Toronto', 'https://ici.radio-canada.ca/rss/5779'), + ('Windsor', 'https://ici.radio-canada.ca/rss/475289'), # Autres - ('Archives', 'https://ici.radio-canada.ca/rss/1000548'), - ('Dossiers', 'https://ici.radio-canada.ca/rss/6735'), + ('Archives', 'https://ici.radio-canada.ca/rss/1000548'), + ('Dossiers', 'https://ici.radio-canada.ca/rss/6735'), ('Espaces autochtones', 'https://ici.radio-canada.ca/rss/116435'), - ('RCI', 'http://www.rcinet.ca/fr/feed/rss/') + ('RCI', 'http://www.rcinet.ca/fr/feed/rss/') ] # The following was copied and adapted as per the following post: diff --git a/recipes/respekt_magazine.recipe b/recipes/respekt_magazine.recipe index 93f007ac1e..aa5f76e08d 100644 --- a/recipes/respekt_magazine.recipe +++ b/recipes/respekt_magazine.recipe @@ -10,9 +10,10 @@ import re # This imports the version bundled with Calibre import lxml +from lxml.builder import E + from calibre.ebooks.BeautifulSoup import BeautifulSoup from calibre.web.feeds.recipes import BasicNewsRecipe -from lxml.builder import E respekt_url = 'https://www.respekt.cz' diff --git a/recipes/sobaka.recipe b/recipes/sobaka.recipe index 1f6012645f..28edf1e82f 100644 --- a/recipes/sobaka.recipe +++ b/recipes/sobaka.recipe @@ -5,7 +5,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class Sobaka(BasicNewsRecipe): - title = '\u0421\u043E\u0431\u0430\u043A\u0430.ru' + title = '\u0421\u043E\u0431\u0430\u043A\u0430.ru' __author__ = 'bugmen00t' description = '\u0416\u0443\u0440\u043D\u0430\u043B \u043E \u043B\u044E\u0434\u044F\u0445 \u0432 \u041F\u0435\u0442\u0435\u0440\u0431\u0443\u0440\u0433\u0435' # noqa publisher = '\u041E\u041E\u041E \u00AB\u0416\u0443\u0440\u043D\u0430\u043B\u044B \u0438 \u0441\u0430\u0439\u0442\u044B "\u0424\u0430\u0431\u0440\u0438\u043A\u0430 \u043A\u043E\u043D\u0442\u0435\u043D\u0442\u0430 "\u0422\u043E\u0447\u043A\u0430 \u0420\u0443"\u00BB' # noqa diff --git a/recipes/spectator_magazine.recipe b/recipes/spectator_magazine.recipe index c9bc29c652..7090eff021 100644 --- a/recipes/spectator_magazine.recipe +++ b/recipes/spectator_magazine.recipe @@ -40,7 +40,7 @@ class spectator(BasicNewsRecipe): dict(name = ['svg', 'button']), classes( 'entry-meta audio-read-block insert--most-popular ad-slot ad-slot--in-content ad-content ' - 'subscription-banner ' + 'subscription-banner ' ) ] @@ -48,7 +48,7 @@ class spectator(BasicNewsRecipe): for fc in soup.findAll('figcaption'): fc['id'] = 'fig-c' return soup - + def get_browser(self, *args, **kwargs): kwargs['user_agent'] = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)' br = BasicNewsRecipe.get_browser(self, *args, **kwargs) diff --git a/recipes/spiegelde.recipe b/recipes/spiegelde.recipe index 26d6a3dcbf..7ea987566f 100644 --- a/recipes/spiegelde.recipe +++ b/recipes/spiegelde.recipe @@ -19,10 +19,10 @@ class Spiegel_DE_all(BasicNewsRecipe): title = u'Spiegel Online RSS - German alle Themen' # Author __author__ = u'Volker Heggemann, VoHe' - # oldest article to download (in days) ---- can be edit by user + # oldest article to download (in days) ---- can be edit by user # be careful, if there is a lot of news, the file size exceeds! oldest_article = 7 - # describes itself, ---- can be edit by user + # describes itself, ---- can be edit by user max_articles_per_feed = 100 # speed up the download on fast computers be careful (I test max.20) # ---- can be edit by user @@ -40,11 +40,11 @@ class Spiegel_DE_all(BasicNewsRecipe): cover_url = 'https://de.m.wikipedia.org/wiki/Datei:Spiegel_Online_logo.svg' # What is the content of? category = 'SPIEGEL ONLINE RSS' - # describes itself, ---- can be edit by user + # describes itself, ---- can be edit by user language = 'de' lang = 'de-DE' no_stylesheets = True - # describes itself, ---- can be edit by user + # describes itself, ---- can be edit by user use_embedded_content = False # encoding of content. e.g. utf-8, None, ... # ---- can be edit by user @@ -57,7 +57,7 @@ class Spiegel_DE_all(BasicNewsRecipe): # remove the rubbish (in ebook) auto_cleanup = True # now the content description and URL follows - # feel free to add, wipe out what you need ---- can be edit by user + # feel free to add, wipe out what you need ---- can be edit by user # # Make some tests, may you first comment all of them out, and step by step you add what you'll need? # diff --git a/recipes/st_louis_post_dispatch.recipe b/recipes/st_louis_post_dispatch.recipe index f8bdae7906..bbb2ef36b5 100644 --- a/recipes/st_louis_post_dispatch.recipe +++ b/recipes/st_louis_post_dispatch.recipe @@ -66,4 +66,4 @@ class StLouisPostDispatch(BasicNewsRecipe): (u'Opinion - Editorial', u'http://www.stltoday.com/search/?c=opinion%2feditorial&d1=&d2=&s=start_time&sd=desc&f=rss&l=25&t=article'), (u'Opinion - Letters to the Editor', u'https://www.stltoday.com/search/?c=opinion%2Fletters&d1=&d2=&s=start_time&sd=desc&f=rss&l=25&t=article'), (u'Opinion - Local Columns', u'https://www.stltoday.com/search/?c=opinion%2fcolumn*&d1=&d2=&s=start_time&sd=desc&nfl=ap&nk=%23noshow,dcc&f=rss&l=25&t=article') - ] \ No newline at end of file + ] diff --git a/recipes/straitstimes.recipe b/recipes/straitstimes.recipe index b6945828f0..114ab78404 100644 --- a/recipes/straitstimes.recipe +++ b/recipes/straitstimes.recipe @@ -46,7 +46,7 @@ class StraitsTimes(BasicNewsRecipe): ,(u'Opinion' , u'https://www.straitstimes.com/news/opinion/rss.xml') ,(u'Life' , u'https://www.straitstimes.com/news/life/rss.xml') ,(u'Singapore' , u'https://www.straitstimes.com/news/singapore/rss.xml') - ,(u'Asia' , u'https://www.straitstimes.com/news/asia/rss.xml') + ,(u'Asia' , u'https://www.straitstimes.com/news/asia/rss.xml') ,(u'Multimedia' , u'https://www.straitstimes.com/news/multimedia/rss.xml') ,(u'Sport' , u'https://www.straitstimes.com/news/sport/rss.xml') ] diff --git a/recipes/t3n_de.recipe b/recipes/t3n_de.recipe index db94f85da3..3dd2120ebd 100644 --- a/recipes/t3n_de.recipe +++ b/recipes/t3n_de.recipe @@ -22,7 +22,7 @@ class germant3n(BasicNewsRecipe): # remove the rubbish (in ebook) auto_cleanup = True # now the content description and URL follows - # feel free to add, wipe out what you need ---- can be edit by user + # feel free to add, wipe out what you need ---- can be edit by user # # some of this are double # diff --git a/recipes/t_invariant_en.recipe b/recipes/t_invariant_en.recipe index bb09638156..a210f45957 100644 --- a/recipes/t_invariant_en.recipe +++ b/recipes/t_invariant_en.recipe @@ -7,7 +7,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class TInvariant(BasicNewsRecipe): - title = 'T-Invariant' + title = 'T-Invariant' __author__ = 'bugmen00t' description = 'T-Invariant is a multimedia project of scientists and science journalists. Our task is to be a bridge between the academic community in Russia and outside Russia. Let’s keep in touch!' # noqa publisher = '\u0422-\u0438\u043D\u0432\u0430\u0440\u0438\u0430\u043D\u0442 / T-invariant' diff --git a/recipes/t_invariant_ru.recipe b/recipes/t_invariant_ru.recipe index b005182bfa..c506641fd7 100644 --- a/recipes/t_invariant_ru.recipe +++ b/recipes/t_invariant_ru.recipe @@ -7,7 +7,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class TInvariant(BasicNewsRecipe): - title = 'T-Invariant' + title = 'T-Invariant' __author__ = 'bugmen00t' description = '\u041C\u0443\u043B\u044C\u0442\u0438\u043C\u0435\u0434\u0438\u0439\u043D\u044B\u0439 \u043F\u0440\u043E\u0435\u043A\u0442 \u0443\u0447\u0435\u043D\u044B\u0445 \u0438 \u043D\u0430\u0443\u0447\u043D\u044B\u0445 \u0436\u0443\u0440\u043D\u0430\u043B\u0438\u0441\u0442\u043E\u0432.' # noqa publisher = '\u0422-\u0438\u043D\u0432\u0430\u0440\u0438\u0430\u043D\u0442 / T-invariant' diff --git a/recipes/t_invariant_ua.recipe b/recipes/t_invariant_ua.recipe index af46987cad..04d081e1ec 100644 --- a/recipes/t_invariant_ua.recipe +++ b/recipes/t_invariant_ua.recipe @@ -7,7 +7,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class TInvariant(BasicNewsRecipe): - title = 'T-Invariant' + title = 'T-Invariant' __author__ = 'bugmen00t' description = 'T-Invariant is a multimedia project of scientists and science journalists. Our task is to be a bridge between the academic community in Russia and outside Russia. Let’s keep in touch!' # noqa publisher = '\u0422-\u0438\u043D\u0432\u0430\u0440\u0438\u0430\u043D\u0442 / T-invariant' diff --git a/recipes/tagesspiegel.recipe b/recipes/tagesspiegel.recipe index 422a525e89..36b6600bb1 100644 --- a/recipes/tagesspiegel.recipe +++ b/recipes/tagesspiegel.recipe @@ -48,7 +48,7 @@ class TagesspiegelRss(BasicNewsRecipe): from datetime import date cover = 'https://img.kiosko.net/' + date.today().strftime('%Y/%m/%d') + '/de/tagesspiegel.750.jpg' return cover - + keep_only_tags = [ dict(name = 'header', attrs={'class':'Bo'}), dict(name = 'div', attrs={'id':'story-elements'}) diff --git a/recipes/the_philippine_daily_inquirer.recipe b/recipes/the_philippine_daily_inquirer.recipe index f12b85aadb..3fcf888a09 100644 --- a/recipes/the_philippine_daily_inquirer.recipe +++ b/recipes/the_philippine_daily_inquirer.recipe @@ -51,73 +51,73 @@ class PhilippineDailyInquirer(BasicNewsRecipe): feeds = [ - ('Headlines' , 'http://newsinfo.inquirer.net/category/inquirer-headlines/feed'), - ('Latest Stories' , 'http://newsinfo.inquirer.net/category/latest-stories/feed'), - ('Nation' , 'http://newsinfo.inquirer.net/category/nation/feed'), - ('Nation - Latest Stories' , 'http://newsinfo.inquirer.net/category/latest-stories/nation-latest-stories/feed'), - ('Metro' , 'http://newsinfo.inquirer.net/category/metro/feed'), - ('Metro - Latest Stories' , 'http://newsinfo.inquirer.net/category/latest-stories/metro-latest-stories/feed'), - ('Regions' , 'http://newsinfo.inquirer.net/category/regions/feed'), - ('Regions - Latest Stories' , 'http://newsinfo.inquirer.net/category/latest-stories/regions-latest-stories/feed'), - ('News' , 'http://www.inquirer.net/fullfeed'), - ('More News' , 'http://newsinfo.inquirer.net/feed') + ('Headlines', 'http://newsinfo.inquirer.net/category/inquirer-headlines/feed'), + ('Latest Stories' , 'http://newsinfo.inquirer.net/category/latest-stories/feed'), + ('Nation' , 'http://newsinfo.inquirer.net/category/nation/feed'), + ('Nation - Latest Stories' , 'http://newsinfo.inquirer.net/category/latest-stories/nation-latest-stories/feed'), + ('Metro' , 'http://newsinfo.inquirer.net/category/metro/feed'), + ('Metro - Latest Stories' , 'http://newsinfo.inquirer.net/category/latest-stories/metro-latest-stories/feed'), + ('Regions' , 'http://newsinfo.inquirer.net/category/regions/feed'), + ('Regions - Latest Stories' , 'http://newsinfo.inquirer.net/category/latest-stories/regions-latest-stories/feed'), + ('News' , 'http://www.inquirer.net/fullfeed'), + ('More News' , 'http://newsinfo.inquirer.net/feed') , - ('Global Nation' , 'http://globalnation.inquirer.net/feed'), + ('Global Nation' , 'http://globalnation.inquirer.net/feed'), ('Global Nation - Latest Stories', 'http://globalnation.inquirer.net/category/latest-stories/feed'), ('Global Nation - Philippines', 'http://globalnation.inquirer.net/category/news/philippines/feed'), ('Global Nation - Asia & Pacific', 'http://globalnation.inquirer.net/category/news/asiaaustralia/feed'), ('Global Nation - Americas', 'http://globalnation.inquirer.net/category/news/uscanada/feed'), ('Global Nation - Middle East & Africa', 'http://globalnation.inquirer.net/category/news/middle-eastafrica/feed'), - ('Global Nation - Europe' , 'http://globalnation.inquirer.net/category/news/europe/feed'), + ('Global Nation - Europe' , 'http://globalnation.inquirer.net/category/news/europe/feed'), ('Global Nation - Global Pinoy', 'http://globalnation.inquirer.net/category/global-pinoy/feed'), - ('Global Nation - Events' , 'http://globalnation.inquirer.net/category/events/feed'), - ('Business' , 'http://business.inquirer.net/feed'), - ('Business - Latest Stories' , 'http://business.inquirer.net/category/latest-stories/feed'), - ('Business - Money' , 'http://business.inquirer.net/category/money/feed'), + ('Global Nation - Events' , 'http://globalnation.inquirer.net/category/events/feed'), + ('Business' , 'http://business.inquirer.net/feed'), + ('Business - Latest Stories' , 'http://business.inquirer.net/category/latest-stories/feed'), + ('Business - Money' , 'http://business.inquirer.net/category/money/feed'), ('Business - Science & Health', 'http://business.inquirer.net/category/science-and-health/feed'), - ('Business - Motoring' , 'http://business.inquirer.net/category/motoring/feed'), - ('Business - Property Guide' , 'http://business.inquirer.net/category/property-guide/feed'), - ('Business - Columnists' , 'http://business.inquirer.net/category/columnists/feed'), - ('Sports' , 'http://sports.inquirer.net/feed'), - ('Sports - Latest Stories' , 'http://sports.inquirer.net/category/latest-stories/feed'), - ('Sports - Basketball' , 'http://sports.inquirer.net/category/section/basketball/feed'), + ('Business - Motoring' , 'http://business.inquirer.net/category/motoring/feed'), + ('Business - Property Guide' , 'http://business.inquirer.net/category/property-guide/feed'), + ('Business - Columnists' , 'http://business.inquirer.net/category/columnists/feed'), + ('Sports' , 'http://sports.inquirer.net/feed'), + ('Sports - Latest Stories' , 'http://sports.inquirer.net/category/latest-stories/feed'), + ('Sports - Basketball' , 'http://sports.inquirer.net/category/section/basketball/feed'), ('Sports - Boxing & MMA', 'http://sports.inquirer.net/category/section/boxing-mma/feed'), - ('Sports - Golf' , 'http://sports.inquirer.net/category/section/golf/feed'), - ('Sports - Football' , 'http://sports.inquirer.net/category/section/other-sports/football/feed'), - ('Sports - Other Sports' , 'http://sports.inquirer.net/category/section/other-sports/feed'), - ('Technology' , 'http://technology.inquirer.net/feed'), + ('Sports - Golf' , 'http://sports.inquirer.net/category/section/golf/feed'), + ('Sports - Football' , 'http://sports.inquirer.net/category/section/other-sports/football/feed'), + ('Sports - Other Sports' , 'http://sports.inquirer.net/category/section/other-sports/feed'), + ('Technology' , 'http://technology.inquirer.net/feed'), ('Technology Latest Stories', 'http://technology.inquirer.net/category/latest-stories/feed'), - ('Entertainment' , 'http://entertainment.inquirer.net/feed'), + ('Entertainment' , 'http://entertainment.inquirer.net/feed'), ('Entertainment - Headlines', 'http://entertainment.inquirer.net/category/headlines/feed'), ('Entertainment - Latest Stories', 'http://entertainment.inquirer.net/category/latest-stories/feed'), - ('Entertainment - Movies' , 'http://movies.inquirer.net/feed'), - ('Lifestyle' , 'http://lifestyle.inquirer.net/feed'), + ('Entertainment - Movies' , 'http://movies.inquirer.net/feed'), + ('Lifestyle' , 'http://lifestyle.inquirer.net/feed'), ('Lifestyle - Latest Stories', 'http://lifestyle.inquirer.net/category/latest-stories/feed'), - ('Lifestyle - Arts & Books' , 'http://lifestyle.inquirer.net/category/arts-and-books/feed'), - ('Lifestyle - Wellness' , 'http://lifestyle.inquirer.net/category/wellness/feed'), + ('Lifestyle - Arts & Books' , 'http://lifestyle.inquirer.net/category/arts-and-books/feed'), + ('Lifestyle - Wellness' , 'http://lifestyle.inquirer.net/category/wellness/feed'), ('Lifestyle - Home & Entertaining', 'http://lifestyle.inquirer.net/category/home-and-entertaining/feed'), - ('Lifestyle - Parenting' , 'http://lifestyle.inquirer.net/category/parenting/feed'), - ('Lifestyle - Food' , 'http://lifestyle.inquirer.net/category/food/feed'), + ('Lifestyle - Parenting' , 'http://lifestyle.inquirer.net/category/parenting/feed'), + ('Lifestyle - Food' , 'http://lifestyle.inquirer.net/category/food/feed'), ('Lifestyle - Fashion & Beauty', 'http://lifestyle.inquirer.net/category/fashion-and-beauty/feed'), - ('Lifestyle - Super' , 'http://lifestyle.inquirer.net/category/super/feed'), - ('Lifestyle - 2BU' , 'http://lifestyle.inquirer.net/category/2bu/feed'), + ('Lifestyle - Super' , 'http://lifestyle.inquirer.net/category/super/feed'), + ('Lifestyle - 2BU' , 'http://lifestyle.inquirer.net/category/2bu/feed'), ('Lifestyle - Sunday Lifestyle', 'http://lifestyle.inquirer.net/category/sunday-lifestyle/feed'), - ('Lifestyle - Wedding' , 'http://lifestyle.inquirer.net/category/sunday-lifestyle/wedding/feed'), - ('Lifestyle - Travel' , 'http://lifestyle.inquirer.net/category/sunday-lifestyle/travel/feed'), - ('Lifestyle - Relationship' , 'http://lifestyle.inquirer.net/category/sunday-lifestyle/relationship/feed'), - ('Opinion' , 'http://opinion.inquirer.net/feed'), - ('Opinion - Viewpoints' , 'http://opinion.inquirer.net/category/viewpoints/feed'), + ('Lifestyle - Wedding' , 'http://lifestyle.inquirer.net/category/sunday-lifestyle/wedding/feed'), + ('Lifestyle - Travel' , 'http://lifestyle.inquirer.net/category/sunday-lifestyle/travel/feed'), + ('Lifestyle - Relationship' , 'http://lifestyle.inquirer.net/category/sunday-lifestyle/relationship/feed'), + ('Opinion' , 'http://opinion.inquirer.net/feed'), + ('Opinion - Viewpoints' , 'http://opinion.inquirer.net/category/viewpoints/feed'), ('Opinion - Talk of the Town', 'http://opinion.inquirer.net/category/inquirer-opinion/talk-of-the-town/feed'), - ('Editorial' , 'http://opinion.inquirer.net/category/editorial/feed'), - ('Letters to the Editor' , 'http://opinion.inquirer.net/category/letters-to-the-editor/feed'), - ('Columns' , 'http://opinion.inquirer.net/category/columns/feed'), - ('Citizens Journalism' , 'http://newsinfo.inquirer.net/category/citizens-journalism/feed'), - ('Cebu - Daily News' , 'http://newsinfo.inquirer.net/category/cdn/feed'), - ('Cebu - More News' , 'http://newsinfo.inquirer.net/category/cdn/cdn-news/feed'), - ('Cebu - Community' , 'http://newsinfo.inquirer.net/category/cdn/cdn-community/feed'), - ('Cebu - Metro' , 'http://newsinfo.inquirer.net/category/cdn/cdn-metro/feed'), - ('Cebu - Business' , 'http://newsinfo.inquirer.net/category/cdn/cdn-enterprise/feed'), - ('Cebu - Sports' , 'http://newsinfo.inquirer.net/category/cdn/cdn-sports/feed'), - ('Cebu - Visayas' , 'http://newsinfo.inquirer.net/category/cdn/cdn-visayas/feed'), - ('Cebu - Opinion' , 'http://newsinfo.inquirer.net/category/cdn/cdn-opinion/feed') + ('Editorial' , 'http://opinion.inquirer.net/category/editorial/feed'), + ('Letters to the Editor' , 'http://opinion.inquirer.net/category/letters-to-the-editor/feed'), + ('Columns' , 'http://opinion.inquirer.net/category/columns/feed'), + ('Citizens Journalism' , 'http://newsinfo.inquirer.net/category/citizens-journalism/feed'), + ('Cebu - Daily News' , 'http://newsinfo.inquirer.net/category/cdn/feed'), + ('Cebu - More News' , 'http://newsinfo.inquirer.net/category/cdn/cdn-news/feed'), + ('Cebu - Community' , 'http://newsinfo.inquirer.net/category/cdn/cdn-community/feed'), + ('Cebu - Metro' , 'http://newsinfo.inquirer.net/category/cdn/cdn-metro/feed'), + ('Cebu - Business' , 'http://newsinfo.inquirer.net/category/cdn/cdn-enterprise/feed'), + ('Cebu - Sports' , 'http://newsinfo.inquirer.net/category/cdn/cdn-sports/feed'), + ('Cebu - Visayas' , 'http://newsinfo.inquirer.net/category/cdn/cdn-visayas/feed'), + ('Cebu - Opinion' , 'http://newsinfo.inquirer.net/category/cdn/cdn-opinion/feed') ] diff --git a/recipes/thenewcriterion.recipe b/recipes/thenewcriterion.recipe index fd200197ba..cb56af5181 100644 --- a/recipes/thenewcriterion.recipe +++ b/recipes/thenewcriterion.recipe @@ -15,10 +15,11 @@ except ImportError: from urllib import urlencode import re +from mechanize import Request + from calibre import strftime from calibre.ptempfile import PersistentTemporaryFile from calibre.web.feeds.news import BasicNewsRecipe -from mechanize import Request class TheNewCriterion(BasicNewsRecipe): diff --git a/recipes/theoldie.recipe b/recipes/theoldie.recipe index 377c73feeb..449064a5bf 100644 --- a/recipes/theoldie.recipe +++ b/recipes/theoldie.recipe @@ -69,7 +69,7 @@ class PrivateEyeRecipe(BasicNewsRecipe): article['author'] = author return article - edition_re = re.compile('(?:-front-cover-)(\d+)-') + edition_re = re.compile(r'(?:-front-cover-)(\d+)-') # Identify the cover image and extract the edition# from the url def get_cover_url(self): @@ -242,8 +242,8 @@ class PrivateEyeRecipe(BasicNewsRecipe): {'name': 'a', 'class': "view-full-screen"}, {'name': 'div', 'class': "image-counter"}, {'name': 'h2', 'string': "Find out more about The Oldie"}, - {'name': 'a', 'href': re.compile("^https?:\/\/issuu.com\/")}, - {'name': 'img', 'src': re.compile("\/assets\/images\/icons\/icon-")}, + {'name': 'a', 'href': re.compile(r"^https?:\/\/issuu.com\/")}, + {'name': 'img', 'src': re.compile(r"\/assets\/images\/icons\/icon-")}, ] # The following extra css is to tweak the formatting of various elements of various article pages. diff --git a/recipes/tls_mag.recipe b/recipes/tls_mag.recipe index 60a475a492..6bb1ef8765 100644 --- a/recipes/tls_mag.recipe +++ b/recipes/tls_mag.recipe @@ -16,7 +16,7 @@ def re_html(y): def get_id(url): rq = browser().open(url) - return re.search('\?p=(\S+)>', str(rq.info())).group(1) + return re.search(r'\?p=(\S+)>', str(rq.info())).group(1) class TLS(BasicNewsRecipe): diff --git a/recipes/ugeskriftet.recipe b/recipes/ugeskriftet.recipe index e539c959f7..d91e5bf0c6 100644 --- a/recipes/ugeskriftet.recipe +++ b/recipes/ugeskriftet.recipe @@ -29,9 +29,8 @@ class Ugeskriftet(BasicNewsRecipe): h2{font-weight: bold; font-size: large;} h3{font-weight: bold; font-size: large;} h4{font-weight: bold; font-size: large;} - """ + """ feeds = [ ('Ugeskriftet for læger', 'https://ugeskriftet.dk/rss/forside'), ] - \ No newline at end of file diff --git a/recipes/ukrinform_es.recipe b/recipes/ukrinform_es.recipe index 7a15f4af6f..ddaf9b686e 100644 --- a/recipes/ukrinform_es.recipe +++ b/recipes/ukrinform_es.recipe @@ -5,7 +5,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class UkrInform(BasicNewsRecipe): - title = 'UkrInform (Espa\u00F1ol)' + title = 'UkrInform (Espa\u00F1ol)' __author__ = 'bugmen00t' description = 'Agencia de noticias nacional de Ucrania, fuente de informaci\u00F3n sobre la vida pol\u00EDtica, econ\u00F3mica, social, cient\u00EDfica, cultural y p\u00FAblica en Ucrania y en el extranjero.' # noqa publisher = 'Ministerio de Cultura y Pol\u00EDtica de Informaci\u00F3n de Ucrania' diff --git a/recipes/usatoday.recipe b/recipes/usatoday.recipe index ccea63c5b0..23ace39e94 100644 --- a/recipes/usatoday.recipe +++ b/recipes/usatoday.recipe @@ -69,7 +69,7 @@ class USAToday(BasicNewsRecipe): def parse_index(self): index = 'https://www.usatoday.com/' sections = [ - 'news', 'opinion', 'tech', 'entertainment', 'money', 'sports', 'travel', 'life', 'investigations', + 'news', 'opinion', 'tech', 'entertainment', 'money', 'sports', 'travel', 'life', 'investigations', ] feeds = [] soup = self.index_to_soup(index) @@ -87,7 +87,6 @@ class USAToday(BasicNewsRecipe): if articles: feeds.append((section, articles)) return feeds - def preprocess_html(self, soup): for img in soup.findAll('img', src=True): diff --git a/recipes/volksrant.recipe b/recipes/volksrant.recipe index da3b850ec4..6fe050a769 100644 --- a/recipes/volksrant.recipe +++ b/recipes/volksrant.recipe @@ -3,9 +3,10 @@ import json import uuid from contextlib import closing -from calibre.web.feeds.recipes import BasicNewsRecipe from mechanize import Request +from calibre.web.feeds.recipes import BasicNewsRecipe + class Volkskrant(BasicNewsRecipe): title = 'Volkskrant' diff --git a/recipes/wicomix.recipe b/recipes/wicomix.recipe index 6c9c23b13c..17da0fdb20 100644 --- a/recipes/wicomix.recipe +++ b/recipes/wicomix.recipe @@ -7,7 +7,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class WiComix(BasicNewsRecipe): - title = 'Wicomix' + title = 'Wicomix' __author__ = 'bugmen00t' description = '\u0418\u043D\u0442\u0435\u0440\u0435\u0441\u043D\u043E \u043F\u0438\u0448\u0435\u043C \u043F\u0440\u043E \u043A\u043E\u043C\u0438\u043A\u0441\u044B \u0438 \u043C\u0430\u043D\u0433\u0443 \u0432 \u0420\u043E\u0441\u0441\u0438\u0438.' # noqa publisher = '\u0421\u0435\u0440\u0433\u0435\u0439 \u041E\u0440\u0435\u0448\u043A\u0438\u043D' diff --git a/recipes/wsj_free.recipe b/recipes/wsj_free.recipe index 9b669fc6d7..9b1bc4f594 100644 --- a/recipes/wsj_free.recipe +++ b/recipes/wsj_free.recipe @@ -10,11 +10,12 @@ import time from base64 import standard_b64encode from datetime import date, timedelta -from calibre.ptempfile import PersistentTemporaryFile -from calibre.web.feeds.news import BasicNewsRecipe from css_selectors import Select from mechanize import Request +from calibre.ptempfile import PersistentTemporaryFile +from calibre.web.feeds.news import BasicNewsRecipe + try: import urllib.parse as urlparse except ImportError: diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index c170f22ad2..b25f68f19a 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -216,14 +216,14 @@ save_template_title_series_sorting = 'library_order' # (present only for legacy reasons). per_language_title_sort_articles = { # English - 'eng' : (r'A\s+', r'The\s+', r'An\s+'), + 'eng': (r'A\s+', r'The\s+', r'An\s+'), # Esperanto 'epo': (r'La\s+', r"L'", 'L´'), # Spanish - 'spa' : (r'El\s+', r'La\s+', r'Lo\s+', r'Los\s+', r'Las\s+', r'Un\s+', + 'spa': (r'El\s+', r'La\s+', r'Lo\s+', r'Los\s+', r'Las\s+', r'Un\s+', r'Una\s+', r'Unos\s+', r'Unas\s+'), # French - 'fra' : (r'Le\s+', r'La\s+', r"L'", u'L´', u'L’', r'Les\s+', r'Un\s+', r'Une\s+', + 'fra': (r'Le\s+', r'La\s+', r"L'", r'L´', r'L’', r'Les\s+', r'Un\s+', r'Une\s+', r'Des\s+', r'De\s+La\s+', r'De\s+', r"D'", r'D´', r'D’'), # Polish 'pol': (), @@ -233,32 +233,32 @@ per_language_title_sort_articles = { 'Un´', 'Dei\\s+', 'Degli\\s+', 'Delle\\s+', 'Del\\s+', 'Della\\s+', 'Dello\\s+', "Dell'", 'Dell´'), # Portuguese - 'por' : (r'A\s+', r'O\s+', r'Os\s+', r'As\s+', r'Um\s+', r'Uns\s+', + 'por': (r'A\s+', r'O\s+', r'Os\s+', r'As\s+', r'Um\s+', r'Uns\s+', r'Uma\s+', r'Umas\s+', ), # Romanian - 'ron' : (r'Un\s+', r'O\s+', r'Nişte\s+', ), + 'ron': (r'Un\s+', r'O\s+', r'Nişte\s+', ), # German - 'deu' : (r'Der\s+', r'Die\s+', r'Das\s+', r'Den\s+', r'Ein\s+', + 'deu': (r'Der\s+', r'Die\s+', r'Das\s+', r'Den\s+', r'Ein\s+', r'Eine\s+', r'Einen\s+', r'Dem\s+', r'Des\s+', r'Einem\s+', r'Eines\s+'), # Dutch - 'nld' : (r'De\s+', r'Het\s+', r'Een\s+', r"'n\s+", r"'s\s+", r'Ene\s+', + 'nld': (r'De\s+', r'Het\s+', r'Een\s+', r"'n\s+", r"'s\s+", r'Ene\s+', r'Ener\s+', r'Enes\s+', r'Den\s+', r'Der\s+', r'Des\s+', r"'t\s+"), # Swedish - 'swe' : (r'En\s+', r'Ett\s+', r'Det\s+', r'Den\s+', r'De\s+', ), + 'swe': (r'En\s+', r'Ett\s+', r'Det\s+', r'Den\s+', r'De\s+', ), # Turkish - 'tur' : (r'Bir\s+', ), + 'tur': (r'Bir\s+', ), # Afrikaans - 'afr' : (r"'n\s+", r'Die\s+', ), + 'afr': (r"'n\s+", r'Die\s+', ), # Greek - 'ell' : (r'O\s+', r'I\s+', r'To\s+', r'Ta\s+', r'Tus\s+', r'Tis\s+', + 'ell': (r'O\s+', r'I\s+', r'To\s+', r'Ta\s+', r'Tus\s+', r'Tis\s+', r"'Enas\s+", r"'Mia\s+", r"'Ena\s+", r"'Enan\s+", ), # Hungarian - 'hun' : (r'A\s+', r'Az\s+', r'Egy\s+',), + 'hun': (r'A\s+', r'Az\s+', r'Egy\s+',), } default_language_for_title_sort = None -title_sort_articles=r'^(A|The|An)\s+' +title_sort_articles = r'^(A|The|An)\s+' #: Specify a folder calibre should connect to at startup # Specify a folder that calibre should connect to at startup using @@ -331,8 +331,8 @@ auto_connect_to_folder = '' # The resulting two tweaks are: # sony_collection_renaming_rules={'series':'Series', 'tags':'Tag'} # sony_collection_name_template='{category:||: }{value}' -sony_collection_renaming_rules={} -sony_collection_name_template='{value}{category:| (|)}' +sony_collection_renaming_rules = {} +sony_collection_name_template = '{value}{category:| (|)}' #: Specify how SONY collections are sorted # Specify how SONY collections are sorted. This tweak is only applicable if @@ -402,7 +402,7 @@ vertical_scrolling_per_row = False # Default: locale_for_sorting = '' -- use the language calibre displays in # Example: locale_for_sorting = 'fr' -- sort using French rules. # Example: locale_for_sorting = 'nb' -- sort using Norwegian rules. -locale_for_sorting = '' +locale_for_sorting = '' #: The number of seconds to wait before sending emails # The number of seconds to wait before sending emails when using a diff --git a/setup/check.py b/setup/check.py index afe85be24e..3b75c790bb 100644 --- a/setup/check.py +++ b/setup/check.py @@ -41,6 +41,10 @@ class Check(Command): CACHE = 'check.json' + def add_options(self, parser): + parser.add_option('--fix', '--auto-fix', default=False, action='store_true', + help='Try to automatically fix some of the smallest errors') + def get_files(self): yield from checkable_python_files(self.SRC) @@ -91,6 +95,10 @@ class Check(Command): p = subprocess.Popen(['python', self.j(self.wn_path, 'whats_new.py'), f]) return p.wait() != 0 + def perform_auto_fix(self): + p = subprocess.Popen(['ruff', 'check', '--fix-only'], text=True, stdout=subprocess.PIPE) + return p.stdout.read() + def run(self, opts): self.fhash_cache = {} cache = {} @@ -102,13 +110,20 @@ class Check(Command): except OSError as err: if err.errno != errno.ENOENT: raise + if opts.fix: + self.info('\tAuto-fixing') + msg = self.perform_auto_fix() + self.info(msg) dirty_files = tuple(f for f in self.get_files() if not self.is_cache_valid(f, cache)) try: for i, f in enumerate(dirty_files): self.info('\tChecking', f) if self.file_has_errors(f): self.info('%d files left to check' % (len(dirty_files) - i - 1)) - edit_file(f) + try: + edit_file(f) + except FileNotFoundError: + pass # continue if the configured editor fail to be open if self.file_has_errors(f): raise SystemExit(1) cache[f] = self.file_hash(f) diff --git a/src/calibre/devices/boeye/driver.py b/src/calibre/devices/boeye/driver.py index 99ccedad31..36b66b3302 100644 --- a/src/calibre/devices/boeye/driver.py +++ b/src/calibre/devices/boeye/driver.py @@ -10,49 +10,49 @@ from calibre.devices.usbms.driver import USBMS class BOEYE_BEX(USBMS): - name = 'BOEYE BEX reader driver' - gui_name = 'BOEYE BEX' - description = _('Communicate with BOEYE BEX Serial e-book readers.') - author = 'szboeye' + name = 'BOEYE BEX reader driver' + gui_name = 'BOEYE BEX' + description = _('Communicate with BOEYE BEX Serial e-book readers.') + author = 'szboeye' supported_platforms = ['windows', 'osx', 'linux'] - FORMATS = ['epub', 'mobi', 'fb2', 'lit', 'prc', 'pdf', 'rtf', 'txt', 'djvu', 'doc', 'chm', 'html', 'zip', 'pdb'] + FORMATS = ['epub', 'mobi', 'fb2', 'lit', 'prc', 'pdf', 'rtf', 'txt', 'djvu', 'doc', 'chm', 'html', 'zip', 'pdb'] - VENDOR_ID = [0x0085] - PRODUCT_ID = [0x600] + VENDOR_ID = [0x0085] + PRODUCT_ID = [0x600] - VENDOR_NAME = 'LINUX' + VENDOR_NAME = 'LINUX' WINDOWS_MAIN_MEM = 'FILE-STOR_GADGET' - OSX_MAIN_MEM = 'Linux File-Stor Gadget Media' + OSX_MAIN_MEM = 'Linux File-Stor Gadget Media' MAIN_MEMORY_VOLUME_LABEL = 'BOEYE BEX Storage Card' - EBOOK_DIR_MAIN = 'Documents' + EBOOK_DIR_MAIN = 'Documents' SUPPORTS_SUB_DIRS = True class BOEYE_BDX(USBMS): - name = 'BOEYE BDX reader driver' - gui_name = 'BOEYE BDX' - description = _('Communicate with BOEYE BDX serial e-book readers.') - author = 'szboeye' + name = 'BOEYE BDX reader driver' + gui_name = 'BOEYE BDX' + description = _('Communicate with BOEYE BDX serial e-book readers.') + author = 'szboeye' supported_platforms = ['windows', 'osx', 'linux'] - FORMATS = ['epub', 'mobi', 'fb2', 'lit', 'prc', 'pdf', 'rtf', 'txt', 'djvu', 'doc', 'chm', 'html', 'zip', 'pdb'] + FORMATS = ['epub', 'mobi', 'fb2', 'lit', 'prc', 'pdf', 'rtf', 'txt', 'djvu', 'doc', 'chm', 'html', 'zip', 'pdb'] - VENDOR_ID = [0x0085] - PRODUCT_ID = [0x800] + VENDOR_ID = [0x0085] + PRODUCT_ID = [0x800] - VENDOR_NAME = 'LINUX' + VENDOR_NAME = 'LINUX' WINDOWS_MAIN_MEM = 'FILE-STOR_GADGET' WINDOWS_CARD_A_MEM = 'FILE-STOR_GADGET' - OSX_MAIN_MEM = 'Linux File-Stor Gadget Media' - OSX_CARD_A_MEM = 'Linux File-Stor Gadget Media' + OSX_MAIN_MEM = 'Linux File-Stor Gadget Media' + OSX_CARD_A_MEM = 'Linux File-Stor Gadget Media' MAIN_MEMORY_VOLUME_LABEL = 'BOEYE BDX Internal Memory' STORAGE_CARD_VOLUME_LABEL = 'BOEYE BDX Storage Card' - EBOOK_DIR_MAIN = 'Documents' + EBOOK_DIR_MAIN = 'Documents' EBOOK_DIR_CARD_A = 'Documents' SUPPORTS_SUB_DIRS = True diff --git a/src/calibre/devices/hanlin/driver.py b/src/calibre/devices/hanlin/driver.py index efdf8ff096..ba4b9208eb 100644 --- a/src/calibre/devices/hanlin/driver.py +++ b/src/calibre/devices/hanlin/driver.py @@ -97,8 +97,8 @@ class HANLINV5(HANLINV3): gui_name = 'Hanlin V5' description = _('Communicate with Hanlin V5 e-book readers.') - VENDOR_ID = [0x0492] - PRODUCT_ID = [0x8813] + VENDOR_ID = [0x0492] + PRODUCT_ID = [0x8813] BCD = [0x319] OSX_MAIN_MEM = 'Hanlin V5 Internal Memory' diff --git a/src/calibre/devices/kindle/apnx_page_generator/page_group.py b/src/calibre/devices/kindle/apnx_page_generator/page_group.py index 9eb8590476..9a15a12632 100644 --- a/src/calibre/devices/kindle/apnx_page_generator/page_group.py +++ b/src/calibre/devices/kindle/apnx_page_generator/page_group.py @@ -11,7 +11,7 @@ class PageGroup: """Simulate constructor overloading""" def __init__(self, page_locations: Union[int, List[int]], page_number_type: PageNumberTypes, first_value: int, page_labels: Union[str, List[str], None] = None): - if page_locations.__class__ == int: + if page_locations.__class__ is int: self.page_locations: List[int] = [page_locations] else: self.page_locations: List[int] = page_locations @@ -19,7 +19,7 @@ class PageGroup: self.__first_value = first_value if page_number_type == PageNumberTypes.Custom: assert page_labels is not None - if page_labels.__class__ == str: + if page_labels.__class__ is str: assert 1 == len(self.page_locations) and len(page_labels) > 0 self.__page_number_labels: List[str] = [page_labels] else: @@ -28,7 +28,7 @@ class PageGroup: self.__page_number_labels: List[str] = page_labels def append(self, page_location: Union[int, Tuple[int, str]]) -> None: - if page_location.__class__ == int: + if page_location.__class__ is int: assert self.__page_number_type != PageNumberTypes.Custom self.page_locations.append(page_location) else: diff --git a/src/calibre/devices/kindle/apnx_page_generator/pages.py b/src/calibre/devices/kindle/apnx_page_generator/pages.py index 3588a46304..e6ddec39c9 100644 --- a/src/calibre/devices/kindle/apnx_page_generator/pages.py +++ b/src/calibre/devices/kindle/apnx_page_generator/pages.py @@ -11,7 +11,7 @@ from calibre.devices.kindle.apnx_page_generator.page_number_type import PageNumb class Pages: def __init__(self, page_locations: Optional[List[int]] = None): - if page_locations.__class__ == list: + if page_locations.__class__ is list: self.__pages_groups: List[PageGroup] = [PageGroup(page_locations, PageNumberTypes.Arabic, 1)] else: self.__pages_groups: List[PageGroup] = [] diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index 3285cb5195..1f51d8fb86 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -673,7 +673,7 @@ class Device(DeviceConfig, DevicePlugin): hal = get_hal() vols = hal.get_volumes(d) if verbose: - print("FBSD: ", vols) + print("FBSD:\t", vols) ok, mv = hal.mount_volumes(vols) if not ok: diff --git a/src/calibre/devices/usbms/hal.py b/src/calibre/devices/usbms/hal.py index 898206add1..89880eadc7 100644 --- a/src/calibre/devices/usbms/hal.py +++ b/src/calibre/devices/usbms/hal.py @@ -106,19 +106,19 @@ class HAL: # Mount Point becomes Mount Path mp += '/' if DEBUG: - print("FBSD: mounted", vol['label'], "on", mp) + print("FBSD:\tmounted", vol['label'], "on", mp) if mtd == 0: ans['_main_prefix'], ans['_main_vol'] = mp, vol['vol'] if DEBUG: - print("FBSD: main = ", mp) + print("FBSD:\tmain = ", mp) elif mtd == 1: ans['_card_a_prefix'], ans['_card_a_vol'] = mp, vol['vol'] if DEBUG: - print("FBSD: card a = ", mp) + print("FBSD:\tcard a = ", mp) elif mtd == 2: ans['_card_b_prefix'], ans['_card_b_vol'] = mp, vol['vol'] if DEBUG: - print("FBSD: card b = ", mp) + print("FBSD:\tcard b = ", mp) break mtd += 1 diff --git a/src/calibre/devices/winusb.py b/src/calibre/devices/winusb.py index 9e453bf3dd..a7839e795a 100644 --- a/src/calibre/devices/winusb.py +++ b/src/calibre/devices/winusb.py @@ -307,27 +307,27 @@ SPDRP_LOCATION_PATHS = DWORD(0x00000023) CR_CODES, CR_CODE_NAMES = {}, {} for line in '''\ -#define CR_SUCCESS 0x00000000 +#define CR_SUCCESS 0x00000000 #define CR_DEFAULT 0x00000001 #define CR_OUT_OF_MEMORY 0x00000002 #define CR_INVALID_POINTER 0x00000003 #define CR_INVALID_FLAG 0x00000004 #define CR_INVALID_DEVNODE 0x00000005 -#define CR_INVALID_DEVINST CR_INVALID_DEVNODE +#define CR_INVALID_DEVINST CR_INVALID_DEVNODE #define CR_INVALID_RES_DES 0x00000006 #define CR_INVALID_LOG_CONF 0x00000007 #define CR_INVALID_ARBITRATOR 0x00000008 #define CR_INVALID_NODELIST 0x00000009 #define CR_DEVNODE_HAS_REQS 0x0000000A -#define CR_DEVINST_HAS_REQS CR_DEVNODE_HAS_REQS +#define CR_DEVINST_HAS_REQS CR_DEVNODE_HAS_REQS #define CR_INVALID_RESOURCEID 0x0000000B #define CR_DLVXD_NOT_FOUND 0x0000000C #define CR_NO_SUCH_DEVNODE 0x0000000D -#define CR_NO_SUCH_DEVINST CR_NO_SUCH_DEVNODE +#define CR_NO_SUCH_DEVINST CR_NO_SUCH_DEVNODE #define CR_NO_MORE_LOG_CONF 0x0000000E #define CR_NO_MORE_RES_DES 0x0000000F #define CR_ALREADY_SUCH_DEVNODE 0x00000010 -#define CR_ALREADY_SUCH_DEVINST CR_ALREADY_SUCH_DEVNODE +#define CR_ALREADY_SUCH_DEVINST CR_ALREADY_SUCH_DEVNODE #define CR_INVALID_RANGE_LIST 0x00000011 #define CR_INVALID_RANGE 0x00000012 #define CR_FAILURE 0x00000013 diff --git a/src/calibre/ebooks/html_transform_rules.py b/src/calibre/ebooks/html_transform_rules.py index 0d3187f1c1..f5e2634c88 100644 --- a/src/calibre/ebooks/html_transform_rules.py +++ b/src/calibre/ebooks/html_transform_rules.py @@ -5,13 +5,13 @@ import re from functools import partial +from css_selectors.select import Select, get_parsed_selector from html5_parser import parse from lxml import etree from calibre.ebooks.metadata.tag_mapper import uniq from calibre.ebooks.oeb.base import OEB_DOCS, XPath from calibre.ebooks.oeb.parse_utils import XHTML -from css_selectors.select import Select, get_parsed_selector def non_empty_validator(label, val): diff --git a/src/calibre/ebooks/oeb/polish/report.py b/src/calibre/ebooks/oeb/polish/report.py index 7ec78180a9..00dc9f5ccf 100644 --- a/src/calibre/ebooks/oeb/polish/report.py +++ b/src/calibre/ebooks/oeb/polish/report.py @@ -11,6 +11,8 @@ import types from collections import defaultdict, namedtuple from itertools import chain +from css_selectors import Select, SelectorError + from calibre import force_unicode, prepare_string_for_xml from calibre.ebooks.oeb.base import XPath, xml2text from calibre.ebooks.oeb.polish.container import OEB_DOCS, OEB_STYLES @@ -18,7 +20,6 @@ from calibre.ebooks.oeb.polish.spell import count_all_chars, get_all_words from calibre.ebooks.oeb.polish.utils import OEB_FONTS from calibre.utils.icu import numeric_sort_key, safe_chr from calibre.utils.imghdr import identify -from css_selectors import Select, SelectorError from polyglot.builtins import iteritems File = namedtuple('File', 'name dir basename size category word_count') diff --git a/src/calibre/ebooks/pdf/reflow.py b/src/calibre/ebooks/pdf/reflow.py index 0e1f75a0d9..abbb66a1de 100644 --- a/src/calibre/ebooks/pdf/reflow.py +++ b/src/calibre/ebooks/pdf/reflow.py @@ -16,8 +16,8 @@ from lxml import etree #### Pages/lines # How many pages/lines to scan when finding header/footer automatically -PAGE_SCAN_COUNT = 20 # Arbitrary -LINE_SCAN_COUNT = 2 # Arbitrary +PAGE_SCAN_COUNT = 20 # Arbitrary +LINE_SCAN_COUNT = 2 # Arbitrary # Number of character widths that two strings have to be apart, # for them to be considered part of the same text fragment @@ -211,7 +211,7 @@ class Text(Element): and abs(other.left - self.right) < 2.0: #and abs(other.left - self.right) < self.average_character_width / 3.0: has_gap = 0 - else: # Insert n spaces to fill gap. Use TAB? Columns? + else: # Insert n spaces to fill gap. Use TAB? Columns? if other.left < self.right: has_gap = 1 # Coalescing different lines. 1 space else: # Multiple texts on same line @@ -275,7 +275,7 @@ class Text(Element): self.font_size_em = max(self.font_size_em, other.font_size_em) self.font = other.font if self.font_size == other.font_size else other.font if has_gap > 0: - if has_gap < 3: # Small number of spaces = 1 space + if has_gap < 3: # Small number of spaces = 1 space if not (self.text_as_string.endswith(' ') \ or self.text_as_string.endswith('-') \ or other.text_as_string.startswith(' ') \ @@ -766,11 +766,11 @@ class Page: while s < len(text.text_as_string) \ and text.text_as_string[s] == ' ': s += 1 - if s > 2: # Allow two leading spaces + if s > 2: # Allow two leading spaces # Assume this is a standard indent # Normally text.indented gets set later text.indented = 1 - w = round(s * text.average_character_width/2.0) # Spaces < avg width + w = round(s * text.average_character_width/2.0) # Spaces < avg width matchObj = re.match(r'^\s*(<[^>]+>)?\s*(.*)$', text.raw) t1 = matchObj.group(1) t2 = matchObj.group(2) @@ -780,9 +780,9 @@ class Page: t2 = '' text.raw = t1 + t2 text.text_as_string = text.text_as_string[s:] - text.left += w # Add indent + text.left += w # Add indent text.last_left += w - text.width -= w # Reduce width + text.width -= w # Reduce width text.final_width -= w self.left_margin = min(text.left, self.left_margin) self.right_margin = max(text.right, self.right_margin) @@ -846,7 +846,7 @@ class Page: or (frag.top < t.top and frag.bottom+BOTTOM_FACTOR > t.bottom) \ or (t.top < frag.top and t.bottom > frag.top+BOTTOM_FACTOR) \ or (t.top < frag.top and t.bottom+BOTTOM_FACTOR > frag.bottom)): - return t # Force match if same line + return t # Force match if same line # Sorting can put parts of a line in the wrong order if there are small chars if t.left < frag.left: hdelta = frag.left - t.right @@ -916,7 +916,7 @@ class Page: # NB Doesn't work where Contents goes to another page if re.match(r'(?i)^\s*(table of )?contents\s*$', t.text_as_string) is not None: self.contents = True - t.tag = 'h2' # It won't get set later + t.tag = 'h2' # It won't get set later # Centered if left and right margins are within FACTOR% # Because indents can waver a bit, use between indent and indent1 as == indent if (lmargin < indent or lmargin > indent1) \ @@ -1407,9 +1407,9 @@ class PDFDocument: # Check for a testable value if self.opts.pdf_header_regex is None: - self.opts.pdf_header_regex = '' # Do nothing + self.opts.pdf_header_regex = '' # Do nothing if self.opts.pdf_footer_regex is None: - self.opts.pdf_footer_regex = '' # Do nothing + self.opts.pdf_footer_regex = '' # Do nothing parser = etree.XMLParser(recover=True) self.root = etree.fromstring(xml, parser=parser) @@ -1863,11 +1863,11 @@ class PDFDocument: if pages_to_scan > 0: # Doc is shorter than scan_count - pages_to_scan = scan_count - pages_to_scan # Number scanned + pages_to_scan = scan_count - pages_to_scan # Number scanned else: # All required pages scanned pages_to_scan = scan_count - pages_to_scan /= 2 # Are at least half matching? + pages_to_scan /= 2 # Are at least half matching? head_ind = 0 for i in range(LINE_SCAN_COUNT): diff --git a/src/calibre/ebooks/rtf2xml/default_encoding.py b/src/calibre/ebooks/rtf2xml/default_encoding.py index d6d411bde3..6a9a99eb3a 100644 --- a/src/calibre/ebooks/rtf2xml/default_encoding.py +++ b/src/calibre/ebooks/rtf2xml/default_encoding.py @@ -6,54 +6,54 @@ ''' Codepages as to RTF 1.9.1: - 437 United States IBM - 708 Arabic (ASMO 708) - 709 Arabic (ASMO 449+, BCON V4) - 710 Arabic (transparent Arabic) - 711 Arabic (Nafitha Enhanced) - 720 Arabic (transparent ASMO) - 819 Windows 3.1 (United States and Western Europe) - 850 IBM multilingual - 852 Eastern European - 860 Portuguese - 862 Hebrew - 863 French Canadian - 864 Arabic - 865 Norwegian - 866 Soviet Union - 874 Thai - 932 Japanese - 936 Simplified Chinese - 949 Korean - 950 Traditional Chinese - 1250 Eastern European - 1251 Cyrillic - 1252 Western European - 1253 Greek - 1254 Turkish - 1255 Hebrew - 1256 Arabic - 1257 Baltic - 1258 Vietnamese - 1361 Johab - 10000 MAC Roman - 10001 MAC Japan - 10004 MAC Arabic - 10005 MAC Hebrew - 10006 MAC Greek - 10007 MAC Cyrillic - 10029 MAC Latin2 - 10081 MAC Turkish - 57002 Devanagari - 57003 Bengali - 57004 Tamil - 57005 Telugu - 57006 Assamese - 57007 Oriya - 57008 Kannada - 57009 Malayalam - 57010 Gujarati - 57011 Punjabi + 437 United States IBM + 708 Arabic (ASMO 708) + 709 Arabic (ASMO 449+, BCON V4) + 710 Arabic (transparent Arabic) + 711 Arabic (Nafitha Enhanced) + 720 Arabic (transparent ASMO) + 819 Windows 3.1 (United States and Western Europe) + 850 IBM multilingual + 852 Eastern European + 860 Portuguese + 862 Hebrew + 863 French Canadian + 864 Arabic + 865 Norwegian + 866 Soviet Union + 874 Thai + 932 Japanese + 936 Simplified Chinese + 949 Korean + 950 Traditional Chinese + 1250 Eastern European + 1251 Cyrillic + 1252 Western European + 1253 Greek + 1254 Turkish + 1255 Hebrew + 1256 Arabic + 1257 Baltic + 1258 Vietnamese + 1361 Johab + 10000 MAC Roman + 10001 MAC Japan + 10004 MAC Arabic + 10005 MAC Hebrew + 10006 MAC Greek + 10007 MAC Cyrillic + 10029 MAC Latin2 + 10081 MAC Turkish + 57002 Devanagari + 57003 Bengali + 57004 Tamil + 57005 Telugu + 57006 Assamese + 57007 Oriya + 57008 Kannada + 57009 Malayalam + 57010 Gujarati + 57011 Punjabi ''' import re diff --git a/src/calibre/ebooks/rtf2xml/field_strings.py b/src/calibre/ebooks/rtf2xml/field_strings.py index 257edcecb3..3e1ec2849f 100644 --- a/src/calibre/ebooks/rtf2xml/field_strings.py +++ b/src/calibre/ebooks/rtf2xml/field_strings.py @@ -81,7 +81,7 @@ class FieldStrings: 'INCLUDETEXT' : (self.__include_text_func, 'include-text-from-file'), 'INDEX' : (self.__index_func, 'index'), 'NOTEREF' : (self.__note_ref_func, 'reference-to-note'), - 'PAGEREF' : (self.__page_ref_func, 'reference-to-page'), + 'PAGEREF' : (self.__page_ref_func, 'reference-to-page'), 'REF' : (self.__ref_func, 'reference'), 'ref' : (self.__ref_func, 'reference'), 'SEQ' : (self.__sequence_func, 'numbering-sequence'), diff --git a/src/calibre/ebooks/rtf2xml/paragraph_def.py b/src/calibre/ebooks/rtf2xml/paragraph_def.py index e5b63d7bf5..486690a30d 100644 --- a/src/calibre/ebooks/rtf2xml/paragraph_def.py +++ b/src/calibre/ebooks/rtf2xml/paragraph_def.py @@ -129,7 +129,7 @@ if another paragraph_def is found, the state changes to collect_tokens. 'list-simpi' : 'list-simple', 'list-conti' : 'list-continue', 'list-hang_' : 'list-hang', - # 'list-tebef' : 'list-text-before', + # 'list-tebef' : 'list-text-before', # 'list-level' : 'level', 'list-id___' : 'list-id', 'list-start' : 'list-start', diff --git a/src/calibre/ebooks/rtf2xml/process_tokens.py b/src/calibre/ebooks/rtf2xml/process_tokens.py index f118f0deef..df0ab9aa04 100644 --- a/src/calibre/ebooks/rtf2xml/process_tokens.py +++ b/src/calibre/ebooks/rtf2xml/process_tokens.py @@ -182,8 +182,8 @@ class ProcessTokens: 'ixe' : ('in', 'index-ital', self.default_func), 'txe' : ('in', 'index-see_', self.default_func), # table of contents => tc - 'tcl' : ('tc', 'toc-level_', self.default_func), - 'tcn' : ('tc', 'toc-sup-nu', self.default_func), + 'tcl' : ('tc', 'toc-level_', self.default_func), + 'tcn' : ('tc', 'toc-sup-nu', self.default_func), # field => fd 'field' : ('fd', 'field_____', self.default_func), 'fldinst' : ('fd', 'field-inst', self.default_func), @@ -316,7 +316,7 @@ class ProcessTokens: 'brdrl' : ('bd', 'bor-par-le', self.default_func), 'brdrr' : ('bd', 'bor-par-ri', self.default_func), 'box' : ('bd', 'bor-par-bx', self.default_func), - 'chbrdr' : ('bd', 'bor-par-bo', self.default_func), + 'chbrdr' : ('bd', 'bor-par-bo', self.default_func), 'brdrbtw' : ('bd', 'bor-for-ev', self.default_func), 'brdrbar' : ('bd', 'bor-outsid', self.default_func), 'brdrnone' : ('bd', 'bor-none__ import importlib @@ -56,10 +55,10 @@ qt_modules = {} def __getattr__(name): return dynamic_load(name, name_map, already_imported, qt_modules, module_names) -''', file=f) +''', end='', file=f) with open(f'{base}/{name}.pyi', 'w') as f: print('# autogenerated by __main__.py do not edit', file=f) - f.write('\n'.join(types)) + print('\n'.join(types), file=f) if name == 'core': module_names += ('sip',) mod = importlib.import_module(f'{QT_WRAPPER}.sip') @@ -79,7 +78,8 @@ for name in module_lists.keys(): scan(name) with open(f'{base}/__init__.py', 'w') as f: print('# autogenerated by __main__.py do not edit', file=f) - print(f'{top_level_module_names=}', file=f) + print('top_level_module_names = ', end='', file=f) + pprint(top_level_module_names, stream=f) print(f''' def __getattr__(name): @@ -87,4 +87,4 @@ def __getattr__(name): import importlib return importlib.import_module("{QT_WRAPPER}." + name) raise AttributeError(name) -''', file=f) +''', end='', file=f) diff --git a/src/qt/core.pyi b/src/qt/core.pyi index 8b039701a5..33b0bf6444 100644 --- a/src/qt/core.pyi +++ b/src/qt/core.pyi @@ -766,4 +766,4 @@ QGraphicsVideoItem = PyQt6.QtMultimediaWidgets.QGraphicsVideoItem QVideoWidget = PyQt6.QtMultimediaWidgets.QVideoWidget import PyQt6.QtTextToSpeech QTextToSpeech = PyQt6.QtTextToSpeech.QTextToSpeech -QVoice = PyQt6.QtTextToSpeech.QVoice \ No newline at end of file +QVoice = PyQt6.QtTextToSpeech.QVoice diff --git a/src/qt/dbus.pyi b/src/qt/dbus.pyi index f289d8c3b4..eafe100a1d 100644 --- a/src/qt/dbus.pyi +++ b/src/qt/dbus.pyi @@ -17,4 +17,4 @@ QDBusReply = PyQt6.QtDBus.QDBusReply QDBusServiceWatcher = PyQt6.QtDBus.QDBusServiceWatcher QDBusSignature = PyQt6.QtDBus.QDBusSignature QDBusUnixFileDescriptor = PyQt6.QtDBus.QDBusUnixFileDescriptor -QDBusVariant = PyQt6.QtDBus.QDBusVariant \ No newline at end of file +QDBusVariant = PyQt6.QtDBus.QDBusVariant diff --git a/src/qt/loader.py b/src/qt/loader.py index 49a210babe..9ea3d178eb 100644 --- a/src/qt/loader.py +++ b/src/qt/loader.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# vim:fileencoding=utf-8 # License: GPL v3 Copyright: 2021, Kovid Goyal import sys diff --git a/src/qt/webengine.pyi b/src/qt/webengine.pyi index 1f42fe6a4d..8fe6efb006 100644 --- a/src/qt/webengine.pyi +++ b/src/qt/webengine.pyi @@ -41,4 +41,4 @@ qWebEngineGetDomainAndRegistry = PyQt6.QtWebEngineCore.qWebEngineGetDomainAndReg qWebEngineProcessName = PyQt6.QtWebEngineCore.qWebEngineProcessName qWebEngineVersion = PyQt6.QtWebEngineCore.qWebEngineVersion import PyQt6.QtWebEngineWidgets -QWebEngineView = PyQt6.QtWebEngineWidgets.QWebEngineView \ No newline at end of file +QWebEngineView = PyQt6.QtWebEngineWidgets.QWebEngineView