diff --git a/recipes/polizeipress_de.recipe b/recipes/polizeipress_de.recipe index 2f4ba22277..6ff4a33f1e 100644 --- a/recipes/polizeipress_de.recipe +++ b/recipes/polizeipress_de.recipe @@ -5,7 +5,10 @@ class AdvancedUserRecipe(BasicNewsRecipe): title = u'Polizeipresse - Deutschland' __author__ = 'schuster' - description = 'Tagesaktuelle "Polizeiberichte" aus ganz Deutschland (bis auf Ortsebene).' 'Um deinen Ort/Stadt/Kreis usw. einzubinden, gehe auf "http://www.presseportal.de/polizeipresse/" und suche im oberen "Suchfeld" nach dem Namen.' 'Oberhalb der Suchergebnisse (Folgen:) auf den üblichen link zu den RSS-Feeds klicken und den RSS-link im Rezept unter "feeds" eintragen wie üblich.' 'Die Auswahl von Orten kann vereinfacht werden wenn man den Suchbegriff wie folgt eingibt:' '"Stadt-Ort".' # noqa: E501 + description = ('Tagesaktuelle "Polizeiberichte" aus ganz Deutschland (bis auf Ortsebene). ' + 'Um deinen Ort/Stadt/Kreis usw. einzubinden, gehe auf "http://www.presseportal.de/polizeipresse/" und suche im oberen "Suchfeld" nach dem Namen. ' + 'Oberhalb der Suchergebnisse (Folgen:) auf den üblichen link zu den RSS-Feeds klicken und den RSS-link im Rezept unter "feeds" eintragen wie üblich. ' + 'Die Auswahl von Orten kann vereinfacht werden wenn man den Suchbegriff wie folgt eingibt: "Stadt-Ort".') oldest_article = 21 max_articles_per_feed = 100 no_stylesheets = True diff --git a/recipes/sol_haber.recipe b/recipes/sol_haber.recipe index ea9ee3dde8..6896f66aca 100644 --- a/recipes/sol_haber.recipe +++ b/recipes/sol_haber.recipe @@ -22,7 +22,7 @@ class SolHaberRecipe(BasicNewsRecipe): language = 'tr' __author__ = 'Onur Güngör' - description = 'Hayata soL''dan bakın..' + description = "Hayata soL'dan bakın.." publisher = 'soL Haber' tags = 'news, haberler, siyaset, türkiye, turkey, politics' diff --git a/recipes/star_gazetesi.recipe b/recipes/star_gazetesi.recipe index 4a4243e964..be1723b528 100644 --- a/recipes/star_gazetesi.recipe +++ b/recipes/star_gazetesi.recipe @@ -5,7 +5,7 @@ class Star (BasicNewsRecipe): title = u'Star Gazetesi' __author__ = u'thomass' - description = 'Yeni Türkiye''nin Gazetesi' + description = "Yeni Türkiye'nin Gazetesi" oldest_article = 1 max_articles_per_feed = 10 no_stylesheets = True diff --git a/recipes/wsj.recipe b/recipes/wsj.recipe index 076925551c..cafc013445 100644 --- a/recipes/wsj.recipe +++ b/recipes/wsj.recipe @@ -143,7 +143,7 @@ class WSJ(BasicNewsRecipe): br.addheaders += [ ('Accept-Encoding', 'gzip'), ('cache-control', 'no-cache'), - ('x-api-key', ('e''b''2''4''0''8''c''d''2''7''f''8''9''1''3''d''4''2''1''f''a''3''d''5''c''3''d''0''7''c''c''f''0''3''4''c''b''4''4''8')), + ('x-api-key', ('eb2408cd27f8913d421fa3d5c3d07ccf034cb448')), ] return br diff --git a/recipes/wsj_mag.recipe b/recipes/wsj_mag.recipe index 8276f27e84..b90a286834 100644 --- a/recipes/wsj_mag.recipe +++ b/recipes/wsj_mag.recipe @@ -118,7 +118,7 @@ class WSJ(BasicNewsRecipe): br.addheaders += [ ('Accept-Encoding', 'gzip'), ('cache-control', 'no-cache'), - ('x-api-key', ('e''b''2''4''0''8''c''d''2''7''f''8''9''1''3''d''4''2''1''f''a''3''d''5''c''3''d''0''7''c''c''f''0''3''4''c''b''4''4''8')), + ('x-api-key', ('eb2408cd27f8913d421fa3d5c3d07ccf034cb448')), ] return br diff --git a/recipes/wsj_news.recipe b/recipes/wsj_news.recipe index d5a9d3e1e8..eecdc2674c 100644 --- a/recipes/wsj_news.recipe +++ b/recipes/wsj_news.recipe @@ -151,7 +151,7 @@ class WSJ(BasicNewsRecipe): br.addheaders += [ ('Accept-Encoding', 'gzip'), ('cache-control', 'no-cache'), - ('x-api-key', ('e''b''2''4''0''8''c''d''2''7''f''8''9''1''3''d''4''2''1''f''a''3''d''5''c''3''d''0''7''c''c''f''0''3''4''c''b''4''4''8')), + ('x-api-key', ('eb2408cd27f8913d421fa3d5c3d07ccf034cb448')), ] return br diff --git a/ruff-strict-pep8.toml b/ruff-strict-pep8.toml index c69667c85e..993676788c 100644 --- a/ruff-strict-pep8.toml +++ b/ruff-strict-pep8.toml @@ -22,14 +22,14 @@ quote-style = 'single' explicit-preview-rules = true ignore = [ 'E402', 'E722', 'E741', - 'UP012', 'UP030', 'UP032', 'UP038', 'C413', 'C420', 'PIE790', + 'UP012', 'UP030', 'UP032', 'UP038', 'C413', 'C420', 'PIE790', 'ISC003', 'RUF001', 'RUF002', 'RUF003', 'RUF005', 'RUF012', 'RUF013', 'RUF015', 'RUF031', 'RUF100', 'F841', # because in preview, unused tuple unpacking variable that not use dummy syntax (prefix '_' underscore) # raise error 'unused-variable', sigh (https://github.com/astral-sh/ruff/issues/8884) ] select = [ 'E', 'F', 'I', 'W', 'INT', - 'Q', 'UP', 'YTT', 'TID', 'C4', 'COM818', 'PIE', 'RET501', + 'Q', 'UP', 'YTT', 'TID', 'C4', 'COM818', 'PIE', 'RET501', 'ISC', 'RUF', # nota: RUF can flag many unsolicited errors # preview rules 'RUF051', 'RUF056', # useless dict operation @@ -41,7 +41,7 @@ select = [ 'E114', 'E115', 'E116', 'E261', 'E262', 'E265', # comment formating 'E201', 'E202', 'E211', 'E251', 'E275', # various whitespace ] -unfixable = ['PIE794'] +unfixable = ['PIE794', 'ISC001'] [lint.per-file-ignores] diff --git a/setup/changelog.py b/setup/changelog.py index ff37888f21..5317f27d03 100644 --- a/setup/changelog.py +++ b/setup/changelog.py @@ -13,7 +13,7 @@ def parse(raw, parse_dates=True): nonlocal current_entry, current_section if not stripped_line: return normal - if stripped_line.startswith('{' '{' '{'): + if stripped_line.startswith('{{{'): parts = line.split()[1:] if len(parts) != 2: raise ValueError(f'The entry start line is malformed: {line}') @@ -31,7 +31,7 @@ def parse(raw, parse_dates=True): def in_entry(linenum, line, stripped_line): nonlocal current_section, current_entry - if stripped_line == '}' '}' '}': + if stripped_line == '}}}': if current_entry is None: raise ValueError(f'Entry terminator without active entry at line: {linenum}') entries.append(current_entry) @@ -93,7 +93,7 @@ def parse(raw, parse_dates=True): if line.startswith('-'): finalize_item(item) return start_item(linenum, line, stripped_line) - if line.startswith('}' '}' '}'): + if line.startswith('}}}'): return in_entry(linenum, line, stripped_line) if not stripped_line: if 'description' not in item: @@ -138,7 +138,7 @@ def migrate(): lines = [] for entry in entries: lines.append('') - lines.append('{' '{' '{' f' {entry["version"]} {entry["date"]}') + lines.append('{{{'+f' {entry["version"]} {entry["date"]}') for w in ('new features', 'bug fixes'): nf = entry.get(w) if nf: @@ -166,7 +166,7 @@ def migrate(): lines.append('') with open(name.replace('yaml', 'txt'), 'w') as f: f.write('\n'.join(lines)) - lines.append(''), lines.append('}' '}' '}'), lines.append('') + lines.append(''), lines.append('}}}'), lines.append('') if __name__ == '__main__': diff --git a/src/calibre/db/cache.py b/src/calibre/db/cache.py index f90f30e937..1c7193993b 100644 --- a/src/calibre/db/cache.py +++ b/src/calibre/db/cache.py @@ -2113,7 +2113,7 @@ class Cache: @read_api def has_id(self, book_id): - ' Return True iff the specified book_id exists in the db ''' + ' Return True iff the specified book_id exists in the db ' return book_id in self.fields['title'].table.book_col_map @write_api diff --git a/src/calibre/db/cli/cmd_restore_database.py b/src/calibre/db/cli/cmd_restore_database.py index 3488d6585d..88169e711e 100644 --- a/src/calibre/db/cli/cmd_restore_database.py +++ b/src/calibre/db/cli/cmd_restore_database.py @@ -78,6 +78,6 @@ def main(opts, args, dbctx): name = 'calibre_db_restore_report.txt' open('calibre_db_restore_report.txt', 'wb').write(r.report.encode('utf-8')) - prints('Some errors occurred. A detailed report was ' 'saved to', name) + prints('Some errors occurred. A detailed report was saved to', name) return 0 diff --git a/src/calibre/db/restore.py b/src/calibre/db/restore.py index 5179894226..1ddc75b364 100644 --- a/src/calibre/db/restore.py +++ b/src/calibre/db/restore.py @@ -107,8 +107,8 @@ class Restore(Thread): if self.conflicting_custom_cols: ans += '\n\n' - ans += 'The following custom columns have conflicting definitions ' \ - 'and were not fully restored:\n' + ans += ('The following custom columns have conflicting definitions ' + 'and were not fully restored:\n') for x in self.conflicting_custom_cols: ans += '\t#'+x+'\n' ans += '\tused:\t%s, %s, %s, %s\n'%(self.custom_columns[x][1], diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 369ea8c31d..9878437466 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -1966,11 +1966,11 @@ class KOBOTOUCH(KOBO): return bookshelves cursor = connection.cursor() - query = 'select ShelfName ' \ - 'from ShelfContent ' \ - 'where ContentId = ? ' \ - f'and _IsDeleted = {self.bool_for_query(False)} ' \ - 'and ShelfName is not null' # This should never be null, but it is protection against an error cause by a sync to the Kobo server + query = ('select ShelfName ' + 'from ShelfContent ' + 'where ContentId = ? ' + f'and _IsDeleted = {self.bool_for_query(False)} ' + 'and ShelfName is not null') # This should never be null, but it is protection against an error cause by a sync to the Kobo server values = (ContentID, ) cursor.execute(query, values) for i, row in enumerate(cursor): diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index c9acd4e8fa..eb08cb6525 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -1,6 +1,6 @@ __license__ = 'GPL v3' -__copyright__ = '2009, John Schember ' \ - '2009, Kovid Goyal ' +__copyright__ = ('2009, John Schember ' + '2009, Kovid Goyal ') __docformat__ = 'restructuredtext en' ''' diff --git a/src/calibre/ebooks/chm/reader.py b/src/calibre/ebooks/chm/reader.py index 4bf7b2d4e0..b4b0d8efa6 100644 --- a/src/calibre/ebooks/chm/reader.py +++ b/src/calibre/ebooks/chm/reader.py @@ -1,7 +1,7 @@ ''' CHM File decoding support ''' __license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal ,' \ - ' and Alex Bramley .' +__copyright__ = ('2008, Kovid Goyal ,' + ' and Alex Bramley .') import codecs import os diff --git a/src/calibre/ebooks/conversion/plugins/chm_input.py b/src/calibre/ebooks/conversion/plugins/chm_input.py index d65a112d7b..7168985f93 100644 --- a/src/calibre/ebooks/conversion/plugins/chm_input.py +++ b/src/calibre/ebooks/conversion/plugins/chm_input.py @@ -1,7 +1,7 @@ ''' CHM File decoding support ''' __license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal ,' \ - ' and Alex Bramley .' +__copyright__ = ('2008, Kovid Goyal , ' + 'and Alex Bramley .') import os diff --git a/src/calibre/ebooks/lit/reader.py b/src/calibre/ebooks/lit/reader.py index 5666d84b53..ea9f86588f 100644 --- a/src/calibre/ebooks/lit/reader.py +++ b/src/calibre/ebooks/lit/reader.py @@ -3,8 +3,8 @@ Support for reading LIT files. ''' __license__ = 'GPL v3' -__copyright__ = '2008, Kovid Goyal ' \ - 'and Marshall T. Vandegrift ' +__copyright__ = ('2008, Kovid Goyal ' + 'and Marshall T. Vandegrift ') import functools import io @@ -429,10 +429,9 @@ class ManifestItem: return self.internal == other def __repr__(self): - return 'ManifestItem(internal=%r, path=%r, mime_type=%r, ' \ - 'offset=%d, root=%r, state=%r)' \ - % (self.internal, self.path, self.mime_type, self.offset, - self.root, self.state) + return ( + 'ManifestItem(internal=%r, path=%r, mime_type=%r, offset=%d, root=%r, state=%r)' + ) % (self.internal, self.path, self.mime_type, self.offset, self.root, self.state) def preserve(function): diff --git a/src/calibre/ebooks/lit/writer.py b/src/calibre/ebooks/lit/writer.py index 52ec2f44a9..29644d14b3 100644 --- a/src/calibre/ebooks/lit/writer.py +++ b/src/calibre/ebooks/lit/writer.py @@ -93,25 +93,28 @@ ULL_NEG1 = 0xffffffffffffffff ROOT_OFFSET = 1284508585713721976 ROOT_SIZE = 4165955342166943123 -BLOCK_CAOL = \ - b'\x43\x41\x4f\x4c\x02\x00\x00\x00' \ - b'\x50\x00\x00\x00\x37\x13\x03\x00' \ - b'\x00\x00\x00\x00\x00\x20\x00\x00' \ - b'\x00\x02\x00\x00\x00\x00\x10\x00' \ - b'\x00\x00\x02\x00\x00\x00\x00\x00' \ +BLOCK_CAOL = ( + b'\x43\x41\x4f\x4c\x02\x00\x00\x00' + b'\x50\x00\x00\x00\x37\x13\x03\x00' + b'\x00\x00\x00\x00\x00\x20\x00\x00' + b'\x00\x02\x00\x00\x00\x00\x10\x00' + b'\x00\x00\x02\x00\x00\x00\x00\x00' b'\x00\x00\x00\x00\x00\x00\x00\x00' -BLOCK_ITSF = \ - b'\x49\x54\x53\x46\x04\x00\x00\x00' \ +) +BLOCK_ITSF = ( + b'\x49\x54\x53\x46\x04\x00\x00\x00' b'\x20\x00\x00\x00\x01\x00\x00\x00' - -MSDES_CONTROL = \ - b'\x03\x00\x00\x00\x29\x17\x00\x00' \ +) +MSDES_CONTROL = ( + b'\x03\x00\x00\x00\x29\x17\x00\x00' b'\x01\x00\x00\x00\xa5\xa5\x00\x00' -LZXC_CONTROL = \ - b'\x07\x00\x00\x00\x4c\x5a\x58\x43' \ - b'\x03\x00\x00\x00\x04\x00\x00\x00' \ - b'\x04\x00\x00\x00\x02\x00\x00\x00' \ +) +LZXC_CONTROL = ( + b'\x07\x00\x00\x00\x4c\x5a\x58\x43' + b'\x03\x00\x00\x00\x04\x00\x00\x00' + b'\x04\x00\x00\x00\x02\x00\x00\x00' b'\x00\x00\x00\x00\x00\x00\x00\x00' +) COLLAPSE = re.compile(r'[ \t\r\n\v]+') diff --git a/src/calibre/ebooks/metadata/fb2.py b/src/calibre/ebooks/metadata/fb2.py index 6eac38edb1..387af167b9 100644 --- a/src/calibre/ebooks/metadata/fb2.py +++ b/src/calibre/ebooks/metadata/fb2.py @@ -2,8 +2,8 @@ __license__ = 'GPL v3' -__copyright__ = '2011, Roman Mukhin , '\ - '2008, Anatoly Shipitsin ' +__copyright__ = ('2011, Roman Mukhin , ' + '2008, Anatoly Shipitsin ') '''Read meta information from fb2 files''' import os diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 71ca480ae9..7c81929f13 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -455,7 +455,8 @@ ASCII_CHARS = frozenset(codepoint_to_chr(x) for x in range(128)) UNIBYTE_CHARS = frozenset(x.encode('ascii') for x in ASCII_CHARS) USAFE = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' - '0123456789' '_.-/~') + '0123456789' + '_.-/~') URL_SAFE = frozenset(USAFE) URL_SAFE_BYTES = frozenset(USAFE.encode('ascii')) URL_UNSAFE = [ASCII_CHARS - URL_SAFE, UNIBYTE_CHARS - URL_SAFE_BYTES] diff --git a/src/calibre/ebooks/rtf2xml/ParseRtf.py b/src/calibre/ebooks/rtf2xml/ParseRtf.py index 83f1d668f1..0fc1fef992 100644 --- a/src/calibre/ebooks/rtf2xml/ParseRtf.py +++ b/src/calibre/ebooks/rtf2xml/ParseRtf.py @@ -415,8 +415,7 @@ class ParseRtf: old_rtf = old_rtf_obj.check_if_old_rtf() if old_rtf: if self.__run_level > 5: - msg = 'Older RTF\n' \ - 'self.__run_level is "%s"\n' % self.__run_level + msg = 'Older RTF\nself.__run_level is "%s"\n' % self.__run_level raise RtfInvalidCodeException(msg) if self.__run_level > 1: sys.stderr.write('File could be older RTF...\n')