mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
implicit string concatenation (manual)
ruff 'ISC'
This commit is contained in:
parent
ce83e97a7c
commit
ac4fbfc7c9
@ -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
|
||||
|
@ -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'
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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]
|
||||
|
@ -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__':
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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],
|
||||
|
@ -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):
|
||||
|
@ -1,6 +1,6 @@
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, John Schember <john at nachtimwald.com> ' \
|
||||
'2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__copyright__ = ('2009, John Schember <john at nachtimwald.com> '
|
||||
'2009, Kovid Goyal <kovid@kovidgoyal.net>')
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
|
@ -1,7 +1,7 @@
|
||||
''' CHM File decoding support '''
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>,' \
|
||||
' and Alex Bramley <a.bramley at gmail.com>.'
|
||||
__copyright__ = ('2008, Kovid Goyal <kovid at kovidgoyal.net>,'
|
||||
' and Alex Bramley <a.bramley at gmail.com>.')
|
||||
|
||||
import codecs
|
||||
import os
|
||||
|
@ -1,7 +1,7 @@
|
||||
''' CHM File decoding support '''
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>,' \
|
||||
' and Alex Bramley <a.bramley at gmail.com>.'
|
||||
__copyright__ = ('2008, Kovid Goyal <kovid at kovidgoyal.net>, '
|
||||
'and Alex Bramley <a.bramley at gmail.com>.')
|
||||
|
||||
import os
|
||||
|
||||
|
@ -3,8 +3,8 @@ Support for reading LIT files.
|
||||
'''
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net> ' \
|
||||
'and Marshall T. Vandegrift <llasram@gmail.com>'
|
||||
__copyright__ = ('2008, Kovid Goyal <kovid at kovidgoyal.net> '
|
||||
'and Marshall T. Vandegrift <llasram@gmail.com>')
|
||||
|
||||
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):
|
||||
|
@ -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]+')
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2011, Roman Mukhin <ramses_ru at hotmail.com>, '\
|
||||
'2008, Anatoly Shipitsin <norguhtar at gmail.com>'
|
||||
__copyright__ = ('2011, Roman Mukhin <ramses_ru at hotmail.com>, '
|
||||
'2008, Anatoly Shipitsin <norguhtar at gmail.com>')
|
||||
'''Read meta information from fb2 files'''
|
||||
|
||||
import os
|
||||
|
@ -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]
|
||||
|
@ -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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user