diff --git a/recipes/parisreview.recipe b/recipes/parisreview.recipe index 62e6663195..49050111bf 100644 --- a/recipes/parisreview.recipe +++ b/recipes/parisreview.recipe @@ -21,6 +21,6 @@ class ParisReview(BasicNewsRecipe): # remove_attributes = ['style',] # keep_only_tags = [] remove_tags = [] - # remove_tags_before = dict() + # remove_tags_before = {} remove_tags_after = {} feeds = [('Posts', 'http://feeds.feedburner.com/TheParisReviewBlog')] diff --git a/src/calibre/devices/kindle/bookmark.py b/src/calibre/devices/kindle/bookmark.py index 61ddeda76d..0a5ecf965e 100644 --- a/src/calibre/devices/kindle/bookmark.py +++ b/src/calibre/devices/kindle/bookmark.py @@ -91,10 +91,10 @@ class Bookmark: # {{{ if entry_type: displayed_location = location // MAGIC_MOBI_CONSTANT + 1 - user_notes[location] = dict(id=self.id, - displayed_location=displayed_location, - type=entry_type, - text=text) + user_notes[location] = {'id': self.id, + 'displayed_location': displayed_location, + 'type': entry_type, + 'text': text} eo += rec_len + 8 current_entry += 1 @@ -127,10 +127,10 @@ class Bookmark: # {{{ if end_loc != self.last_read: # print(' adding Bookmark at 0x%x (%d)' % (end_loc, end_loc/MAGIC_MOBI_CONSTANT + 1)) displayed_location = end_loc // MAGIC_MOBI_CONSTANT + 1 - user_notes[end_loc - 1] = dict(id=self.id, - displayed_location=displayed_location, - type='Bookmark', - text=None) + user_notes[end_loc - 1] = {'id': self.id, + 'displayed_location': displayed_location, + 'type': 'Bookmark', + 'text': None} rec_len, = unpack('>I', data[eo+4:eo+8]) eo += rec_len + 8 sig = data[eo:eo+4] @@ -200,10 +200,10 @@ class Bookmark: # {{{ e_type = 'Unknown annotation type' displayed_location = location/MAGIC_TOPAZ_CONSTANT + 1 - user_notes[location] = dict(id=self.id, - displayed_location=displayed_location, - type=e_type, - text=text) + user_notes[location] = {'id': self.id, + 'displayed_location': displayed_location, + 'type': e_type, + 'text': text} if text_len == 0xFFFFFFFF: e_base = e_base + 14 else: @@ -263,10 +263,10 @@ class Bookmark: # {{{ displayed_location = location e_type = 'Bookmark' text = None - user_notes[location] = dict(id=self.id, - displayed_location=displayed_location, - type=e_type, - text=text) + user_notes[location] = {'id': self.id, + 'displayed_location': displayed_location, + 'type': e_type, + 'text': text} self.pdf_page_offset = pdf_location - location e_base += (7 + label_len) current_entry += 1 diff --git a/src/calibre/devices/kindle/driver.py b/src/calibre/devices/kindle/driver.py index b5c53e479b..7a22cef2d8 100644 --- a/src/calibre/devices/kindle/driver.py +++ b/src/calibre/devices/kindle/driver.py @@ -245,7 +245,7 @@ class KINDLE(USBMS): if mc_path: timestamp = utcfromtimestamp(os.path.getmtime(mc_path)) bookmarked_books['clippings'] = self.UserAnnotation(type='kindle_clippings', - value=dict(path=mc_path, timestamp=timestamp)) + value={'path': mc_path, 'timestamp': timestamp}) # This returns as job.result in gui2.ui.annotations_fetched(self,job) return bookmarked_books diff --git a/src/calibre/devices/kobo/bookmark.py b/src/calibre/devices/kobo/bookmark.py index a2f164d9f4..554740627b 100644 --- a/src/calibre/devices/kobo/bookmark.py +++ b/src/calibre/devices/kobo/bookmark.py @@ -126,14 +126,14 @@ class Bookmark: # {{{ # book_title = row[8] chapter_progress = min(round(float(100*row['ChapterProgress']),2),100) - user_notes[note_id] = dict(id=self.id, - displayed_location=note_id, - type=e_type, - text=text, - annotation=annotation, - chapter=current_chapter, - chapter_title=chapter_title, - chapter_progress=chapter_progress) + user_notes[note_id] = {'id': self.id, + 'displayed_location': note_id, + 'type': e_type, + 'text': text, + 'annotation': annotation, + 'chapter': current_chapter, + 'chapter_title': chapter_title, + 'chapter_progress': chapter_progress} previous_chapter = current_chapter # debug_print("e_type:" , e_type, '\t', 'loc: ', note_id, 'text: ', text, # 'annotation: ', annotation, 'chapter_title: ', chapter_title, diff --git a/src/calibre/ebooks/conversion/cli.py b/src/calibre/ebooks/conversion/cli.py index beb3496656..53db521631 100644 --- a/src/calibre/ebooks/conversion/cli.py +++ b/src/calibre/ebooks/conversion/cli.py @@ -88,7 +88,7 @@ def option_recommendation_to_cli_option(add_option, rec): switches = ['-'+opt.short_switch] if opt.short_switch else [] switches.append('--'+opt.long_switch) attrs = dict(dest=opt.name, help=opt.help, - choices=opt.choices, default=rec.recommended_value) + choices=opt.choices, default=rec.recommended_value) if isinstance(rec.recommended_value, bool): attrs['action'] = 'store_false' if rec.recommended_value else \ 'store_true' diff --git a/src/calibre/ebooks/lrf/pylrs/pylrf.py b/src/calibre/ebooks/lrf/pylrs/pylrf.py index 6a5e10a612..d499f62c29 100644 --- a/src/calibre/ebooks/lrf/pylrs/pylrf.py +++ b/src/calibre/ebooks/lrf/pylrs/pylrf.py @@ -267,14 +267,13 @@ TAG_INFO = dict( setemptyview=(0xF52A, {'show':1, 'empty':0}, writeWord), pageposition=(0xF52B, {'any':0,'upper':1, 'lower':2}, writeWord), evensidemargin=(0xF52C, writeWord), - framemode=(0xF52E, - {'None':0, 'curve':2, 'square':1}, writeWord), + framemode=(0xF52E, {'None':0, 'curve':2, 'square':1}, writeWord), blockwidth=(0xF531, writeWord), blockheight=(0xF532, writeWord), blockrule=(0xF533, {'horz-fixed':0x14, 'horz-adjustable':0x12, - 'vert-fixed':0x41, 'vert-adjustable':0x21, - 'block-fixed':0x44, 'block-adjustable':0x22}, - writeWord), + 'vert-fixed':0x41, 'vert-adjustable':0x21, + 'block-fixed':0x44, 'block-adjustable':0x22}, + writeWord), bgcolor=(0xF534, writeColor), layout=(0xF535, {'TbRl':0x41, 'LrTb':0x34}, writeWord), framewidth=(0xF536, writeWord), diff --git a/src/calibre/ebooks/metadata/topaz.py b/src/calibre/ebooks/metadata/topaz.py index e18218eaba..d82df6cc94 100644 --- a/src/calibre/ebooks/metadata/topaz.py +++ b/src/calibre/ebooks/metadata/topaz.py @@ -238,8 +238,8 @@ class MetadataUpdater: offset += consumed len_comp, consumed = self.decode_vwi(self.data[offset:offset+4]) offset += consumed - blocks[val] = dict(offset=hdr_offset,len_uncomp=len_uncomp,len_comp=len_comp) - topaz_headers[tag] = dict(blocks=blocks) + blocks[val] = {'offset': hdr_offset,'len_uncomp': len_uncomp,'len_comp': len_comp} + topaz_headers[tag] = {'blocks': blocks} th_seq.append(tag) self.eoth = self.data[offset] offset += 1 diff --git a/src/calibre/ebooks/oeb/transforms/jacket.py b/src/calibre/ebooks/oeb/transforms/jacket.py index 1f0814994e..ecc10f80b6 100644 --- a/src/calibre/ebooks/oeb/transforms/jacket.py +++ b/src/calibre/ebooks/oeb/transforms/jacket.py @@ -332,23 +332,24 @@ def render_jacket(mi, output_profile, def generate_html(comments): display = Attributes() - args = dict(xmlns=XHTML_NS, - title_str=title_str, - identifiers=Identifiers(mi.identifiers), - css=css, - title=title, - author=author, - publisher=publisher, publisher_label=_('Publisher'), - pubdate_label=_('Published'), pubdate=Timestamp(pubdate, tweaks['gui_pubdate_display_format']), - series_label=ngettext('Series', 'Series', 1), series=series, - rating_label=_('Rating'), rating=rating, - tags_label=_('Tags'), tags=tags, - timestamp=Timestamp(timestamp, tweaks['gui_timestamp_display_format']), timestamp_label=_('Date'), - comments=comments, - footer='', - display=display, - searchable_tags=' '.join(escape(t)+'ttt' for t in tags.tags_list), - ) + args = { + 'xmlns': XHTML_NS, + 'title_str': title_str, + 'identifiers': Identifiers(mi.identifiers), + 'css': css, + 'title': title, + 'author': author, + 'publisher': publisher, 'publisher_label': _('Publisher'), + 'pubdate_label': _('Published'), 'pubdate': Timestamp(pubdate, tweaks['gui_pubdate_display_format']), + 'series_label': ngettext('Series', 'Series', 1), 'series': series, + 'rating_label': _('Rating'), 'rating': rating, + 'tags_label': _('Tags'), 'tags': tags, + 'timestamp': Timestamp(timestamp, tweaks['gui_timestamp_display_format']), 'timestamp_label': _('Date'), + 'comments': comments, + 'footer': '', + 'display': display, + 'searchable_tags': ' '.join(escape(t)+'ttt' for t in tags.tags_list), + } for key in mi.custom_field_keys(): m = mi.get_user_metadata(key, False) or {} try: diff --git a/src/calibre/gui2/actions/annotate.py b/src/calibre/gui2/actions/annotate.py index 8f8fdb0dac..ffcd4c32e0 100644 --- a/src/calibre/gui2/actions/annotate.py +++ b/src/calibre/gui2/actions/annotate.py @@ -102,7 +102,7 @@ class FetchAnnotationsAction(InterfaceAction): path = get_device_path_from_id(id) mi = db.get_metadata(id, index_is_id=True) a_path = device.create_annotations_path(mi, device_path=path) - path_map[id] = dict(path=a_path, fmts=get_formats(id)) + path_map[id] = {'path': a_path, 'fmts': get_formats(id)} return path_map device = self.gui.device_manager.device diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index b60304c447..87a3cc7ba3 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -1168,7 +1168,7 @@ class CatalogBuilder: authors=book['authors']) myMeta.author_sort = book['author_sort'] a_path = d.create_upload_path('/', myMeta, 'x.bookmark', create_dirs=False) - path_map[id] = dict(path=a_path, fmts=[x.rpartition('.')[2] for x in book['formats']]) + path_map[id] = {'path': a_path, 'fmts': [x.rpartition('.')[2] for x in book['formats']]} path_map, book_ext = _resolve_bookmark_paths(self.opts.connected_device['storage'], path_map) if path_map: diff --git a/src/calibre/library/save_to_disk.py b/src/calibre/library/save_to_disk.py index 9485189666..d984c946a2 100644 --- a/src/calibre/library/save_to_disk.py +++ b/src/calibre/library/save_to_disk.py @@ -29,26 +29,26 @@ plugboard_save_to_disk_value = 'save_to_disk' DEFAULT_TEMPLATE = '{author_sort}/{title}/{title} - {authors}' DEFAULT_SEND_TEMPLATE = '{author_sort}/{title} - {authors}' -FORMAT_ARG_DESCS = dict( - title=_('The title'), - authors=_('The authors'), - author_sort=_('The author sort string. To use only the first letter ' +FORMAT_ARG_DESCS = { + 'title': _('The title'), + 'authors': _('The authors'), + 'author_sort': _('The author sort string. To use only the first letter ' 'of the name use {author_sort[0]}'), - tags=_('The tags'), - series=_('The series'), - series_index=_('The series number. ' + 'tags': _('The tags'), + 'series': _('The series'), + 'series_index': _('The series number. ' 'To get leading zeros use {series_index:0>3s} or ' '{series_index:>3s} for leading spaces'), - rating=_('The rating'), - isbn=_('The ISBN'), - publisher=_('The publisher'), - timestamp=_('The date'), - pubdate=_('The published date'), - last_modified=_('The date when the metadata for this book record' + 'rating': _('The rating'), + 'isbn': _('The ISBN'), + 'publisher': _('The publisher'), + 'timestamp': _('The date'), + 'pubdate': _('The published date'), + 'last_modified': _('The date when the metadata for this book record' ' was last modified'), - languages=_('The language(s) of this book'), - id=_('The calibre internal id') - ) + 'languages': _('The language(s) of this book'), + 'id': _('The calibre internal id') +} FORMAT_ARGS = {} for x in FORMAT_ARG_DESCS: diff --git a/src/calibre/utils/wordcount.py b/src/calibre/utils/wordcount.py index 460c892104..ea1de2ae19 100644 --- a/src/calibre/utils/wordcount.py +++ b/src/calibre/utils/wordcount.py @@ -72,11 +72,11 @@ def get_wordcount(text): non_asian_words = nonj_len(text) words = non_asian_words + asian_chars - return dict(characters=characters, - chars_no_spaces=chars_no_spaces, - asian_chars=asian_chars, - non_asian_words=non_asian_words, - words=words) + return {'characters': characters, + 'chars_no_spaces': chars_no_spaces, + 'asian_chars': asian_chars, + 'non_asian_words': non_asian_words, + 'words': words} def dict2obj(dictionary): diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index f3a9cba292..545b4ebeb8 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -38,8 +38,7 @@ from polyglot.builtins import string_or_bytes def classes(classes): q = frozenset(classes.split(' ')) - return dict(attrs={ - 'class': lambda x: x and frozenset(x.split()).intersection(q)}) + return dict(attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)}) def prefixed_classes(classes):