diff --git a/recipes/wsj.recipe b/recipes/wsj.recipe index cafc013445..076925551c 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', ('eb2408cd27f8913d421fa3d5c3d07ccf034cb448')), + ('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')), ] return br diff --git a/recipes/wsj_mag.recipe b/recipes/wsj_mag.recipe index b90a286834..8276f27e84 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', ('eb2408cd27f8913d421fa3d5c3d07ccf034cb448')), + ('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')), ] return br diff --git a/recipes/wsj_news.recipe b/recipes/wsj_news.recipe index eecdc2674c..d5a9d3e1e8 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', ('eb2408cd27f8913d421fa3d5c3d07ccf034cb448')), + ('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')), ] return br diff --git a/setup/__init__.py b/setup/__init__.py index 213fa3687e..6ff26e01cd 100644 --- a/setup/__init__.py +++ b/setup/__init__.py @@ -126,7 +126,7 @@ def initialize_constants(): with open(os.path.join(SRC, 'calibre/constants.py'), 'rb') as f: src = f.read().decode('utf-8') nv = re.search(r'numeric_version\s+=\s+\((\d+), (\d+), (\d+)\)', src) - __version__ = '.'.join([nv.group(1), nv.group(2), nv.group(3)]) + __version__ = '.'.join((nv.group(1), nv.group(2), nv.group(3))) __appname__ = re.search(r'__appname__\s+=\s+(u{0,1})[\'"]([^\'"]+)[\'"]', src).group(2) with open(os.path.join(SRC, 'calibre/linux.py'), 'rb') as sf: diff --git a/setup/changelog.py b/setup/changelog.py index 5317f27d03..315288d866 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/cli/cmd_add.py b/src/calibre/db/cli/cmd_add.py index 7e8b9e60d9..f8df3a12e4 100644 --- a/src/calibre/db/cli/cmd_add.py +++ b/src/calibre/db/cli/cmd_add.py @@ -163,7 +163,7 @@ def format_group(db, notify_changes, is_remote, args): mi = metadata_from_formats(paths) if mi.title is None: return None, set(), set(), False - if (cover_data and not mi.cover_data) or not mi.cover_data[1]: + if cover_data and (not mi.cover_data or not mi.cover_data[1]): mi.cover_data = 'jpeg', cover_data format_map = create_format_map(paths) added_ids, updated_ids, duplicates = do_adding( diff --git a/src/calibre/ebooks/conversion/plugins/epub_input.py b/src/calibre/ebooks/conversion/plugins/epub_input.py index f60e6230d0..c3f530f259 100644 --- a/src/calibre/ebooks/conversion/plugins/epub_input.py +++ b/src/calibre/ebooks/conversion/plugins/epub_input.py @@ -46,7 +46,7 @@ class EPUBInput(InputFormatPlugin): from lxml import etree idpf_key = opf.raw_unique_identifier if idpf_key: - idpf_key = re.sub(r'[\u0020\u0009\u000d\u000a]', '', idpf_key) + idpf_key = re.sub(r'[ \t\r\n]', '', idpf_key) idpf_key = hashlib.sha1(idpf_key.encode('utf-8')).digest() key = None for item in opf.identifier_iter(): diff --git a/src/calibre/ebooks/conversion/utils.py b/src/calibre/ebooks/conversion/utils.py index 6e40d32a31..34985bf9e9 100644 --- a/src/calibre/ebooks/conversion/utils.py +++ b/src/calibre/ebooks/conversion/utils.py @@ -58,7 +58,7 @@ class HeuristicProcessor: return '