mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
useless tuple (extra-edit)
This commit is contained in:
parent
ed2930712d
commit
59cd38256a
@ -78,7 +78,7 @@ class AM730(BasicNewsRecipe):
|
||||
break
|
||||
if self.debug:
|
||||
print(articles)
|
||||
return (sectionName,articles)
|
||||
return sectionName, articles
|
||||
|
||||
def parse_index(self):
|
||||
# hard code sections
|
||||
@ -91,7 +91,7 @@ class AM730(BasicNewsRecipe):
|
||||
('旅遊.飲食','https://www.am730.com.hk/news/%E6%97%85%E9%81%8A.%E9%A3%B2%E9%A3%9F')
|
||||
] # articles =[]
|
||||
SectionsArticles=[]
|
||||
for (title, url) in Sections:
|
||||
for title, url in Sections:
|
||||
if self.debug:
|
||||
print(title)
|
||||
print(url)
|
||||
|
@ -309,7 +309,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
for wdiv in mainsoup.findAll(attrs={'class': ['headline', 'featurecontent']}):
|
||||
handle_article(wdiv, key)
|
||||
|
||||
for (k, url) in self.postmedia_index_pages:
|
||||
for k,url in self.postmedia_index_pages:
|
||||
parse_web_index(k, url)
|
||||
ans = [(key, articles[key]) for key in ans if key in articles]
|
||||
return ans
|
||||
|
@ -309,7 +309,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
for wdiv in mainsoup.findAll(attrs={'class': ['headline', 'featurecontent']}):
|
||||
handle_article(wdiv, key)
|
||||
|
||||
for (k, url) in self.postmedia_index_pages:
|
||||
for k,url in self.postmedia_index_pages:
|
||||
parse_web_index(k, url)
|
||||
ans = [(key, articles[key]) for key in ans if key in articles]
|
||||
return ans
|
||||
|
@ -51,7 +51,7 @@ class AdvancedUserRecipe1639926896(BasicNewsRecipe):
|
||||
lines = description.split('\n')
|
||||
return '\n'.join([line.strip() for line in lines if len(line.strip()) > 0])
|
||||
|
||||
for (section_name, section_url_name) in self.sections:
|
||||
for section_name, section_url_name in self.sections:
|
||||
soup = self.index_to_soup(
|
||||
f'https://www.equestriadaily.com/search/label/{section_url_name}?max-results={self.max_articles_per_feed}')
|
||||
articles = soup.select('div.post.hentry')
|
||||
|
@ -47,7 +47,7 @@ class GrantLand(BasicNewsRecipe):
|
||||
|
||||
for category in self.CATEGORIES:
|
||||
|
||||
(cat_name, tag, max_articles) = category
|
||||
cat_name, tag, max_articles = category
|
||||
self.log('Reading category:', cat_name)
|
||||
articles = []
|
||||
|
||||
|
@ -85,7 +85,7 @@ class IlPost(BasicNewsRecipe):
|
||||
'title': title,
|
||||
'description': desc
|
||||
})
|
||||
return (name, entries)
|
||||
return name, entries
|
||||
|
||||
def parse_index(self):
|
||||
feeds = []
|
||||
|
@ -309,7 +309,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
for wdiv in mainsoup.findAll(attrs={'class': ['headline', 'featurecontent']}):
|
||||
handle_article(wdiv, key)
|
||||
|
||||
for (k, url) in self.postmedia_index_pages:
|
||||
for k,url in self.postmedia_index_pages:
|
||||
parse_web_index(k, url)
|
||||
ans = [(key, articles[key]) for key in ans if key in articles]
|
||||
return ans
|
||||
|
@ -309,7 +309,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
for wdiv in mainsoup.findAll(attrs={'class': ['headline', 'featurecontent']}):
|
||||
handle_article(wdiv, key)
|
||||
|
||||
for (k, url) in self.postmedia_index_pages:
|
||||
for k,url in self.postmedia_index_pages:
|
||||
parse_web_index(k, url)
|
||||
ans = [(key, articles[key]) for key in ans if key in articles]
|
||||
return ans
|
||||
|
@ -53,7 +53,7 @@ class SaturdayPaper(BasicNewsRecipe):
|
||||
|
||||
articles = []
|
||||
|
||||
for (feed, link) in feeds:
|
||||
for feed, link in feeds:
|
||||
soup = self.index_to_soup(link)
|
||||
news = []
|
||||
|
||||
|
@ -100,10 +100,10 @@ class PrivateEyeRecipe(BasicNewsRecipe):
|
||||
return head.rsplit('. By ', 1)
|
||||
matches = self.title_author_re.findall(head)
|
||||
if matches and len(matches[0]) == 3:
|
||||
(title_1, author, title_2) = matches[0]
|
||||
title_1, author, title_2 = matches[0]
|
||||
title = ': '.join((title_1, title_2))
|
||||
return (title, author)
|
||||
return (head, None)
|
||||
return title, author
|
||||
return head, None
|
||||
|
||||
# Return the list of articles from blocks in the content of an index/listing page
|
||||
def parse_content(self, soup):
|
||||
@ -117,7 +117,7 @@ class PrivateEyeRecipe(BasicNewsRecipe):
|
||||
for article in content.findAll('div', class_='listing-block'):
|
||||
for a in article.findAll('a', href=True):
|
||||
for h in a.findAll('h3'):
|
||||
(title, author) = self.title_author(h.getText())
|
||||
title, author = self.title_author(h.getText())
|
||||
content_articles.append(self.article_entry(
|
||||
title=title,
|
||||
url=self.abs_url(a.get('href')),
|
||||
@ -155,7 +155,7 @@ class PrivateEyeRecipe(BasicNewsRecipe):
|
||||
self.log('Subpages found:', href, len(content))
|
||||
articles.extend(content)
|
||||
else:
|
||||
(title, author) = self.title_author(a.getText())
|
||||
title, author = self.title_author(a.getText())
|
||||
articles.append(self.article_entry(
|
||||
title=title,
|
||||
url=self.abs_url(a.get('href')),
|
||||
@ -176,7 +176,7 @@ class PrivateEyeRecipe(BasicNewsRecipe):
|
||||
|
||||
# 4. The about pages
|
||||
abouts = []
|
||||
for (title, url) in self.about_pages.items():
|
||||
for title, url in self.about_pages.items():
|
||||
abouts.append({
|
||||
'title': title,
|
||||
'url': url,
|
||||
@ -190,7 +190,7 @@ class PrivateEyeRecipe(BasicNewsRecipe):
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
for h in soup.findAll('h1'):
|
||||
(title, author) = self.title_author(h.getText())
|
||||
title, author = self.title_author(h.getText())
|
||||
self.log('Replacing h3 "', h.getText(), '" with "', title, '"')
|
||||
h.string = title
|
||||
|
||||
|
@ -322,7 +322,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
for wdiv in mainsoup.findAll(attrs={'class': ['headline', 'featurecontent']}):
|
||||
handle_article(wdiv, key)
|
||||
|
||||
for (k, url) in self.postmedia_index_pages:
|
||||
for k,url in self.postmedia_index_pages:
|
||||
parse_web_index(k, url)
|
||||
ans = [(key, articles[key]) for key in ans if key in articles]
|
||||
return ans
|
||||
|
@ -310,7 +310,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
for wdiv in mainsoup.findAll(attrs={'class': ['headline', 'featurecontent']}):
|
||||
handle_article(wdiv, key)
|
||||
|
||||
for (k, url) in self.postmedia_index_pages:
|
||||
for k,url in self.postmedia_index_pages:
|
||||
parse_web_index(k, url)
|
||||
ans = [(key, articles[key]) for key in ans if key in articles]
|
||||
return ans
|
||||
|
@ -253,6 +253,6 @@ class TimesColonist(BasicNewsRecipe):
|
||||
|
||||
def parse_index(self):
|
||||
ans = []
|
||||
for (url, title) in self.section_list:
|
||||
for url, title in self.section_list:
|
||||
ans = self.add_section_index(ans, url, title)
|
||||
return ans
|
||||
|
@ -224,7 +224,7 @@ class ZeitEPUBAbo(BasicNewsRecipe):
|
||||
|
||||
# doing regular expression filtering
|
||||
for path in walk('.'):
|
||||
(shortname, extension) = os.path.splitext(path)
|
||||
shortname, extension = os.path.splitext(path)
|
||||
if extension.lower() in ('.html', '.htm', '.xhtml'):
|
||||
with open(path, 'r+b') as f:
|
||||
raw = f.read()
|
||||
|
@ -56,16 +56,16 @@ def _get_series_values(val):
|
||||
import re
|
||||
series_index_pat = re.compile(r'(.*)\s+\[([.0-9]+)\]$')
|
||||
if not val:
|
||||
return (val, None)
|
||||
return val, None
|
||||
match = series_index_pat.match(val.strip())
|
||||
if match is not None:
|
||||
idx = match.group(2)
|
||||
try:
|
||||
idx = float(idx)
|
||||
return (match.group(1).strip(), idx)
|
||||
return match.group(1).strip(), idx
|
||||
except:
|
||||
pass
|
||||
return (val, None)
|
||||
return val, None
|
||||
|
||||
|
||||
def get_data_as_dict(self, prefix=None, authors_as_string=False, ids=None, convert_to_local_tz=True):
|
||||
|
@ -697,7 +697,7 @@ class DB:
|
||||
self.deleted_fields = []
|
||||
with self.conn:
|
||||
# Delete previously marked custom columns
|
||||
for (num, label) in self.conn.get(
|
||||
for num, label in self.conn.get(
|
||||
'SELECT id,label FROM custom_columns WHERE mark_for_delete=1'):
|
||||
table, lt = self.custom_table_names(num)
|
||||
self.execute('''\
|
||||
@ -2455,9 +2455,7 @@ class DB:
|
||||
ts = now.isoformat()
|
||||
timestamp = (now - EPOCH).total_seconds()
|
||||
for annot_id in annot_ids:
|
||||
for (raw_annot_data, annot_type) in self.execute(
|
||||
'SELECT annot_data, annot_type FROM annotations WHERE id=?', (annot_id,)
|
||||
):
|
||||
for raw_annot_data, annot_type in self.execute('SELECT annot_data, annot_type FROM annotations WHERE id=?', (annot_id,)):
|
||||
try:
|
||||
annot_data = json.loads(raw_annot_data)
|
||||
except Exception:
|
||||
|
@ -721,8 +721,8 @@ class LibraryDatabase:
|
||||
if isinstance(ans, tuple):
|
||||
ans = list(ans)
|
||||
if data['datatype'] != 'series':
|
||||
return (ans, None)
|
||||
return (ans, self.new_api.field_for(self.custom_field_name(label, num) + '_index', book_id))
|
||||
return ans, None
|
||||
return ans, self.new_api.field_for(self.custom_field_name(label, num) + '_index', book_id)
|
||||
|
||||
def get_next_cc_series_num_for(self, series, label=None, num=None):
|
||||
data = self.backend.custom_field_metadata(label, num)
|
||||
|
@ -125,7 +125,7 @@ class SHLock: # {{{
|
||||
# If there are waiting shared locks, issue them
|
||||
# all and them wake everyone up.
|
||||
if self._shared_queue:
|
||||
for (thread, waiter) in self._shared_queue:
|
||||
for thread, waiter in self._shared_queue:
|
||||
self.is_shared += 1
|
||||
self._shared_owners[thread] = 1
|
||||
waiter.notify()
|
||||
@ -133,7 +133,7 @@ class SHLock: # {{{
|
||||
# Otherwise, if there are waiting exclusive locks,
|
||||
# they get first dibbs on the lock.
|
||||
elif self._exclusive_queue:
|
||||
(thread, waiter) = self._exclusive_queue.pop(0)
|
||||
thread, waiter = self._exclusive_queue.pop(0)
|
||||
self._exclusive_owner = thread
|
||||
self.is_exclusive += 1
|
||||
waiter.notify()
|
||||
@ -149,7 +149,7 @@ class SHLock: # {{{
|
||||
# If there are waiting exclusive locks,
|
||||
# they get first dibbs on the lock.
|
||||
if self._exclusive_queue:
|
||||
(thread, waiter) = self._exclusive_queue.pop(0)
|
||||
thread, waiter = self._exclusive_queue.pop(0)
|
||||
self._exclusive_owner = thread
|
||||
self.is_exclusive += 1
|
||||
waiter.notify()
|
||||
|
@ -280,7 +280,7 @@ class Notes:
|
||||
if field_name:
|
||||
return {item_id for (item_id,) in conn.execute('SELECT item FROM notes_db.notes WHERE colname=?', (field_name,))}
|
||||
ans = defaultdict(set)
|
||||
for (note_id, field_name) in conn.execute('SELECT item, colname FROM notes_db.notes'):
|
||||
for note_id, field_name in conn.execute('SELECT item, colname FROM notes_db.notes'):
|
||||
ans[field_name].add(note_id)
|
||||
return ans
|
||||
|
||||
|
@ -162,10 +162,10 @@ class Restore(Thread):
|
||||
self.tb = traceback.format_exc()
|
||||
if self.failed_dirs:
|
||||
for x in self.failed_dirs:
|
||||
for (dirpath, tb) in self.failed_dirs:
|
||||
for dirpath, tb in self.failed_dirs:
|
||||
self.tb += f'\n\n-------------\nFailed to restore: {dirpath}\n{tb}'
|
||||
if self.failed_restores:
|
||||
for (book, tb) in self.failed_restores:
|
||||
for book, tb in self.failed_restores:
|
||||
self.tb += f'\n\n-------------\nFailed to restore: {book["path"]}\n{tb}'
|
||||
|
||||
def load_preferences(self):
|
||||
|
@ -201,7 +201,7 @@ class ThumbnailCache:
|
||||
try:
|
||||
uuid, book_id = line.partition(' ')[0::2]
|
||||
book_id = int(book_id)
|
||||
return (uuid, book_id)
|
||||
return uuid, book_id
|
||||
except Exception:
|
||||
return None
|
||||
invalidate = {record(x) for x in raw.splitlines()}
|
||||
|
@ -40,16 +40,16 @@ series_index_pat = re.compile(r'(.*)\s+\[([.0-9]+)\]$')
|
||||
|
||||
def get_series_values(val):
|
||||
if not val:
|
||||
return (val, None)
|
||||
return val, None
|
||||
match = series_index_pat.match(val.strip())
|
||||
if match is not None:
|
||||
idx = match.group(2)
|
||||
try:
|
||||
idx = float(idx)
|
||||
return (match.group(1).strip(), idx)
|
||||
return match.group(1).strip(), idx
|
||||
except:
|
||||
pass
|
||||
return (val, None)
|
||||
return val, None
|
||||
|
||||
|
||||
def multiple_text(sep, ui_sep, x):
|
||||
|
@ -92,7 +92,7 @@ class FOLDER_DEVICE(USBMS):
|
||||
self.report_progress = report_progress
|
||||
|
||||
def card_prefix(self, end_session=True):
|
||||
return (None, None)
|
||||
return None, None
|
||||
|
||||
def eject(self):
|
||||
self.is_connected = False
|
||||
|
@ -2823,7 +2823,7 @@ class KOBOTOUCH(KOBO):
|
||||
# Did we actually want to letterbox?
|
||||
if not letterbox:
|
||||
canvas_size = kobo_size
|
||||
return (kobo_size, canvas_size)
|
||||
return kobo_size, canvas_size
|
||||
|
||||
def _create_cover_data(
|
||||
self, cover_data, resize_to, minify_to, kobo_size,
|
||||
|
@ -687,7 +687,7 @@ class XMLCache:
|
||||
if 'id' not in record.attrib:
|
||||
num = self.max_id(record.getroottree().getroot())
|
||||
record.set('id', str(num+1))
|
||||
return (gtz_count, ltz_count, use_tz_var)
|
||||
return gtz_count, ltz_count, use_tz_var
|
||||
# }}}
|
||||
|
||||
# Writing the XML files {{{
|
||||
|
@ -1261,16 +1261,16 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
||||
@synchronous('sync_lock')
|
||||
def card_prefix(self, end_session=True):
|
||||
self._debug()
|
||||
return (None, None)
|
||||
return None, None
|
||||
|
||||
@synchronous('sync_lock')
|
||||
def total_space(self, end_session=True):
|
||||
self._debug()
|
||||
opcode, result = self._call_client('TOTAL_SPACE', {})
|
||||
if opcode == 'OK':
|
||||
return (result['total_space_on_device'], 0, 0)
|
||||
return result['total_space_on_device'], 0, 0
|
||||
# protocol error if we get here
|
||||
return (0, 0, 0)
|
||||
return 0, 0, 0
|
||||
|
||||
@synchronous('sync_lock')
|
||||
def free_space(self, end_session=True):
|
||||
@ -1280,7 +1280,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
||||
self._debug('free space:', result['free_space_on_device'])
|
||||
return (result['free_space_on_device'], 0, 0)
|
||||
# protocol error if we get here
|
||||
return (0, 0, 0)
|
||||
return 0, 0, 0
|
||||
|
||||
@synchronous('sync_lock')
|
||||
def books(self, oncard=None, end_session=True):
|
||||
@ -1591,7 +1591,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
||||
@synchronous('sync_lock')
|
||||
def prepare_addable_books(self, paths, this_book=None, total_books=None):
|
||||
for idx, path in enumerate(paths):
|
||||
(ign, ext) = os.path.splitext(path)
|
||||
ign, ext = os.path.splitext(path)
|
||||
with PersistentTemporaryFile(suffix=ext) as tf:
|
||||
self.get_file(path, tf, this_book=this_book, total_books=total_books)
|
||||
paths[idx] = tf.name
|
||||
@ -1630,12 +1630,12 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
||||
|
||||
def _check_if_format_send_needed(self, db, id_, book):
|
||||
if not self.will_ask_for_update_books:
|
||||
return (None, False)
|
||||
return None, False
|
||||
|
||||
from calibre.utils.date import isoformat, parse_date
|
||||
try:
|
||||
if not hasattr(book, '_format_mtime_'):
|
||||
return (None, False)
|
||||
return None, False
|
||||
|
||||
ext = posixpath.splitext(book.lpath)[1][1:]
|
||||
fmt_metadata = db.new_api.format_metadata(id_, ext)
|
||||
@ -1647,17 +1647,17 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
||||
self._show_message(_('You have book formats in your library '
|
||||
'with dates in the future. See calibre '
|
||||
'for details'))
|
||||
return (None, True)
|
||||
return None, True
|
||||
|
||||
cc_mtime = parse_date(book.get('_format_mtime_'), as_utc=True)
|
||||
self._debug(book.title, 'cal_mtime', calibre_mtime, 'cc_mtime', cc_mtime)
|
||||
if cc_mtime < calibre_mtime:
|
||||
book.set('_format_mtime_', isoformat(self.now))
|
||||
return (posixpath.basename(book.lpath), False)
|
||||
return posixpath.basename(book.lpath), False
|
||||
except:
|
||||
self._debug('exception checking if must send format', book.title)
|
||||
traceback.print_exc()
|
||||
return (None, False)
|
||||
return None, False
|
||||
|
||||
@synchronous('sync_lock')
|
||||
def synchronize_with_db(self, db, id_, book, first_call):
|
||||
|
@ -299,7 +299,7 @@ class CollectionsBookList(BookList):
|
||||
if all_by_title not in collections:
|
||||
collections[all_by_title] = {}
|
||||
collections[all_by_title][lpath] = (book, tsval, asval)
|
||||
for (n, sb) in all_by_something:
|
||||
for n,sb in all_by_something:
|
||||
if n not in collections:
|
||||
collections[n] = {}
|
||||
collections[n][lpath] = (book, book.get(sb, ''), tsval)
|
||||
|
@ -174,7 +174,7 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
casz = self._windows_space(self._card_a_prefix)[0]
|
||||
cbsz = self._windows_space(self._card_b_prefix)[0]
|
||||
|
||||
return (msz, casz, cbsz)
|
||||
return msz, casz, cbsz
|
||||
|
||||
def free_space(self, end_session=True):
|
||||
msz = casz = cbsz = 0
|
||||
@ -193,7 +193,7 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
casz = self._windows_space(self._card_a_prefix)[1]
|
||||
cbsz = self._windows_space(self._card_b_prefix)[1]
|
||||
|
||||
return (msz, casz, cbsz)
|
||||
return msz, casz, cbsz
|
||||
|
||||
def windows_filter_pnp_id(self, pnp_id):
|
||||
return False
|
||||
|
@ -192,7 +192,7 @@ class Block:
|
||||
|
||||
@position.setter
|
||||
def position(self, new_pos):
|
||||
(x, y) = new_pos
|
||||
x, y = new_pos
|
||||
self._position = Point(x, y)
|
||||
if self.layouts:
|
||||
self.layouts[0].setPosition(QPointF(x, y))
|
||||
|
@ -499,7 +499,7 @@ class Styles:
|
||||
prefix = ef + '\n' + prefix
|
||||
|
||||
ans = []
|
||||
for (cls, css) in sorted(itervalues(self.classes), key=lambda x:x[0]):
|
||||
for cls, css in sorted(itervalues(self.classes), key=lambda x:x[0]):
|
||||
b = (f'\t{k}: {v};' for k, v in iteritems(css))
|
||||
b = '\n'.join(b)
|
||||
ans.append('.{} {{\n{}\n}}\n'.format(cls, b.rstrip(';')))
|
||||
|
@ -411,14 +411,14 @@ def oeb2html_no_css(oeb_book, log, opts):
|
||||
izer = OEB2HTMLNoCSSizer(log)
|
||||
html = izer.oeb2html(oeb_book, opts)
|
||||
images = izer.images
|
||||
return (html, images)
|
||||
return html, images
|
||||
|
||||
|
||||
def oeb2html_inline_css(oeb_book, log, opts):
|
||||
izer = OEB2HTMLInlineCSSizer(log)
|
||||
html = izer.oeb2html(oeb_book, opts)
|
||||
images = izer.images
|
||||
return (html, images)
|
||||
return html, images
|
||||
|
||||
|
||||
def oeb2html_class_css(oeb_book, log, opts):
|
||||
@ -426,4 +426,4 @@ def oeb2html_class_css(oeb_book, log, opts):
|
||||
setattr(opts, 'class_style', 'inline')
|
||||
html = izer.oeb2html(oeb_book, opts)
|
||||
images = izer.images
|
||||
return (html, images)
|
||||
return html, images
|
||||
|
@ -864,7 +864,7 @@ class LitFile:
|
||||
def get_atoms(self, entry):
|
||||
name = '/'.join(('/data', entry.internal, 'atom'))
|
||||
if name not in self.entries:
|
||||
return ({}, {})
|
||||
return {}, {}
|
||||
data = self.get_file(name)
|
||||
nentries, data = u32(data), data[4:]
|
||||
tags = {}
|
||||
@ -878,7 +878,7 @@ class LitFile:
|
||||
if len(tags) != nentries:
|
||||
self._warn('damaged or invalid atoms tag table')
|
||||
if len(data) < 4:
|
||||
return (tags, {})
|
||||
return tags, {}
|
||||
attrs = {}
|
||||
nentries, data = u32(data), data[4:]
|
||||
for i in range(1, nentries + 1):
|
||||
@ -890,7 +890,7 @@ class LitFile:
|
||||
attrs[i], data = data[:size], data[size:]
|
||||
if len(attrs) != nentries:
|
||||
self._warn('damaged or invalid atoms attributes table')
|
||||
return (tags, attrs)
|
||||
return tags, attrs
|
||||
|
||||
|
||||
class LitContainer:
|
||||
|
@ -300,7 +300,7 @@ class Styles(etree.XSLTExtension):
|
||||
|
||||
with open(name, 'wb') as f:
|
||||
f.write(as_bytes(self.CSS))
|
||||
for (w, sel) in [(self.text_styles, 'ts'), (self.block_styles,
|
||||
for w,sel in [(self.text_styles, 'ts'), (self.block_styles,
|
||||
'bs')]:
|
||||
for i, s in enumerate(w):
|
||||
if not s:
|
||||
|
@ -1106,7 +1106,7 @@ class Button(LRFObject):
|
||||
for i in self.actions[button_type]:
|
||||
if i[0] == 1:
|
||||
return i[1:][0]
|
||||
return (None, None)
|
||||
return None, None
|
||||
|
||||
def __str__(self):
|
||||
s = '<Button objid="%s">\n'%(self.id,)
|
||||
|
@ -189,7 +189,7 @@ class Delegator:
|
||||
return applied
|
||||
|
||||
def applySettings(self, settings, testValid=False):
|
||||
for (setting, value) in settings.items():
|
||||
for setting, value in settings.items():
|
||||
self.applySetting(setting, value, testValid)
|
||||
# if setting not in self.delegatedSettingsDict:
|
||||
# raise LrsError("setting %s not valid" % setting)
|
||||
@ -232,7 +232,7 @@ class LrsAttributes:
|
||||
if alsoAllow is None:
|
||||
alsoAllow = []
|
||||
self.attrs = defaults.copy()
|
||||
for (name, value) in settings.items():
|
||||
for name, value in settings.items():
|
||||
if name not in self.attrs and name not in alsoAllow:
|
||||
raise LrsError('%s does not support setting %s' %
|
||||
(self.__class__.__name__, name))
|
||||
@ -1615,7 +1615,7 @@ class Button(LrsObject, LrsContainer):
|
||||
raise LrsError('%s has no PushButton or JumpTo subs'%self.__class__.__name__)
|
||||
|
||||
def toLrf(self, lrfWriter):
|
||||
(refobj, refpage) = self.findJumpToRefs()
|
||||
refobj, refpage = self.findJumpToRefs()
|
||||
# print('Button writing JumpTo refobj=', jumpto.refobj, ', and refpage=', jumpto.refpage)
|
||||
button = LrfObject('Button', self.objId)
|
||||
button.appendLrfTag(LrfTag('buttonflags', 0x10)) # pushbutton
|
||||
@ -1842,7 +1842,7 @@ class Span(LrsSimpleChar1, LrsContainer):
|
||||
oldTextStyle = self.findCurrentTextStyle()
|
||||
|
||||
# set the attributes we want changed
|
||||
for (name, value) in tuple(iteritems(self.attrs)):
|
||||
for name, value in tuple(iteritems(self.attrs)):
|
||||
if name in oldTextStyle.attrs and oldTextStyle.attrs[name] == self.attrs[name]:
|
||||
self.attrs.pop(name)
|
||||
else:
|
||||
@ -1864,7 +1864,7 @@ class Span(LrsSimpleChar1, LrsContainer):
|
||||
|
||||
def toElement(self, se):
|
||||
element = Element('Span')
|
||||
for (key, value) in self.attrs.items():
|
||||
for key, value in self.attrs.items():
|
||||
element.set(key, str(value))
|
||||
|
||||
appendTextElements(element, self.contents, se)
|
||||
|
@ -668,7 +668,7 @@ class Metadata:
|
||||
Returns the tuple (display_name, formatted_value)
|
||||
'''
|
||||
name, val, ign, ign = self.format_field_extended(key, series_with_index)
|
||||
return (name, val)
|
||||
return name, val
|
||||
|
||||
def format_field_extended(self, key, series_with_index=True):
|
||||
from calibre.ebooks.metadata import authors_to_string
|
||||
@ -803,7 +803,7 @@ class Metadata:
|
||||
for key in self.custom_field_keys():
|
||||
val = self.get(key, None)
|
||||
if val:
|
||||
(name, val) = self.format_field(key)
|
||||
name, val = self.format_field(key)
|
||||
fmt(name, str(val))
|
||||
return '\n'.join(ans)
|
||||
|
||||
@ -832,7 +832,7 @@ class Metadata:
|
||||
for key in self.custom_field_keys():
|
||||
val = self.get(key, None)
|
||||
if val:
|
||||
(name, val) = self.format_field(key)
|
||||
name, val = self.format_field(key)
|
||||
ans += [(name, val)]
|
||||
for i, x in enumerate(ans):
|
||||
ans[i] = '<tr><td><b>%s</b></td><td>%s</td></tr>'%x
|
||||
|
@ -30,7 +30,7 @@ def get_cover(docx):
|
||||
if width < 0 or height < 0:
|
||||
continue
|
||||
if 0.8 <= height/width <= 1.8 and height*width >= 160000:
|
||||
return (fmt, raw)
|
||||
return fmt, raw
|
||||
|
||||
|
||||
def get_metadata(stream):
|
||||
|
@ -232,7 +232,7 @@ def get_metadata_(src, encoding=None):
|
||||
mi.tags = tags
|
||||
|
||||
# IDENTIFIERS
|
||||
for (k,v) in iteritems(meta_tag_ids):
|
||||
for k,v in iteritems(meta_tag_ids):
|
||||
v = [x.strip() for x in v if x.strip()]
|
||||
if v:
|
||||
mi.set_identifier(k, v[0])
|
||||
|
@ -299,7 +299,7 @@ class MetadataUpdater:
|
||||
return pdbrecords
|
||||
|
||||
def update_pdbrecords(self, updated_pdbrecords):
|
||||
for (i, pdbrecord) in enumerate(updated_pdbrecords):
|
||||
for i,pdbrecord in enumerate(updated_pdbrecords):
|
||||
self.data[78+i*8:78+i*8 + 4] = pack('>L',pdbrecord)
|
||||
|
||||
# Refresh local copy
|
||||
|
@ -204,7 +204,7 @@ def read_refines(root):
|
||||
|
||||
|
||||
def refdef(prop, val, scheme=None):
|
||||
return (prop, val, scheme)
|
||||
return prop, val, scheme
|
||||
|
||||
|
||||
def set_refines(elem, existing_refines, *new_refines):
|
||||
|
@ -31,7 +31,7 @@ class Reader:
|
||||
if codelen <= 8:
|
||||
assert term
|
||||
maxcode = ((maxcode + 1) << (32 - codelen)) - 1
|
||||
return (codelen, term, maxcode)
|
||||
return codelen, term, maxcode
|
||||
self.dict1 = tuple(map(dict1_unpack, struct.unpack_from(b'>256L', huff, off1)))
|
||||
|
||||
dict2 = struct.unpack_from(b'>64L', huff, off2)
|
||||
|
@ -1014,14 +1014,14 @@ class Manifest:
|
||||
hrefs = self.oeb.manifest.hrefs
|
||||
if path not in hrefs:
|
||||
self.oeb.logger.warn('CSS import of missing file %r' % path)
|
||||
return (None, None)
|
||||
return None, None
|
||||
item = hrefs[path]
|
||||
if item.media_type not in OEB_STYLES:
|
||||
self.oeb.logger.warn('CSS import of non-CSS file %r' % path)
|
||||
return (None, None)
|
||||
return None, None
|
||||
data = item.data.cssText
|
||||
enc = None if isinstance(data, str) else 'utf-8'
|
||||
return (enc, data)
|
||||
return enc, data
|
||||
|
||||
# }}}
|
||||
|
||||
|
@ -193,7 +193,7 @@ def condense_edge(vals):
|
||||
if len(edges) != 4 or set(edges) != {'left', 'top', 'right', 'bottom'}:
|
||||
return
|
||||
ce = {}
|
||||
for (x, y) in [('left', 'right'), ('top', 'bottom')]:
|
||||
for x,y in [('left', 'right'), ('top', 'bottom')]:
|
||||
if edges[x] == edges[y]:
|
||||
ce[x] = edges[x]
|
||||
else:
|
||||
|
@ -90,7 +90,7 @@ def create_profile():
|
||||
if ans is None:
|
||||
ans = create_profile.ans = QWebEngineProfile(QApplication.instance())
|
||||
setup_profile(ans)
|
||||
for (name, code) in stylelint_js():
|
||||
for name, code in stylelint_js():
|
||||
s = QWebEngineScript()
|
||||
s.setName(name)
|
||||
s.setSourceCode(code)
|
||||
|
@ -75,7 +75,7 @@ def pretty_opf(root):
|
||||
i = spine_ids.get(x.get('id', None), 1000000000)
|
||||
else:
|
||||
i = sort_key(href)
|
||||
return (cat, i)
|
||||
return cat, i
|
||||
|
||||
for manifest in root.xpath('//opf:manifest', namespaces=OPF_NAMESPACES):
|
||||
try:
|
||||
|
@ -32,7 +32,7 @@ OPF_TEMPLATE = '''
|
||||
|
||||
|
||||
def create_manifest_item(name, data=b'', properties=None):
|
||||
return (name, data, properties)
|
||||
return name, data, properties
|
||||
|
||||
|
||||
cmi = create_manifest_item
|
||||
|
@ -396,15 +396,15 @@ class Stylizer:
|
||||
hrefs = self.oeb.manifest.hrefs
|
||||
if path not in hrefs:
|
||||
self.logger.warn('CSS import of missing file %r' % path)
|
||||
return (None, None)
|
||||
return None, None
|
||||
item = hrefs[path]
|
||||
if item.media_type not in OEB_STYLES:
|
||||
self.logger.warn('CSS import of non-CSS file %r' % path)
|
||||
return (None, None)
|
||||
return None, None
|
||||
data = item.data.cssText
|
||||
if not isinstance(data, bytes):
|
||||
data = data.encode('utf-8')
|
||||
return ('utf-8', data)
|
||||
return 'utf-8', data
|
||||
|
||||
def style(self, element):
|
||||
try:
|
||||
|
@ -49,7 +49,7 @@ punct_table = {
|
||||
|
||||
|
||||
def fix_punct(line):
|
||||
for (key, value) in punct_table.items():
|
||||
for key, value in punct_table.items():
|
||||
line = line.replace(key, value)
|
||||
return line
|
||||
|
||||
|
@ -41,7 +41,7 @@ class PdbHeaderReader:
|
||||
self.stream.seek(78 + number * 8)
|
||||
offset, a1, a2, a3, a4 = struct.unpack('>LBBBB', self.stream.read(8))[0]
|
||||
flags, val = a1, a2 << 16 | a3 << 8 | a4
|
||||
return (offset, flags, val)
|
||||
return offset, flags, val
|
||||
|
||||
def section_offset(self, number):
|
||||
if not (0 <= number < self.num_sections):
|
||||
|
@ -104,7 +104,7 @@ class RBWriter:
|
||||
zobj = zlib.compressobj(9, zlib.DEFLATED, 13, 8, 0)
|
||||
pages.append(zobj.compress(text[i * TEXT_RECORD_SIZE : (i * TEXT_RECORD_SIZE) + TEXT_RECORD_SIZE]) + zobj.flush())
|
||||
|
||||
return (size, pages)
|
||||
return size, pages
|
||||
|
||||
def _images(self, manifest):
|
||||
from calibre.ebooks.oeb.base import OEB_RASTER_IMAGES
|
||||
|
@ -52,10 +52,10 @@ class CheckBrackets:
|
||||
self.open_brack(line)
|
||||
if self.__token_info == 'cb<nu<clos-brack':
|
||||
if not self.close_brack(line):
|
||||
return (False, "closed bracket doesn't match, line %s" % line_count)
|
||||
return False, "closed bracket doesn't match, line %s" % line_count
|
||||
|
||||
if self.__bracket_count != 0:
|
||||
msg = ("At end of file open and closed brackets don't match\n"
|
||||
'total number of brackets is %s') % self.__bracket_count
|
||||
return (False, msg)
|
||||
return (True, 'Brackets match!')
|
||||
return False, msg
|
||||
return True, 'Brackets match!'
|
||||
|
@ -783,7 +783,7 @@ class Textile:
|
||||
True
|
||||
|
||||
'''
|
||||
(scheme, netloc) = urlparse(url)[0:2]
|
||||
scheme, netloc = urlparse(url)[0:2]
|
||||
return not scheme and not netloc
|
||||
|
||||
def relURL(self, url):
|
||||
|
@ -444,8 +444,7 @@ class DeviceManager(Thread): # {{{
|
||||
kls = None
|
||||
while True:
|
||||
try:
|
||||
(kls,device_kind, folder_path) = \
|
||||
self.mount_connection_requests.get_nowait()
|
||||
kls, device_kind, folder_path = self.mount_connection_requests.get_nowait()
|
||||
except queue.Empty:
|
||||
break
|
||||
if kls is not None:
|
||||
@ -566,7 +565,7 @@ class DeviceManager(Thread): # {{{
|
||||
mainlist = self.device.books(oncard=None, end_session=False)
|
||||
cardalist = self.device.books(oncard='carda')
|
||||
cardblist = self.device.books(oncard='cardb')
|
||||
return (mainlist, cardalist, cardblist)
|
||||
return mainlist, cardalist, cardblist
|
||||
|
||||
def books(self, done, add_as_step_to_job=None):
|
||||
'''Return callable that returns the list of books on device as two booklists'''
|
||||
|
@ -432,11 +432,11 @@ class CheckLibraryDialog(QDialog):
|
||||
c = node.child(i).checkState(2)
|
||||
checked = checked or c == Qt.CheckState.Checked
|
||||
all_checked = all_checked and c == Qt.CheckState.Checked
|
||||
return (checked, all_checked)
|
||||
return checked, all_checked
|
||||
|
||||
def any_child_delete_checked():
|
||||
for parent in self.top_level_items.values():
|
||||
(c, _) = is_child_delete_checked(parent)
|
||||
c, _ = is_child_delete_checked(parent)
|
||||
if c:
|
||||
return True
|
||||
return False
|
||||
@ -464,7 +464,7 @@ class CheckLibraryDialog(QDialog):
|
||||
else:
|
||||
for parent in self.top_level_items.values():
|
||||
if parent.data(2, Qt.ItemDataRole.UserRole) == self.is_deletable:
|
||||
(child_chkd, all_chkd) = is_child_delete_checked(parent)
|
||||
child_chkd, all_chkd = is_child_delete_checked(parent)
|
||||
if all_chkd and child_chkd:
|
||||
check_state = Qt.CheckState.Checked
|
||||
elif child_chkd:
|
||||
|
@ -86,8 +86,8 @@ class DeleteMatchingFromDeviceDialog(QDialog, Ui_DeleteMatchingFromDeviceDialog)
|
||||
self.table.setRowCount(rows)
|
||||
row = 0
|
||||
for card in items:
|
||||
(model,books) = items[card]
|
||||
for (id,book) in books:
|
||||
model, books = items[card]
|
||||
for id,book in books:
|
||||
item = QTableWidgetItem()
|
||||
item.setFlags(Qt.ItemFlag.ItemIsUserCheckable|Qt.ItemFlag.ItemIsEnabled)
|
||||
item.setCheckState(Qt.CheckState.Checked)
|
||||
@ -115,7 +115,7 @@ class DeleteMatchingFromDeviceDialog(QDialog, Ui_DeleteMatchingFromDeviceDialog)
|
||||
for row in range(self.table.rowCount()):
|
||||
if self.table.item(row, 0).checkState() == Qt.CheckState.Unchecked:
|
||||
continue
|
||||
(model, id, path) = self.table.item(row, 0).data(Qt.ItemDataRole.UserRole)
|
||||
model, id, path = self.table.item(row, 0).data(Qt.ItemDataRole.UserRole)
|
||||
path = str(path)
|
||||
self.result.append((model, id, path))
|
||||
return
|
||||
|
@ -679,40 +679,40 @@ class Quickview(QDialog, Ui_Quickview):
|
||||
mi = self.db.new_api.get_proxy_metadata(book_id)
|
||||
try:
|
||||
if col == 'title':
|
||||
return (mi.title, mi.title_sort, 0)
|
||||
return mi.title, mi.title_sort, 0
|
||||
elif col == 'authors':
|
||||
return (' & '.join(mi.authors), mi.author_sort, 0)
|
||||
return ' & '.join(mi.authors), mi.author_sort, 0
|
||||
elif col == 'series':
|
||||
series = mi.format_field('series')[1]
|
||||
if series is None:
|
||||
return ('', None, 0)
|
||||
return '', None, 0
|
||||
else:
|
||||
return (series, mi.series, mi.series_index)
|
||||
return series, mi.series, mi.series_index
|
||||
elif col == 'size':
|
||||
v = mi.get('book_size')
|
||||
if v is not None:
|
||||
return (f'{v:n}', v, 0)
|
||||
return f'{v:n}', v, 0
|
||||
else:
|
||||
return ('', None, 0)
|
||||
return '', None, 0
|
||||
elif self.fm[col]['datatype'] == 'series':
|
||||
v = mi.format_field(col)[1]
|
||||
return (v, mi.get(col), mi.get(col+'_index'))
|
||||
return v, mi.get(col), mi.get(col+'_index')
|
||||
elif self.fm[col]['datatype'] == 'datetime':
|
||||
v = mi.format_field(col)[1]
|
||||
d = mi.get(col)
|
||||
if d is None:
|
||||
d = UNDEFINED_DATE
|
||||
return (v, timestampfromdt(d), 0)
|
||||
return v, timestampfromdt(d), 0
|
||||
elif self.fm[col]['datatype'] in ('float', 'int'):
|
||||
v = mi.format_field(col)[1]
|
||||
sort_val = mi.get(col)
|
||||
return (v, sort_val, 0)
|
||||
return v, sort_val, 0
|
||||
else:
|
||||
v = mi.format_field(col)[1]
|
||||
return (v, v, 0)
|
||||
return v, v, 0
|
||||
except:
|
||||
traceback.print_exc()
|
||||
return (_('Something went wrong while filling in the table'), '', 0)
|
||||
return _('Something went wrong while filling in the table'), '', 0
|
||||
|
||||
# Deal with sizing the table columns. Done here because the numbers are not
|
||||
# correct until the first paint.
|
||||
|
@ -170,7 +170,7 @@ def render_note_line(line):
|
||||
yield prepare_string_for_xml(line)
|
||||
return
|
||||
pos = 0
|
||||
for (s, e) in urls:
|
||||
for s,e in urls:
|
||||
if s > pos:
|
||||
yield prepare_string_for_xml(line[pos:s])
|
||||
yield '<a href="{0}">{0}</a>'.format(prepare_string_for_xml(line[s:e], True))
|
||||
|
@ -1829,7 +1829,7 @@ class IdentifiersEdit(QLineEdit, ToMetadataMixin, LineEditIndicators):
|
||||
return True
|
||||
except Exception:
|
||||
pass
|
||||
for (key, prefix) in (
|
||||
for key, prefix in (
|
||||
('doi', 'https://dx.doi.org/'),
|
||||
('doi', 'https://doi.org/'),
|
||||
('arxiv', 'https://arxiv.org/abs/'),
|
||||
|
@ -233,11 +233,10 @@ class ConditionEditor(QWidget): # {{{
|
||||
@property
|
||||
def condition(self):
|
||||
|
||||
c, a, v = (self.current_col, self.current_action,
|
||||
self.current_val)
|
||||
c, a, v = (self.current_col, self.current_action, self.current_val)
|
||||
if not c or not a:
|
||||
return None
|
||||
return (c, a, v)
|
||||
return c, a, v
|
||||
|
||||
@condition.setter
|
||||
def condition(self, condition):
|
||||
@ -864,7 +863,7 @@ class RulesModel(QAbstractListModel): # {{{
|
||||
col = self.fm[col]['name']
|
||||
return self.rule_to_html(kind, col, rule)
|
||||
if role == Qt.ItemDataRole.UserRole:
|
||||
return (kind, col, rule)
|
||||
return kind, col, rule
|
||||
|
||||
def add_rule(self, kind, col, rule, selected_row=None):
|
||||
self.beginResetModel()
|
||||
|
@ -712,7 +712,7 @@ class TagsView(QTreeView): # {{{
|
||||
self._model.set_value_icon(key, TEMPLATE_ICON_INDICATOR, d.rule[2], False)
|
||||
self.recount()
|
||||
return
|
||||
(icon_file_name, for_children) = extra if extra is not None else (None, None)
|
||||
icon_file_name, for_children = extra if extra is not None else (None, None)
|
||||
item_val, desired_file_name = make_icon_name(key, index)
|
||||
if icon_file_name is None:
|
||||
# User wants to specify a specific icon
|
||||
@ -1283,7 +1283,7 @@ class TagsView(QTreeView): # {{{
|
||||
if key not in ('search', 'formats') and not key.startswith('@'):
|
||||
def get_rule_data(tag, key):
|
||||
if tag is None:
|
||||
return (None, None, None)
|
||||
return None, None, None
|
||||
name = tag.original_name
|
||||
cat_rules = self._model.value_icons.get(key, {})
|
||||
icon_name, for_child = cat_rules.get(name, (None, None))
|
||||
|
@ -783,7 +783,7 @@ class FileList(QTreeWidget, OpenWithHandler):
|
||||
for i in range(parent.childCount()):
|
||||
item = parent.child(i)
|
||||
if str(item.data(0, NAME_ROLE) or '') == name:
|
||||
return (category, i)
|
||||
return category, i
|
||||
return (None, -1)
|
||||
|
||||
def merge_files(self):
|
||||
|
@ -284,7 +284,7 @@ def searchable_text_for_name(name):
|
||||
if children:
|
||||
for child in reversed(children):
|
||||
a((child, ignore_text_in_node_and_children, in_ruby))
|
||||
for (tail, body) in removed_tails:
|
||||
for tail, body in removed_tails:
|
||||
if tail is not None:
|
||||
body['l'] = tail
|
||||
return ''.join(ans), anchor_offset_map
|
||||
@ -419,7 +419,7 @@ def search_in_name(name, search_query, ctx_size=75):
|
||||
return spans.append((s, s + l))
|
||||
primary_collator_without_punctuation().find_all(search_query.text, raw, a, search_query.mode == 'word')
|
||||
|
||||
for (start, end) in miter():
|
||||
for start, end in miter():
|
||||
before = raw[max(0, start-ctx_size):start]
|
||||
after = raw[end:end+ctx_size]
|
||||
yield before, raw[start:end], after, start
|
||||
|
@ -56,7 +56,7 @@ class MetadataBackup(Thread): # {{{
|
||||
while self.keep_running:
|
||||
try:
|
||||
time.sleep(2) # Limit to one book per two seconds
|
||||
(id_, sequence) = self.db.get_a_dirtied_book()
|
||||
id_, sequence = self.db.get_a_dirtied_book()
|
||||
if id_ is None:
|
||||
continue
|
||||
# print('writer thread', id_, sequence)
|
||||
@ -381,10 +381,10 @@ class ResultCache(SearchQueryParser): # {{{
|
||||
relop = None
|
||||
for k in self.date_search_relops.keys():
|
||||
if query.startswith(k):
|
||||
(p, relop) = self.date_search_relops[k]
|
||||
p, relop = self.date_search_relops[k]
|
||||
query = query[p:]
|
||||
if relop is None:
|
||||
(p, relop) = self.date_search_relops['=']
|
||||
p, relop = self.date_search_relops['=']
|
||||
|
||||
if query in self.local_today:
|
||||
qd = now()
|
||||
@ -464,10 +464,10 @@ class ResultCache(SearchQueryParser): # {{{
|
||||
relop = None
|
||||
for k in self.numeric_search_relops.keys():
|
||||
if query.startswith(k):
|
||||
(p, relop) = self.numeric_search_relops[k]
|
||||
p, relop = self.numeric_search_relops[k]
|
||||
query = query[p:]
|
||||
if relop is None:
|
||||
(p, relop) = self.numeric_search_relops['=']
|
||||
p, relop = self.numeric_search_relops['=']
|
||||
|
||||
if dt == 'int':
|
||||
def cast(x):
|
||||
@ -541,7 +541,7 @@ class ResultCache(SearchQueryParser): # {{{
|
||||
if len(q) != 2:
|
||||
raise ParseException(
|
||||
_('Invalid query format for colon-separated search: {0}').format(query))
|
||||
(keyq, valq) = q
|
||||
keyq, valq = q
|
||||
keyq_mkind, keyq = self._matchkind(keyq)
|
||||
valq_mkind, valq = self._matchkind(valq)
|
||||
else:
|
||||
|
@ -551,7 +551,7 @@ class CatalogBuilder:
|
||||
|
||||
authors = [(record['author'], record['author_sort']) for record in books_by_author]
|
||||
current_author = authors[0]
|
||||
for (i, author) in enumerate(authors):
|
||||
for i, author in enumerate(authors):
|
||||
if author != current_author and i:
|
||||
if author[0] == current_author[0]:
|
||||
if self.opts.fmt == 'mobi':
|
||||
@ -808,7 +808,7 @@ class CatalogBuilder:
|
||||
multiple_authors = False
|
||||
unique_authors = []
|
||||
individual_authors = set()
|
||||
for (i, author) in enumerate(authors):
|
||||
for i, author in enumerate(authors):
|
||||
if author != current_author:
|
||||
# Note that current_author and author are tuples: (friendly, sort)
|
||||
multiple_authors = True
|
||||
@ -1201,7 +1201,7 @@ class CatalogBuilder:
|
||||
|
||||
def _format_tag_list(tags, indent=1, line_break=70, header='Tag list'):
|
||||
def _next_tag(sorted_tags):
|
||||
for (i, tag) in enumerate(sorted_tags):
|
||||
for i, tag in enumerate(sorted_tags):
|
||||
if i < len(tags) - 1:
|
||||
yield tag + ', '
|
||||
else:
|
||||
@ -1845,7 +1845,7 @@ class CatalogBuilder:
|
||||
|
||||
date_range_list = []
|
||||
today_time = nowf().replace(hour=23, minute=59, second=59)
|
||||
for (i, date) in enumerate(self.DATE_RANGE):
|
||||
for i, date in enumerate(self.DATE_RANGE):
|
||||
date_range_limit = self.DATE_RANGE[i]
|
||||
if i:
|
||||
date_range = '%d to %d days ago' % (self.DATE_RANGE[i - 1], self.DATE_RANGE[i])
|
||||
@ -2137,7 +2137,7 @@ class CatalogBuilder:
|
||||
# genre_list = [ {friendly_tag:[{book},{book}]}, {friendly_tag:[{book},{book}]}, ...]
|
||||
master_genre_list = []
|
||||
for genre_tag_set in genre_list:
|
||||
for (index, genre) in enumerate(genre_tag_set):
|
||||
for index, genre in enumerate(genre_tag_set):
|
||||
# print('genre: %s \t genre_tag_set[genre]: %s' % (genre, genre_tag_set[genre]))
|
||||
|
||||
# Create sorted_authors[0] = friendly, [1] = author_sort for NCX creation
|
||||
@ -2150,7 +2150,7 @@ class CatalogBuilder:
|
||||
books_by_current_author = 1
|
||||
current_author = authors[0]
|
||||
unique_authors = []
|
||||
for (i, author) in enumerate(authors):
|
||||
for i, author in enumerate(authors):
|
||||
if author != current_author and i:
|
||||
unique_authors.append((current_author[0], current_author[1], books_by_current_author))
|
||||
current_author = author
|
||||
@ -2698,7 +2698,7 @@ class CatalogBuilder:
|
||||
_soup = BeautifulSoup('')
|
||||
genresTag = _soup.new_tag('p')
|
||||
gtc = 0
|
||||
for (i, tag) in enumerate(sorted(book.get('genres', []))):
|
||||
for i, tag in enumerate(sorted(book.get('genres', []))):
|
||||
aTag = _soup.new_tag('a')
|
||||
if self.opts.generate_genres:
|
||||
try:
|
||||
@ -2835,7 +2835,7 @@ class CatalogBuilder:
|
||||
|
||||
self.update_progress_full_step(_('Descriptions HTML'))
|
||||
|
||||
for (title_num, title) in enumerate(self.books_by_title):
|
||||
for title_num, title in enumerate(self.books_by_title):
|
||||
self.update_progress_micro_step('%s %d of %d' %
|
||||
(_('Description HTML'),
|
||||
title_num, len(self.books_by_title)),
|
||||
@ -3167,7 +3167,7 @@ class CatalogBuilder:
|
||||
_add_to_series_by_letter(current_series_list)
|
||||
|
||||
# Add *article* entries for each populated series title letter
|
||||
for (i, books) in enumerate(series_by_letter):
|
||||
for i, books in enumerate(series_by_letter):
|
||||
sec_id = '%sSeries-ID' % (title_letters[i].upper())
|
||||
if len(title_letters[i]) > 1:
|
||||
fmt_string = _('Series beginning with %s')
|
||||
@ -3251,7 +3251,7 @@ class CatalogBuilder:
|
||||
_add_to_books_by_letter(current_book_list)
|
||||
|
||||
# Add *article* entries for each populated title letter
|
||||
for (i, books) in enumerate(books_by_letter):
|
||||
for i, books in enumerate(books_by_letter):
|
||||
sec_id = '%sTitles-ID' % (title_letters[i].upper())
|
||||
if len(title_letters[i]) > 1:
|
||||
fmt_string = _('Titles beginning with %s')
|
||||
@ -3384,7 +3384,7 @@ class CatalogBuilder:
|
||||
master_date_range_list = []
|
||||
today = datetime.datetime.now()
|
||||
today_time = datetime.datetime(today.year, today.month, today.day)
|
||||
for (i, date) in enumerate(self.DATE_RANGE):
|
||||
for i, date in enumerate(self.DATE_RANGE):
|
||||
if i:
|
||||
date_range = '%d to %d days ago' % (self.DATE_RANGE[i - 1], self.DATE_RANGE[i])
|
||||
else:
|
||||
@ -3493,7 +3493,7 @@ class CatalogBuilder:
|
||||
master_date_range_list = []
|
||||
today = datetime.datetime.now()
|
||||
today_time = datetime.datetime(today.year, today.month, today.day)
|
||||
for (i, date) in enumerate(self.DATE_RANGE):
|
||||
for i, date in enumerate(self.DATE_RANGE):
|
||||
if i:
|
||||
date_range = '%d to %d days ago' % (self.DATE_RANGE[i - 1], self.DATE_RANGE[i])
|
||||
else:
|
||||
@ -3816,7 +3816,7 @@ class CatalogBuilder:
|
||||
title_words = title_sort(title).split()
|
||||
translated = []
|
||||
|
||||
for (i, word) in enumerate(title_words):
|
||||
for i, word in enumerate(title_words):
|
||||
# Leading numbers optionally translated to text equivalent
|
||||
# Capitalize leading sort word
|
||||
if i == 0:
|
||||
@ -3931,7 +3931,7 @@ class CatalogBuilder:
|
||||
self.update_progress_full_step(_('Thumbnails'))
|
||||
thumbs = ['thumbnail_default.jpg']
|
||||
image_dir = '%s/images' % self.catalog_path
|
||||
for (i, title) in enumerate(self.books_by_title):
|
||||
for i, title in enumerate(self.books_by_title):
|
||||
# Update status
|
||||
self.update_progress_micro_step('%s %d of %d' %
|
||||
(_('Thumbnail'), i, len(self.books_by_title)),
|
||||
|
@ -185,7 +185,7 @@ class CheckLibrary:
|
||||
return False
|
||||
|
||||
def process_book(self, lib, book_info):
|
||||
(db_path, title_dir, book_id) = book_info
|
||||
db_path, title_dir, book_id = book_info
|
||||
filenames = frozenset(f for f in os.listdir(os.path.join(lib, db_path))
|
||||
if not self.ignore_name(f) and (
|
||||
os.path.splitext(f)[1] not in self.ignore_ext or
|
||||
|
@ -257,11 +257,11 @@ class CustomColumns:
|
||||
if ans is UNDEFINED_DATE:
|
||||
ans = None
|
||||
if data['datatype'] != 'series':
|
||||
return (ans, None)
|
||||
return ans, None
|
||||
ign,lt = self.custom_table_names(data['num'])
|
||||
extra = self.conn.get('''SELECT extra FROM %s
|
||||
WHERE book=?'''%lt, (idx,), all=False)
|
||||
return (ans, extra)
|
||||
return ans, extra
|
||||
|
||||
# convenience methods for tag editing
|
||||
def get_custom_items_with_ids(self, label=None, num=None):
|
||||
@ -547,7 +547,7 @@ class CustomColumns:
|
||||
val = self.custom_data_adapters[data['datatype']](val, data)
|
||||
|
||||
if data['datatype'] == 'series' and extra is None:
|
||||
(val, extra) = self._get_series_values(val)
|
||||
val, extra = self._get_series_values(val)
|
||||
if extra is None:
|
||||
extra = 1.0
|
||||
|
||||
|
@ -937,8 +937,8 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
# reason.
|
||||
id_ = list(self.dirtied_cache.keys())[random.randint(0, l-1)]
|
||||
sequence = self.dirtied_cache[id_]
|
||||
return (id_, sequence)
|
||||
return (None, None)
|
||||
return id_, sequence
|
||||
return None, None
|
||||
|
||||
def dirty_queue_length(self):
|
||||
return len(self.dirtied_cache)
|
||||
@ -979,7 +979,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
# This almost certainly means that the book has been deleted while
|
||||
# the backup operation sat in the queue.
|
||||
pass
|
||||
return (path, mi, sequence)
|
||||
return path, mi, sequence
|
||||
|
||||
def get_metadata(self, idx, index_is_id=False, get_cover=False,
|
||||
get_user_categories=True, cover_as_data=False):
|
||||
@ -1896,7 +1896,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
item.rc += 1
|
||||
continue
|
||||
try:
|
||||
(item_id, sort_val) = tid_cat[val] # let exceptions fly
|
||||
item_id, sort_val = tid_cat[val] # let exceptions fly
|
||||
item = tcats_cat.get(val, None)
|
||||
if not item:
|
||||
item = tag_class(val, sort_val)
|
||||
@ -1918,7 +1918,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
tid_cat[val] = (val, val)
|
||||
for val in vals:
|
||||
try:
|
||||
(item_id, sort_val) = tid_cat[val] # let exceptions fly
|
||||
item_id, sort_val = tid_cat[val] # let exceptions fly
|
||||
item = tcats_cat.get(val, None)
|
||||
if not item:
|
||||
item = tag_class(val, sort_val)
|
||||
@ -3187,7 +3187,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
|
||||
def set_series(self, id, series, notify=True, commit=True, allow_case_change=True):
|
||||
self.conn.execute('DELETE FROM books_series_link WHERE book=?',(id,))
|
||||
(series, idx) = self._get_series_values(series)
|
||||
series, idx = self._get_series_values(series)
|
||||
books_to_refresh = {id}
|
||||
if series:
|
||||
case_change = False
|
||||
@ -3545,8 +3545,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
paths = [duplicate[0] for duplicate in duplicates]
|
||||
formats = [duplicate[1] for duplicate in duplicates]
|
||||
metadata = [duplicate[2] for duplicate in duplicates]
|
||||
return (paths, formats, metadata), (ids if return_ids else
|
||||
len(ids))
|
||||
return (paths, formats, metadata), (ids if return_ids else len(ids))
|
||||
return None, (ids if return_ids else len(ids))
|
||||
|
||||
def import_book(self, mi, formats, notify=True, import_hooks=True,
|
||||
|
@ -145,7 +145,7 @@ class Browser:
|
||||
|
||||
def has_header(x: str) -> bool:
|
||||
x = x.lower()
|
||||
for (h, v) in headers:
|
||||
for h,v in headers:
|
||||
if h.lower() == x:
|
||||
return True
|
||||
return False
|
||||
|
@ -123,7 +123,7 @@ class DownloadRequest(QObject):
|
||||
'final_url': qurl_to_string(self.reply.url()), 'headers': []
|
||||
}
|
||||
h = result['headers']
|
||||
for (k, v) in self.reply.rawHeaderPairs():
|
||||
for k,v in self.reply.rawHeaderPairs():
|
||||
h.append((bytes(k).decode('utf-8', 'replace'), bytes(v).decode('utf-8', 'replace')))
|
||||
if code := self.reply.attribute(QNetworkRequest.Attribute.HttpStatusCodeAttribute):
|
||||
result['http_code'] = code
|
||||
@ -206,7 +206,7 @@ class FetchBackend(QNetworkAccessManager):
|
||||
timeout = req['timeout']
|
||||
rq.setTransferTimeout(int(timeout * 1000))
|
||||
rq.setRawHeader(b'User-Agent', self.current_user_agent().encode())
|
||||
for (name, val) in req['headers']:
|
||||
for name, val in req['headers']:
|
||||
ex = rq.rawHeader(name)
|
||||
if len(ex):
|
||||
val = bytes(ex).decode() + ', ' + val
|
||||
|
@ -77,7 +77,7 @@ def parse_multipart_byterange(buf, content_type): # {{{
|
||||
if len(ret) != content_length:
|
||||
raise ValueError('Malformed sub-part, length of body not equal to length specified in Content-Range')
|
||||
buf.readline()
|
||||
return (start, ret)
|
||||
return start, ret
|
||||
while True:
|
||||
data = parse_part()
|
||||
if data is None:
|
||||
|
@ -250,7 +250,7 @@ def make_with_stats(filename, outfile):
|
||||
|
||||
|
||||
def run_batch(pairs):
|
||||
for (filename, outfile) in pairs:
|
||||
for filename, outfile in pairs:
|
||||
yield make_with_stats(filename, outfile)
|
||||
|
||||
|
||||
|
@ -288,7 +288,7 @@ class FontScanner(Thread):
|
||||
continue
|
||||
generic_family = panose_to_css_generic_family(faces[0]['panose'])
|
||||
if generic_family in allowed_families or generic_family == preferred_families[0]:
|
||||
return (family, faces)
|
||||
return family, faces
|
||||
elif generic_family not in found:
|
||||
found[generic_family] = (family, faces)
|
||||
|
||||
|
@ -62,7 +62,7 @@ class LigatureSubstitution(UnknownLookupSubTable):
|
||||
def read_ligature(self, data):
|
||||
lig_glyph, count = data.unpack('HH')
|
||||
components = data.unpack('%dH'%(count-1), single_special=False)
|
||||
return (lig_glyph, components)
|
||||
return lig_glyph, components
|
||||
|
||||
def all_substitutions(self, glyph_ids):
|
||||
gid_index_map = self.coverage.coverage_indices(glyph_ids)
|
||||
|
@ -99,7 +99,7 @@ def get_font_characteristics(raw, raw_is_table=False, return_all=False):
|
||||
offset = struct.calcsize(common_fields)
|
||||
panose = struct.unpack_from(b'>10B', os2_table, offset)
|
||||
offset += 10
|
||||
(range1, range2, range3, range4) = struct.unpack_from(b'>4L', os2_table, offset)
|
||||
range1, range2, range3, range4 = struct.unpack_from(b'>4L', os2_table, offset)
|
||||
offset += struct.calcsize(b'>4L')
|
||||
vendor_id = os2_table[offset:offset+4]
|
||||
vendor_id
|
||||
|
@ -1001,7 +1001,7 @@ return ``found_val``, otherwise return ``not_found_val``. If ``found_val`` and
|
||||
raise ValueError(_('{} requires 2 or 4 arguments').format(self.name))
|
||||
|
||||
l = [v.strip() for v in val.split(',') if v.strip()]
|
||||
(id_, __, regexp) = ident.partition(':')
|
||||
id_, __, regexp = ident.partition(':')
|
||||
if not id_:
|
||||
return nfv
|
||||
for candidate in l:
|
||||
|
@ -435,7 +435,7 @@ class SearchQueryParser:
|
||||
raise ParseException(_('Recursive saved search: {0}').format(query))
|
||||
self.searches_seen.add(search_name_lower)
|
||||
query = self._get_saved_search_text(query)
|
||||
return (query, search_name_lower)
|
||||
return query, search_name_lower
|
||||
|
||||
def _get_saved_search_text(self, query):
|
||||
try:
|
||||
|
@ -282,7 +282,7 @@ class SMTP:
|
||||
self.debug = debug_to
|
||||
self.esmtp_features = {}
|
||||
if host:
|
||||
(code, msg) = self.connect(host, port)
|
||||
code, msg = self.connect(host, port)
|
||||
if code != 220:
|
||||
raise SMTPConnectError(code, msg)
|
||||
if local_hostname is not None:
|
||||
@ -346,10 +346,10 @@ class SMTP:
|
||||
self.debug('connect:', (host, port))
|
||||
self._host = host
|
||||
self.sock = self._get_socket(host, port, self.timeout)
|
||||
(code, msg) = self.getreply()
|
||||
code, msg = self.getreply()
|
||||
if self.debuglevel > 0:
|
||||
self.debug('connect:', msg)
|
||||
return (code, msg)
|
||||
return code, msg
|
||||
|
||||
def send(self, str):
|
||||
'''Send `str' to the server.'''
|
||||
@ -432,9 +432,9 @@ class SMTP:
|
||||
host.
|
||||
'''
|
||||
self.putcmd('helo', name or self.local_hostname)
|
||||
(code, msg) = self.getreply()
|
||||
code, msg = self.getreply()
|
||||
self.helo_resp = msg
|
||||
return (code, msg)
|
||||
return code, msg
|
||||
|
||||
def ehlo(self, name=''):
|
||||
''' SMTP 'ehlo' command.
|
||||
@ -443,7 +443,7 @@ class SMTP:
|
||||
'''
|
||||
self.esmtp_features = {}
|
||||
self.putcmd(self.ehlo_msg, name or self.local_hostname)
|
||||
(code, msg) = self.getreply()
|
||||
code, msg = self.getreply()
|
||||
# According to RFC1869 some (badly written)
|
||||
# MTA's will disconnect on an ehlo. Toss an exception if
|
||||
# that happens -ddm
|
||||
@ -452,7 +452,7 @@ class SMTP:
|
||||
raise SMTPServerDisconnected('Server not connected')
|
||||
self.ehlo_resp = msg
|
||||
if code != 250:
|
||||
return (code, msg)
|
||||
return code, msg
|
||||
self.does_esmtp = 1
|
||||
# parse the ehlo response -ddm
|
||||
resp = self.ehlo_resp.split('\n')
|
||||
@ -484,7 +484,7 @@ class SMTP:
|
||||
+ ' ' + params
|
||||
else:
|
||||
self.esmtp_features[feature] = params
|
||||
return (code, msg)
|
||||
return code, msg
|
||||
|
||||
def has_extn(self, opt):
|
||||
'''Does the server support a given SMTP service extension?'''
|
||||
@ -529,7 +529,7 @@ class SMTP:
|
||||
response code received when the all data is sent.
|
||||
'''
|
||||
self.putcmd('data')
|
||||
(code, repl) = self.getreply()
|
||||
code, repl = self.getreply()
|
||||
if self.debuglevel > 0:
|
||||
self.debug('data:', (code, repl))
|
||||
if code != 354:
|
||||
@ -540,10 +540,10 @@ class SMTP:
|
||||
q = q + CRLF
|
||||
q = q + '.' + CRLF
|
||||
self.send(q)
|
||||
(code, msg) = self.getreply()
|
||||
code, msg = self.getreply()
|
||||
if self.debuglevel > 0:
|
||||
self.debug('data:', (code, msg))
|
||||
return (code, msg)
|
||||
return code, msg
|
||||
|
||||
def verify(self, address):
|
||||
'''SMTP 'verify' command -- checks for address validity.'''
|
||||
@ -572,7 +572,7 @@ class SMTP:
|
||||
'''
|
||||
if self.helo_resp is None and self.ehlo_resp is None:
|
||||
if not (200 <= self.ehlo()[0] <= 299):
|
||||
(code, resp) = self.helo()
|
||||
code, resp = self.helo()
|
||||
if not (200 <= code <= 299):
|
||||
raise SMTPHeloError(code, resp)
|
||||
|
||||
@ -633,27 +633,27 @@ class SMTP:
|
||||
break
|
||||
|
||||
if authmethod == AUTH_CRAM_MD5:
|
||||
(code, resp) = self.docmd('AUTH', AUTH_CRAM_MD5)
|
||||
code, resp = self.docmd('AUTH', AUTH_CRAM_MD5)
|
||||
if code == 503:
|
||||
# 503 == 'Error: already authenticated'
|
||||
return (code, resp)
|
||||
(code, resp) = self.docmd(encode_cram_md5(resp, user, password))
|
||||
return code, resp
|
||||
code, resp = self.docmd(encode_cram_md5(resp, user, password))
|
||||
elif authmethod == AUTH_PLAIN:
|
||||
(code, resp) = self.docmd('AUTH',
|
||||
code, resp = self.docmd('AUTH',
|
||||
AUTH_PLAIN + ' ' + encode_plain(user, password))
|
||||
elif authmethod == AUTH_LOGIN:
|
||||
(code, resp) = self.docmd('AUTH',
|
||||
code, resp = self.docmd('AUTH',
|
||||
'{} {}'.format(AUTH_LOGIN, encode_base64(user, eol='')))
|
||||
if code != 334:
|
||||
raise SMTPAuthenticationError(code, resp)
|
||||
(code, resp) = self.docmd(encode_base64(password, eol=''))
|
||||
code, resp = self.docmd(encode_base64(password, eol=''))
|
||||
elif authmethod is None:
|
||||
raise SMTPException('No suitable authentication method found.')
|
||||
if code not in (235, 503):
|
||||
# 235 == 'Authentication successful'
|
||||
# 503 == 'Error: already authenticated'
|
||||
raise SMTPAuthenticationError(code, resp)
|
||||
return (code, resp)
|
||||
return code, resp
|
||||
|
||||
def starttls(self, context=None):
|
||||
'''Puts the connection to the SMTP server into TLS mode.
|
||||
@ -675,7 +675,7 @@ class SMTP:
|
||||
self.ehlo_or_helo_if_needed()
|
||||
if not self.has_extn('starttls'):
|
||||
raise SMTPException('STARTTLS extension not supported by server.')
|
||||
(resp, reply) = self.docmd('STARTTLS')
|
||||
resp, reply = self.docmd('STARTTLS')
|
||||
if resp == 220:
|
||||
if not _have_ssl:
|
||||
raise RuntimeError('No SSL support included in this Python')
|
||||
@ -697,7 +697,7 @@ class SMTP:
|
||||
# 501 Syntax error (no parameters allowed)
|
||||
# 454 TLS not available due to temporary reason
|
||||
raise SMTPResponseException(resp, reply)
|
||||
return (resp, reply)
|
||||
return resp, reply
|
||||
|
||||
def sendmail(self, from_addr, to_addrs, msg, mail_options=[],
|
||||
rcpt_options=[]):
|
||||
@ -766,7 +766,7 @@ class SMTP:
|
||||
for option in mail_options:
|
||||
esmtp_opts.append(option)
|
||||
|
||||
(code, resp) = self.mail(from_addr, esmtp_opts)
|
||||
code, resp = self.mail(from_addr, esmtp_opts)
|
||||
if code != 250:
|
||||
self.rset()
|
||||
raise SMTPSenderRefused(code, resp, from_addr)
|
||||
@ -774,14 +774,14 @@ class SMTP:
|
||||
if isinstance(to_addrs, string_or_bytes):
|
||||
to_addrs = [to_addrs]
|
||||
for each in to_addrs:
|
||||
(code, resp) = self.rcpt(each, rcpt_options)
|
||||
code, resp = self.rcpt(each, rcpt_options)
|
||||
if (code != 250) and (code != 251):
|
||||
senderrs[each] = (code, resp)
|
||||
if len(senderrs) == len(to_addrs):
|
||||
# the server refused all our recipients
|
||||
self.rset()
|
||||
raise SMTPRecipientsRefused(senderrs)
|
||||
(code, resp) = self.data(msg)
|
||||
code, resp = self.data(msg)
|
||||
if code != 250:
|
||||
self.rset()
|
||||
raise SMTPDataError(code, resp)
|
||||
@ -885,10 +885,10 @@ class LMTP(SMTP):
|
||||
self.sock.close()
|
||||
self.sock = None
|
||||
raise
|
||||
(code, msg) = self.getreply()
|
||||
code, msg = self.getreply()
|
||||
if self.debuglevel > 0:
|
||||
self.debug('connect:', msg)
|
||||
return (code, msg)
|
||||
return code, msg
|
||||
|
||||
|
||||
# Test the sendmail method, which tests most of the others.
|
||||
|
@ -1623,7 +1623,7 @@ class PyZipFile(ZipFile):
|
||||
archivename = os.path.split(fname)[1]
|
||||
if basename:
|
||||
archivename = f'{basename}/{archivename}'
|
||||
return (fname, archivename)
|
||||
return fname, archivename
|
||||
|
||||
|
||||
def extractall(source, dest):
|
||||
|
@ -326,7 +326,7 @@ class FeedCollection(list):
|
||||
for j, f in enumerate(self):
|
||||
for i, a in enumerate(f):
|
||||
if a is article:
|
||||
return (j, i)
|
||||
return j, i
|
||||
|
||||
def restore_duplicates(self):
|
||||
temp = []
|
||||
|
@ -211,7 +211,7 @@ class RecipeModel(QAbstractItemModel, AdaptSQP):
|
||||
script_ids = []
|
||||
for urn, title_script in iteritems(script_urn_map):
|
||||
id_ = int(urn[len('custom:'):])
|
||||
(title, script) = title_script
|
||||
title, script = title_script
|
||||
script_ids.append((id_, title, script))
|
||||
|
||||
update_custom_recipes(script_ids)
|
||||
|
@ -69,7 +69,7 @@ class LoadParser(handler.ContentHandler):
|
||||
self.data = []
|
||||
# Create the element
|
||||
attrdict = {}
|
||||
for (att,value) in attrs.items():
|
||||
for att,value in attrs.items():
|
||||
attrdict[att] = value
|
||||
try:
|
||||
e = Element(qname=tag, qattributes=attrdict, check_grammar=False)
|
||||
|
Loading…
x
Reference in New Issue
Block a user