From dba73b96b772b62444d76766ebaac70cceb591b1 Mon Sep 17 00:00:00 2001 From: un-pogaz <46523284+un-pogaz@users.noreply.github.com> Date: Fri, 24 Jan 2025 11:14:21 +0100 Subject: [PATCH] comment formating (manual) ruff 'E114,E115,E116,E261,E262,E265' --- recipes/before_we_go.recipe | 2 +- recipes/faz_net.recipe | 18 +++++++++--------- recipes/le_monde.recipe | 8 ++++---- recipes/new_yorker.recipe | 20 ++++++++++---------- recipes/ua_fooball.recipe | 16 ++++++++-------- src/calibre/devices/kobo/driver.py | 4 ++-- src/calibre/utils/formatter_functions.py | 2 +- 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/recipes/before_we_go.recipe b/recipes/before_we_go.recipe index b464af711a..aec5763d24 100644 --- a/recipes/before_we_go.recipe +++ b/recipes/before_we_go.recipe @@ -1,5 +1,5 @@ #!/usr/bin/env python - # vim:fileencoding=utf-8 +# vim:fileencoding=utf-8 from __future__ import absolute_import, division, print_function, unicode_literals diff --git a/recipes/faz_net.recipe b/recipes/faz_net.recipe index 68cf8fdf04..ae43ced01f 100644 --- a/recipes/faz_net.recipe +++ b/recipes/faz_net.recipe @@ -56,9 +56,9 @@ def bilderstrecke(soup,tag): for v in struct: if isinstance(v, dict) and 'caption' in v and 'defaultUrl' in v: -# if type(struct[i-1])== str: -# head = soup.new_tag("h4") -# head.append(struct[i-1]) + # if type(struct[i-1])== str: + # head = soup.new_tag("h4") + # head.append(struct[i-1]) cap = soup.new_tag('p') cap.append(struct[int(v['caption'])]) cap['class'] = 'body-elements__image-figcaption' @@ -172,11 +172,11 @@ class FazNet(BasicNewsRecipe): else: def parse_index(self): test_article = 'https://www.faz.net/aktuell/stil/mode-im-em-jahr-wir-zeigen-wie-fussball-und-mode-zusammengehoeren-19766969.html' -# test_article = 'https://www.faz.net/aktuell/feuilleton/buecher/film-eruption-ein-thriller-aus-dem-nachlass-von-michael-crichton-19770491.html' -# test_article = 'https://www.faz.net/aktuell/stil/mode-design/leonie-benesch-sandra-hueller-ist-eine-meiner-heldinnen-19671638.html' -# test_article = 'https://www.faz.net/aktuell/feuilleton/medien/sabine-postel-zum-siebzigsten-die-briten-nannten-sie-german-traktor-19708409.html' -# test_article = 'https://www.faz.net/aktuell/stil/mode-design/von-richert-beil-bis-william-fan-wer-kauft-denn-das-19666592.html' - # test_article = 'https://www.faz.net/aktuell/feuilleton/buecher/rezensionen/sachbuch/tom-mustills-buch-die-sprache-der-wale-19657782.html' + # test_article = 'https://www.faz.net/aktuell/feuilleton/buecher/film-eruption-ein-thriller-aus-dem-nachlass-von-michael-crichton-19770491.html' + # test_article = 'https://www.faz.net/aktuell/stil/mode-design/leonie-benesch-sandra-hueller-ist-eine-meiner-heldinnen-19671638.html' + # test_article = 'https://www.faz.net/aktuell/feuilleton/medien/sabine-postel-zum-siebzigsten-die-briten-nannten-sie-german-traktor-19708409.html' + # test_article = 'https://www.faz.net/aktuell/stil/mode-design/von-richert-beil-bis-william-fan-wer-kauft-denn-das-19666592.html' + # test_article = 'https://www.faz.net/aktuell/feuilleton/buecher/rezensionen/sachbuch/tom-mustills-buch-die-sprache-der-wale-19657782.html' if test_article: return [('Articles', [{'title': 'Test article', 'url': test_article}])] soup = self.index_to_soup(self.INDEX) @@ -214,7 +214,7 @@ class FazNet(BasicNewsRecipe): if len(par.contents) == 1: cont = str(par.contents[0]) if re.search(r'^[1-9]\d* Bilder$',cont): -# print(cont) + # print(cont) for tag in soup.findAll('script',attrs={'id':'__NUXT_DATA__','type':'application/json'}): bilderstrecke(soup,tag) break diff --git a/recipes/le_monde.recipe b/recipes/le_monde.recipe index 42f4e8774e..ad5dcdb11c 100644 --- a/recipes/le_monde.recipe +++ b/recipes/le_monde.recipe @@ -178,10 +178,10 @@ class LeMonde(BasicNewsRecipe): # soup = self.index_to_soup('https://www.lemonde.fr/') # a = soup.find('a', {'id': 'jelec_link', 'style': True}) # if a and a['style']: - # url = a['style'].split('/') - # if len(url) > 5 and url[3].isdigit(): - # overwrite guess if actual cover ID was found - # cover_id = url[3] + # url = a['style'].split('/') + # if len(url) > 5 and url[3].isdigit(): + # overwrite guess if actual cover ID was found + # cover_id = url[3] return 'https://www.lemonde.fr/thumbnail/journal/' + cover_id + '/1000/1490' def get_article_url(self, article): diff --git a/recipes/new_yorker.recipe b/recipes/new_yorker.recipe index 5a9c5f84df..77afa4d5fd 100644 --- a/recipes/new_yorker.recipe +++ b/recipes/new_yorker.recipe @@ -69,16 +69,16 @@ class NewYorker(BasicNewsRecipe): return soup # def preprocess_image(self, img_data, image_url): - # from PIL import Image - # from calibre import fit_image - # from io import BytesIO - # img = Image.open(BytesIO(img_data)).convert('RGB') - # scaled, nwidth, nheight = fit_image(img.width, img.height, 1024, 1024) - # if scaled: - # img = img.resize((nwidth, nheight)) - # buf = BytesIO() - # img.save(buf, format='JPEG') - # return buf.getvalue() + # from PIL import Image + # from calibre import fit_image + # from io import BytesIO + # img = Image.open(BytesIO(img_data)).convert('RGB') + # scaled, nwidth, nheight = fit_image(img.width, img.height, 1024, 1024) + # if scaled: + # img = img.resize((nwidth, nheight)) + # buf = BytesIO() + # img.save(buf, format='JPEG') + # return buf.getvalue() recipe_specific_options = { 'date': { diff --git a/recipes/ua_fooball.recipe b/recipes/ua_fooball.recipe index ce015c67dc..c5e48ef88d 100644 --- a/recipes/ua_fooball.recipe +++ b/recipes/ua_fooball.recipe @@ -6,14 +6,14 @@ from calibre.web.feeds.news import BasicNewsRecipe class UAFootball(BasicNewsRecipe): -# Russian version -# title = 'UA-\u0424\u0443\u0442\u0431\u043E\u043B' -# language = 'ru_UK' -# feeds = [ -# ('\u041D\u043E\u0432\u043E\u0441\u0442\u0438 \u0444\u0443\u0442\u0431\u043E\u043B\u0430', 'https://www.ua-football.com/rss/all.xml') -# ] + # Russian version + # title = 'UA-\u0424\u0443\u0442\u0431\u043E\u043B' + # language = 'ru_UK' + # feeds = [ + # ('\u041D\u043E\u0432\u043E\u0441\u0442\u0438 \u0444\u0443\u0442\u0431\u043E\u043B\u0430', 'https://www.ua-football.com/rss/all.xml') + # ] -# Ukrainian version + # Ukrainian version title = 'UA-\u0424\u0443\u0442\u0431\u043E\u043B' description = ('\u0410\u043A\u0442\u0443\u0430\u043B\u044C\u043D\u0456 \u0442\u0435\u043C\u0438' ' \u0444\u0443\u0442\u0431\u043E\u043B\u044C\u043D\u043E\u0433\u043E' @@ -22,7 +22,7 @@ class UAFootball(BasicNewsRecipe): language = 'uk' feeds = [ ('\u041D\u043E\u0432\u0438\u043D\u0438', 'https://www.ua-football.com/ua/rss/all.xml') - ] + ] __author__ = 'bugmen00t' publisher = '1766 TEAM EOOD' diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 8f51273b38..f9d53eaa4e 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -1487,8 +1487,8 @@ class KOBOTOUCH(KOBO): SAGE_PRODUCT_ID = [0x4231] TOUCH_PRODUCT_ID = [0x4163] TOUCH2_PRODUCT_ID = [0x4224] - LIBRA_COLOR_PRODUCT_ID = [0x4237] # This is shared by Kobo Libra Color, Clara Color and Clara BW - # as well as tolino shine 5, shine color and vision color. Sigh. + LIBRA_COLOR_PRODUCT_ID = [0x4237] # This is shared by Kobo Libra Color, Clara Color and Clara BW + # as well as tolino shine 5, shine color and vision color. Sigh. # Kobo says the following will be used in future firmware (end 2024/2025) CLARA_COLOR_PRODUCT_ID = [0x4238] CLARA_BW_PRODUCT_ID = [0x4239] diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py index fc792ab55a..c1b220f020 100644 --- a/src/calibre/utils/formatter_functions.py +++ b/src/calibre/utils/formatter_functions.py @@ -1863,7 +1863,7 @@ program: list_join('#@#', $authors, '&', list_re($#genre, ',', '^(.).*$', 'Genre: \\1'), ',') [/CODE] ''') # not translated as \1 gets mistranslated as a control char in transifex - # for some reason. And yes, the double backslash is required, for some reason. + # for some reason. And yes, the double backslash is required, for some reason. def evaluate(self, formatter, kwargs, mi, locals, with_separator, *args): if len(args) % 2 != 0: