implicit string concatenation (manual)

ruff 'ISC'
This commit is contained in:
un-pogaz 2025-01-24 11:14:25 +01:00
parent ce83e97a7c
commit ac4fbfc7c9
20 changed files with 60 additions and 55 deletions

View File

@ -5,7 +5,10 @@ class AdvancedUserRecipe(BasicNewsRecipe):
title = u'Polizeipresse - Deutschland' title = u'Polizeipresse - Deutschland'
__author__ = 'schuster' __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 oldest_article = 21
max_articles_per_feed = 100 max_articles_per_feed = 100
no_stylesheets = True no_stylesheets = True

View File

@ -22,7 +22,7 @@ class SolHaberRecipe(BasicNewsRecipe):
language = 'tr' language = 'tr'
__author__ = 'Onur Güngör' __author__ = 'Onur Güngör'
description = 'Hayata soL''dan bakın..' description = "Hayata soL'dan bakın.."
publisher = 'soL Haber' publisher = 'soL Haber'
tags = 'news, haberler, siyaset, türkiye, turkey, politics' tags = 'news, haberler, siyaset, türkiye, turkey, politics'

View File

@ -5,7 +5,7 @@ class Star (BasicNewsRecipe):
title = u'Star Gazetesi' title = u'Star Gazetesi'
__author__ = u'thomass' __author__ = u'thomass'
description = 'Yeni Türkiye''nin Gazetesi' description = "Yeni Türkiye'nin Gazetesi"
oldest_article = 1 oldest_article = 1
max_articles_per_feed = 10 max_articles_per_feed = 10
no_stylesheets = True no_stylesheets = True

View File

@ -143,7 +143,7 @@ class WSJ(BasicNewsRecipe):
br.addheaders += [ br.addheaders += [
('Accept-Encoding', 'gzip'), ('Accept-Encoding', 'gzip'),
('cache-control', 'no-cache'), ('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 return br

View File

@ -118,7 +118,7 @@ class WSJ(BasicNewsRecipe):
br.addheaders += [ br.addheaders += [
('Accept-Encoding', 'gzip'), ('Accept-Encoding', 'gzip'),
('cache-control', 'no-cache'), ('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 return br

View File

@ -151,7 +151,7 @@ class WSJ(BasicNewsRecipe):
br.addheaders += [ br.addheaders += [
('Accept-Encoding', 'gzip'), ('Accept-Encoding', 'gzip'),
('cache-control', 'no-cache'), ('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 return br

View File

@ -22,14 +22,14 @@ quote-style = 'single'
explicit-preview-rules = true explicit-preview-rules = true
ignore = [ ignore = [
'E402', 'E722', 'E741', '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', 'RUF001', 'RUF002', 'RUF003', 'RUF005', 'RUF012', 'RUF013', 'RUF015', 'RUF031', 'RUF100',
'F841', # because in preview, unused tuple unpacking variable that not use dummy syntax (prefix '_' underscore) '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) # raise error 'unused-variable', sigh (https://github.com/astral-sh/ruff/issues/8884)
] ]
select = [ select = [
'E', 'F', 'I', 'W', 'INT', '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 'RUF', # nota: RUF can flag many unsolicited errors
# preview rules # preview rules
'RUF051', 'RUF056', # useless dict operation 'RUF051', 'RUF056', # useless dict operation
@ -41,7 +41,7 @@ select = [
'E114', 'E115', 'E116', 'E261', 'E262', 'E265', # comment formating 'E114', 'E115', 'E116', 'E261', 'E262', 'E265', # comment formating
'E201', 'E202', 'E211', 'E251', 'E275', # various whitespace 'E201', 'E202', 'E211', 'E251', 'E275', # various whitespace
] ]
unfixable = ['PIE794'] unfixable = ['PIE794', 'ISC001']
[lint.per-file-ignores] [lint.per-file-ignores]

View File

@ -13,7 +13,7 @@ def parse(raw, parse_dates=True):
nonlocal current_entry, current_section nonlocal current_entry, current_section
if not stripped_line: if not stripped_line:
return normal return normal
if stripped_line.startswith('{' '{' '{'): if stripped_line.startswith('{{{'):
parts = line.split()[1:] parts = line.split()[1:]
if len(parts) != 2: if len(parts) != 2:
raise ValueError(f'The entry start line is malformed: {line}') 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): def in_entry(linenum, line, stripped_line):
nonlocal current_section, current_entry nonlocal current_section, current_entry
if stripped_line == '}' '}' '}': if stripped_line == '}}}':
if current_entry is None: if current_entry is None:
raise ValueError(f'Entry terminator without active entry at line: {linenum}') raise ValueError(f'Entry terminator without active entry at line: {linenum}')
entries.append(current_entry) entries.append(current_entry)
@ -93,7 +93,7 @@ def parse(raw, parse_dates=True):
if line.startswith('-'): if line.startswith('-'):
finalize_item(item) finalize_item(item)
return start_item(linenum, line, stripped_line) return start_item(linenum, line, stripped_line)
if line.startswith('}' '}' '}'): if line.startswith('}}}'):
return in_entry(linenum, line, stripped_line) return in_entry(linenum, line, stripped_line)
if not stripped_line: if not stripped_line:
if 'description' not in item: if 'description' not in item:
@ -138,7 +138,7 @@ def migrate():
lines = [] lines = []
for entry in entries: for entry in entries:
lines.append('') lines.append('')
lines.append('{' '{' '{' f' {entry["version"]} {entry["date"]}') lines.append('{{{'+f' {entry["version"]} {entry["date"]}')
for w in ('new features', 'bug fixes'): for w in ('new features', 'bug fixes'):
nf = entry.get(w) nf = entry.get(w)
if nf: if nf:
@ -166,7 +166,7 @@ def migrate():
lines.append('') lines.append('')
with open(name.replace('yaml', 'txt'), 'w') as f: with open(name.replace('yaml', 'txt'), 'w') as f:
f.write('\n'.join(lines)) f.write('\n'.join(lines))
lines.append(''), lines.append('}' '}' '}'), lines.append('') lines.append(''), lines.append('}}}'), lines.append('')
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -2113,7 +2113,7 @@ class Cache:
@read_api @read_api
def has_id(self, book_id): 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 return book_id in self.fields['title'].table.book_col_map
@write_api @write_api

View File

@ -78,6 +78,6 @@ def main(opts, args, dbctx):
name = 'calibre_db_restore_report.txt' name = 'calibre_db_restore_report.txt'
open('calibre_db_restore_report.txt', open('calibre_db_restore_report.txt',
'wb').write(r.report.encode('utf-8')) '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 return 0

View File

@ -107,8 +107,8 @@ class Restore(Thread):
if self.conflicting_custom_cols: if self.conflicting_custom_cols:
ans += '\n\n' ans += '\n\n'
ans += 'The following custom columns have conflicting definitions ' \ ans += ('The following custom columns have conflicting definitions '
'and were not fully restored:\n' 'and were not fully restored:\n')
for x in self.conflicting_custom_cols: for x in self.conflicting_custom_cols:
ans += '\t#'+x+'\n' ans += '\t#'+x+'\n'
ans += '\tused:\t%s, %s, %s, %s\n'%(self.custom_columns[x][1], ans += '\tused:\t%s, %s, %s, %s\n'%(self.custom_columns[x][1],

View File

@ -1966,11 +1966,11 @@ class KOBOTOUCH(KOBO):
return bookshelves return bookshelves
cursor = connection.cursor() cursor = connection.cursor()
query = 'select ShelfName ' \ query = ('select ShelfName '
'from ShelfContent ' \ 'from ShelfContent '
'where ContentId = ? ' \ 'where ContentId = ? '
f'and _IsDeleted = {self.bool_for_query(False)} ' \ 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 '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, ) values = (ContentID, )
cursor.execute(query, values) cursor.execute(query, values)
for i, row in enumerate(cursor): for i, row in enumerate(cursor):

View File

@ -1,6 +1,6 @@
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2009, John Schember <john at nachtimwald.com> ' \ __copyright__ = ('2009, John Schember <john at nachtimwald.com> '
'2009, Kovid Goyal <kovid@kovidgoyal.net>' '2009, Kovid Goyal <kovid@kovidgoyal.net>')
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
''' '''

View File

@ -1,7 +1,7 @@
''' CHM File decoding support ''' ''' CHM File decoding support '''
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>,' \ __copyright__ = ('2008, Kovid Goyal <kovid at kovidgoyal.net>,'
' and Alex Bramley <a.bramley at gmail.com>.' ' and Alex Bramley <a.bramley at gmail.com>.')
import codecs import codecs
import os import os

View File

@ -1,7 +1,7 @@
''' CHM File decoding support ''' ''' CHM File decoding support '''
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>,' \ __copyright__ = ('2008, Kovid Goyal <kovid at kovidgoyal.net>, '
' and Alex Bramley <a.bramley at gmail.com>.' 'and Alex Bramley <a.bramley at gmail.com>.')
import os import os

View File

@ -3,8 +3,8 @@ Support for reading LIT files.
''' '''
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net> ' \ __copyright__ = ('2008, Kovid Goyal <kovid at kovidgoyal.net> '
'and Marshall T. Vandegrift <llasram@gmail.com>' 'and Marshall T. Vandegrift <llasram@gmail.com>')
import functools import functools
import io import io
@ -429,10 +429,9 @@ class ManifestItem:
return self.internal == other return self.internal == other
def __repr__(self): def __repr__(self):
return 'ManifestItem(internal=%r, path=%r, mime_type=%r, ' \ return (
'offset=%d, root=%r, state=%r)' \ 'ManifestItem(internal=%r, path=%r, mime_type=%r, offset=%d, root=%r, state=%r)'
% (self.internal, self.path, self.mime_type, self.offset, ) % (self.internal, self.path, self.mime_type, self.offset, self.root, self.state)
self.root, self.state)
def preserve(function): def preserve(function):

View File

@ -93,25 +93,28 @@ ULL_NEG1 = 0xffffffffffffffff
ROOT_OFFSET = 1284508585713721976 ROOT_OFFSET = 1284508585713721976
ROOT_SIZE = 4165955342166943123 ROOT_SIZE = 4165955342166943123
BLOCK_CAOL = \ BLOCK_CAOL = (
b'\x43\x41\x4f\x4c\x02\x00\x00\x00' \ b'\x43\x41\x4f\x4c\x02\x00\x00\x00'
b'\x50\x00\x00\x00\x37\x13\x03\x00' \ b'\x50\x00\x00\x00\x37\x13\x03\x00'
b'\x00\x00\x00\x00\x00\x20\x00\x00' \ b'\x00\x00\x00\x00\x00\x20\x00\x00'
b'\x00\x02\x00\x00\x00\x00\x10\x00' \ b'\x00\x02\x00\x00\x00\x00\x10\x00'
b'\x00\x00\x02\x00\x00\x00\x00\x00' \ b'\x00\x00\x02\x00\x00\x00\x00\x00'
b'\x00\x00\x00\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' b'\x20\x00\x00\x00\x01\x00\x00\x00'
)
MSDES_CONTROL = \ MSDES_CONTROL = (
b'\x03\x00\x00\x00\x29\x17\x00\x00' \ b'\x03\x00\x00\x00\x29\x17\x00\x00'
b'\x01\x00\x00\x00\xa5\xa5\x00\x00' b'\x01\x00\x00\x00\xa5\xa5\x00\x00'
LZXC_CONTROL = \ )
b'\x07\x00\x00\x00\x4c\x5a\x58\x43' \ LZXC_CONTROL = (
b'\x03\x00\x00\x00\x04\x00\x00\x00' \ b'\x07\x00\x00\x00\x4c\x5a\x58\x43'
b'\x04\x00\x00\x00\x02\x00\x00\x00' \ 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' b'\x00\x00\x00\x00\x00\x00\x00\x00'
)
COLLAPSE = re.compile(r'[ \t\r\n\v]+') COLLAPSE = re.compile(r'[ \t\r\n\v]+')

View File

@ -2,8 +2,8 @@
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2011, Roman Mukhin <ramses_ru at hotmail.com>, '\ __copyright__ = ('2011, Roman Mukhin <ramses_ru at hotmail.com>, '
'2008, Anatoly Shipitsin <norguhtar at gmail.com>' '2008, Anatoly Shipitsin <norguhtar at gmail.com>')
'''Read meta information from fb2 files''' '''Read meta information from fb2 files'''
import os import os

View File

@ -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) UNIBYTE_CHARS = frozenset(x.encode('ascii') for x in ASCII_CHARS)
USAFE = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ' USAFE = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ'
'abcdefghijklmnopqrstuvwxyz' 'abcdefghijklmnopqrstuvwxyz'
'0123456789' '_.-/~') '0123456789'
'_.-/~')
URL_SAFE = frozenset(USAFE) URL_SAFE = frozenset(USAFE)
URL_SAFE_BYTES = frozenset(USAFE.encode('ascii')) URL_SAFE_BYTES = frozenset(USAFE.encode('ascii'))
URL_UNSAFE = [ASCII_CHARS - URL_SAFE, UNIBYTE_CHARS - URL_SAFE_BYTES] URL_UNSAFE = [ASCII_CHARS - URL_SAFE, UNIBYTE_CHARS - URL_SAFE_BYTES]

View File

@ -415,8 +415,7 @@ class ParseRtf:
old_rtf = old_rtf_obj.check_if_old_rtf() old_rtf = old_rtf_obj.check_if_old_rtf()
if old_rtf: if old_rtf:
if self.__run_level > 5: if self.__run_level > 5:
msg = 'Older RTF\n' \ msg = 'Older RTF\nself.__run_level is "%s"\n' % self.__run_level
'self.__run_level is "%s"\n' % self.__run_level
raise RtfInvalidCodeException(msg) raise RtfInvalidCodeException(msg)
if self.__run_level > 1: if self.__run_level > 1:
sys.stderr.write('File could be older RTF...\n') sys.stderr.write('File could be older RTF...\n')