diff --git a/recipes/grantland.recipe b/recipes/grantland.recipe index 023ed97071..0c59eed83f 100644 --- a/recipes/grantland.recipe +++ b/recipes/grantland.recipe @@ -42,7 +42,7 @@ class GrantLand(BasicNewsRecipe): def parse_index(self): feeds = [] - seen_urls = set([]) + seen_urls = set() for category in self.CATEGORIES: diff --git a/recipes/insider.recipe b/recipes/insider.recipe index a29bce02f9..394a5a7b07 100644 --- a/recipes/insider.recipe +++ b/recipes/insider.recipe @@ -43,7 +43,7 @@ class insider(BasicNewsRecipe): raise ValueError('Could not find category content') articles = [] - seen_titles = set([]) + seen_titles = set() for title in titles: if title.string in seen_titles: continue diff --git a/recipes/letsgetcritical.recipe b/recipes/letsgetcritical.recipe index 0e41e1de32..7e47b0d318 100644 --- a/recipes/letsgetcritical.recipe +++ b/recipes/letsgetcritical.recipe @@ -31,7 +31,7 @@ class LetsGetCritical(BasicNewsRecipe): def parse_index(self): self.cover_url = 'http://www.letsgetcritical.org/wp-content/themes/lets_get_critical/images/lgc.jpg' feeds = [] - seen_urls = set([]) + seen_urls = set() regex = re.compile(r'http://(www\.)?([^/:]+)', re.I) for category in self.CATEGORIES: diff --git a/recipes/mwjournal.recipe b/recipes/mwjournal.recipe index 7d8cae5512..e5972afc8f 100644 --- a/recipes/mwjournal.recipe +++ b/recipes/mwjournal.recipe @@ -98,7 +98,7 @@ class MWJournal(BasicNewsRecipe): self.log('Found Cover image:', self.cover_url) feeds = [] - seen_titles = set([]) # This is used to remove duplicant articles + seen_titles = set() # This is used to remove duplicant articles sections = soup.find('div', attrs={'class': 'box2 publication'}) for section in sections.findAll('div', attrs={'class': 'records'}): section_title = self.tag_to_string(section.find('h3')) diff --git a/recipes/pagina_12_print_ed.recipe b/recipes/pagina_12_print_ed.recipe index 628c1962fd..d7be2f8194 100644 --- a/recipes/pagina_12_print_ed.recipe +++ b/recipes/pagina_12_print_ed.recipe @@ -55,7 +55,7 @@ class Pagina12(BasicNewsRecipe): feeds = [] - seen_titles = set([]) + seen_titles = set() for section in soup.findAll('div', 'seccionx'): numero += 1 print(numero) diff --git a/recipes/pravo.recipe b/recipes/pravo.recipe index e5715b2aeb..802cbeec31 100644 --- a/recipes/pravo.recipe +++ b/recipes/pravo.recipe @@ -21,7 +21,7 @@ class pravo(BasicNewsRecipe): no_stylesheets = True # our variables - seen_titles = set([]) + seen_titles = set() # only yesterday's articles are online parent_url = 'http://pravo.novinky.cz/minule/' feeds = [ diff --git a/recipes/southernstar.recipe b/recipes/southernstar.recipe index 8bcd12e885..bab9e7caad 100644 --- a/recipes/southernstar.recipe +++ b/recipes/southernstar.recipe @@ -48,7 +48,7 @@ class TheSouthernStar(BasicNewsRecipe): def parse_index(self): feeds = [] - seen_titles = set([]) + seen_titles = set() articles = self.fetch_ss_articles(self.NEWS_INDEX, seen_titles) if articles: diff --git a/recipes/vanityfair.recipe b/recipes/vanityfair.recipe index 35d663eeb1..ac12310979 100644 --- a/recipes/vanityfair.recipe +++ b/recipes/vanityfair.recipe @@ -45,7 +45,7 @@ class VanityFair(BasicNewsRecipe): self.cover_url = 'http://www.vanityfair.com/magazine/toc/contents-%s/_jcr_content/par/cn_contentwell/par-main/cn_pagination_contai/cn_image.size.cover_vanityfair_300.jpg' % ( # noqa date.today().strftime('%Y%m')) feeds = [] - seen_urls = set([]) + seen_urls = set() features = [] for category in self.CATEGORIES: diff --git a/src/calibre/customize/__init__.py b/src/calibre/customize/__init__.py index de6447d6ff..fb45d36983 100644 --- a/src/calibre/customize/__init__.py +++ b/src/calibre/customize/__init__.py @@ -405,7 +405,7 @@ class MetadataReaderPlugin(Plugin): # {{{ ''' #: Set of file types for which this plugin should be run. #: For example: ``set(['lit', 'mobi', 'prc'])`` - file_types = set([]) + file_types = set() supported_platforms = ['windows', 'osx', 'linux'] version = numeric_version @@ -437,7 +437,7 @@ class MetadataWriterPlugin(Plugin): # {{{ ''' #: Set of file types for which this plugin should be run. #: For example: ``set(['lit', 'mobi', 'prc'])`` - file_types = set([]) + file_types = set() supported_platforms = ['windows', 'osx', 'linux'] version = numeric_version @@ -473,7 +473,7 @@ class CatalogPlugin(Plugin): # {{{ #: Output file type for which this plugin should be run. #: For example: 'epub' or 'xml' - file_types = set([]) + file_types = set() type = _('Catalog generator') diff --git a/src/calibre/customize/ui.py b/src/calibre/customize/ui.py index 2d98f56573..a13b501b66 100644 --- a/src/calibre/customize/ui.py +++ b/src/calibre/customize/ui.py @@ -37,8 +37,8 @@ def _config(): c.add_opt('plugins', default={}, help=_('Installed plugins')) c.add_opt('filetype_mapping', default={}, help=_('Mapping for filetype plugins')) c.add_opt('plugin_customization', default={}, help=_('Local plugin customization')) - c.add_opt('disabled_plugins', default=set([]), help=_('Disabled plugins')) - c.add_opt('enabled_plugins', default=set([]), help=_('Enabled plugins')) + c.add_opt('disabled_plugins', default=set(), help=_('Disabled plugins')) + c.add_opt('enabled_plugins', default=set(), help=_('Enabled plugins')) return ConfigProxy(c) @@ -307,14 +307,14 @@ def available_store_plugins(): def stores(): - stores = set([]) + stores = set() for plugin in store_plugins(): stores.add(plugin.name) return stores def available_stores(): - stores = set([]) + stores = set() for plugin in available_store_plugins(): stores.add(plugin.name) return stores @@ -575,7 +575,7 @@ def catalog_plugins(): def available_catalog_formats(): - formats = set([]) + formats = set() for plugin in catalog_plugins(): if not is_disabled(plugin): for format in plugin.file_types: diff --git a/src/calibre/db/backend.py b/src/calibre/db/backend.py index b7719d925f..3d727033b4 100644 --- a/src/calibre/db/backend.py +++ b/src/calibre/db/backend.py @@ -61,7 +61,7 @@ class DynamicFilter(object): # {{{ def __init__(self, name): self.name = name - self.ids = frozenset([]) + self.ids = frozenset() def __call__(self, id_): return int(id_ in self.ids) diff --git a/src/calibre/db/legacy.py b/src/calibre/db/legacy.py index d669426462..fa1f96d77e 100644 --- a/src/calibre/db/legacy.py +++ b/src/calibre/db/legacy.py @@ -29,7 +29,7 @@ def cleanup_tags(tags): tags = [x.decode(preferred_encoding, 'replace') if isbytestring(x) else x for x in tags] tags = [u' '.join(x.split()) for x in tags] - ans, seen = [], set([]) + ans, seen = [], set() for tag in tags: if tag.lower() not in seen: seen.add(tag.lower()) diff --git a/src/calibre/devices/prs505/sony_cache.py b/src/calibre/devices/prs505/sony_cache.py index b7d9aff9e7..5c0d1677c4 100644 --- a/src/calibre/devices/prs505/sony_cache.py +++ b/src/calibre/devices/prs505/sony_cache.py @@ -192,7 +192,7 @@ class XMLCache(object): def ensure_unique_playlist_titles(self): for i, root in self.record_roots.items(): - seen = set([]) + seen = set() for playlist in root.xpath('//*[local-name()="playlist"]'): title = playlist.get('title', None) if title is None: diff --git a/src/calibre/ebooks/metadata/xisbn.py b/src/calibre/ebooks/metadata/xisbn.py index 075d8d52d6..0e0c72a59a 100644 --- a/src/calibre/ebooks/metadata/xisbn.py +++ b/src/calibre/ebooks/metadata/xisbn.py @@ -74,7 +74,7 @@ class xISBN(object): def get_associated_isbns(self, isbn): data = self.get_data(isbn) - ans = set([]) + ans = set() for rec in data: for i in rec.get('isbn', []): ans.add(i) diff --git a/src/calibre/ebooks/pdf/reflow.py b/src/calibre/ebooks/pdf/reflow.py index 7c776f15a6..780a1e2556 100644 --- a/src/calibre/ebooks/pdf/reflow.py +++ b/src/calibre/ebooks/pdf/reflow.py @@ -491,7 +491,7 @@ class Page(object): for i, x in enumerate(self.elements): x.idx = i current_region = Region(self.opts, self.log) - processed = set([]) + processed = set() for x in self.elements: if x in processed: continue @@ -526,8 +526,8 @@ class Page(object): # closer to the avg number of cols in the set, if equal use larger # region) found = True - absorbed = set([]) - processed = set([]) + absorbed = set() + processed = set() while found: found = False for i, region in enumerate(self.regions): diff --git a/src/calibre/gui2/actions/__init__.py b/src/calibre/gui2/actions/__init__.py index 8383fd469a..390cdc34e1 100644 --- a/src/calibre/gui2/actions/__init__.py +++ b/src/calibre/gui2/actions/__init__.py @@ -90,11 +90,11 @@ class InterfaceAction(QObject): #: Set of locations to which this action must not be added. #: See :attr:`all_locations` for a list of possible locations - dont_add_to = frozenset([]) + dont_add_to = frozenset() #: Set of locations from which this action must not be removed. #: See :attr:`all_locations` for a list of possible locations - dont_remove_from = frozenset([]) + dont_remove_from = frozenset() all_locations = frozenset(['toolbar', 'toolbar-device', 'context-menu', 'context-menu-device', 'toolbar-child', 'menubar', 'menubar-device', diff --git a/src/calibre/gui2/actions/mark_books.py b/src/calibre/gui2/actions/mark_books.py index 2a95c7c2b9..aea842b982 100644 --- a/src/calibre/gui2/actions/mark_books.py +++ b/src/calibre/gui2/actions/mark_books.py @@ -109,7 +109,7 @@ class MarkBooksAction(InterfaceAction): if not rows or len(rows) == 0: d = error_dialog(self.gui, _('Cannot mark'), _('No books selected')) d.exec_() - return set([]) + return set() return set(map(self.gui.library_view.model().id, rows)) def toggle_ids(self, book_ids): diff --git a/src/calibre/gui2/custom_column_widgets.py b/src/calibre/gui2/custom_column_widgets.py index 8af25cd673..f6e41ea7dd 100644 --- a/src/calibre/gui2/custom_column_widgets.py +++ b/src/calibre/gui2/custom_column_widgets.py @@ -828,7 +828,7 @@ class BulkBase(Base): return self._cached_gui_val_ def get_initial_value(self, book_ids): - values = set([]) + values = set() for book_id in book_ids: val = self.db.get_custom(book_id, num=self.col_id, index_is_id=True) if isinstance(val, list): diff --git a/src/calibre/gui2/jobs.py b/src/calibre/gui2/jobs.py index b08cdf3f89..16f138229b 100644 --- a/src/calibre/gui2/jobs.py +++ b/src/calibre/gui2/jobs.py @@ -181,7 +181,7 @@ class JobManager(QAbstractTableModel, AdaptSQP): # {{{ self.dataChanged.emit(idx, idx) # Update parallel jobs - jobs = set([]) + jobs = set() while True: try: jobs.add(self.server.changed_jobs_queue.get_nowait()) diff --git a/src/calibre/gui2/keyboard.py b/src/calibre/gui2/keyboard.py index 12d8ea798f..7fb03bee30 100644 --- a/src/calibre/gui2/keyboard.py +++ b/src/calibre/gui2/keyboard.py @@ -297,7 +297,7 @@ class ConfigModel(SearchQueryParser, QAbstractItemModel): def get_matches(self, location, query, candidates=None): if candidates is None: candidates = self.universal_set() - ans = set([]) + ans = set() if not query: return ans query = lower(query) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 333c8f5986..410e9cdb37 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -1243,8 +1243,8 @@ class OnDeviceSearch(SearchQueryParser): # {{{ query = query.lower() if location not in self.USABLE_LOCATIONS: - return set([]) - matches = set([]) + return set() + matches = set() all_locs = set(self.USABLE_LOCATIONS) - {'all', 'tags'} locations = all_locs if location == 'all' else [location] q = { diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index 3e9ed950c6..7fad12dc1f 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -1125,7 +1125,7 @@ class BooksView(QTableView): # {{{ rows = {x.row() if hasattr(x, 'row') else x for x in identifiers} if using_ids: - rows = set([]) + rows = set() identifiers = set(identifiers) m = self.model() for row in range(m.rowCount(QModelIndex())): diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index 68a5ea928f..f3c6a95970 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -390,7 +390,7 @@ class AuthorsEdit(EditWithComplete, ToMetadataMixin): return self.original_val != self.current_val def initialize(self, db, id_): - self.books_to_refresh = set([]) + self.books_to_refresh = set() self.set_separator('&') self.set_space_before_sep(True) self.set_add_separator(tweaks['authors_completer_append_separator']) @@ -602,7 +602,7 @@ class SeriesEdit(EditWithComplete, ToMetadataMixin): self.setToolTip(self.TOOLTIP) self.setWhatsThis(self.TOOLTIP) self.setEditable(True) - self.books_to_refresh = set([]) + self.books_to_refresh = set() self.lineEdit().textChanged.connect(self.data_changed) @property @@ -618,7 +618,7 @@ class SeriesEdit(EditWithComplete, ToMetadataMixin): self.lineEdit().setCursorPosition(0) def initialize(self, db, id_): - self.books_to_refresh = set([]) + self.books_to_refresh = set() all_series = db.all_series() all_series.sort(key=lambda x: sort_key(x[1])) self.update_items_cache([x[1] for x in all_series]) @@ -908,7 +908,7 @@ class FormatsManager(QWidget): self.changed = False self.formats.clear() exts = db.formats(id_, index_is_id=True) - self.original_val = set([]) + self.original_val = set() if exts: exts = exts.split(',') for ext in exts: @@ -1370,7 +1370,7 @@ class TagsEdit(EditWithComplete, ToMetadataMixin): # {{{ EditWithComplete.__init__(self, parent) self.currentTextChanged.connect(self.data_changed) self.lineEdit().setMaxLength(655360) # see https://bugs.launchpad.net/bugs/1630944 - self.books_to_refresh = set([]) + self.books_to_refresh = set() self.setToolTip(self.TOOLTIP) self.setWhatsThis(self.TOOLTIP) @@ -1386,7 +1386,7 @@ class TagsEdit(EditWithComplete, ToMetadataMixin): # {{{ self.setCursorPosition(0) def initialize(self, db, id_): - self.books_to_refresh = set([]) + self.books_to_refresh = set() tags = db.tags(id_, index_is_id=True) tags = tags.split(',') if tags else [] self.current_val = tags @@ -1753,7 +1753,7 @@ class PublisherEdit(EditWithComplete, ToMetadataMixin): # {{{ self.set_separator(None) self.setSizeAdjustPolicy( self.AdjustToMinimumContentsLengthWithIcon) - self.books_to_refresh = set([]) + self.books_to_refresh = set() self.clear_button = QToolButton(parent) self.clear_button.setIcon(QIcon(I('trash.png'))) self.clear_button.setToolTip(_('Clear publisher')) @@ -1772,7 +1772,7 @@ class PublisherEdit(EditWithComplete, ToMetadataMixin): # {{{ self.lineEdit().setCursorPosition(0) def initialize(self, db, id_): - self.books_to_refresh = set([]) + self.books_to_refresh = set() all_publishers = db.all_publishers() all_publishers.sort(key=lambda x: sort_key(x[1])) self.update_items_cache([x[1] for x in all_publishers]) diff --git a/src/calibre/gui2/metadata/single.py b/src/calibre/gui2/metadata/single.py index b251c137ef..f9f854bdfb 100644 --- a/src/calibre/gui2/metadata/single.py +++ b/src/calibre/gui2/metadata/single.py @@ -388,7 +388,7 @@ class MetadataSingleDialogBase(QDialog): def __call__(self, id_): self.book_id = id_ - self.books_to_refresh = set([]) + self.books_to_refresh = set() self.metadata_before_fetch = None for widget in self.basic_metadata_widgets: widget.initialize(self.db, id_) diff --git a/src/calibre/gui2/store/config/chooser/models.py b/src/calibre/gui2/store/config/chooser/models.py index 6f9bfa8b00..365565f0a7 100644 --- a/src/calibre/gui2/store/config/chooser/models.py +++ b/src/calibre/gui2/store/config/chooser/models.py @@ -229,8 +229,8 @@ class SearchFilter(SearchQueryParser): query = query.lower() if location not in self.USABLE_LOCATIONS: - return set([]) - matches = set([]) + return set() + matches = set() all_locs = set(self.USABLE_LOCATIONS) - {'all'} locations = all_locs if location == 'all' else [location] q = { diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py index 8f83333ee3..ea41016248 100644 --- a/src/calibre/gui2/store/search/models.py +++ b/src/calibre/gui2/store/search/models.py @@ -342,7 +342,7 @@ class SearchFilter(SearchQueryParser): self.srs.add(search_result) def clear_search_results(self): - self.srs = set([]) + self.srs = set() def universal_set(self): return self.srs @@ -391,8 +391,8 @@ class SearchFilter(SearchQueryParser): query = query.lower() if location not in self.USABLE_LOCATIONS: - return set([]) - matches = set([]) + return set() + matches = set() all_locs = set(self.USABLE_LOCATIONS) - {'all'} locations = all_locs if location == 'all' else [location] q = { diff --git a/src/calibre/gui2/store/stores/mobileread/models.py b/src/calibre/gui2/store/stores/mobileread/models.py index 01e2f83b5e..c1e378db4a 100644 --- a/src/calibre/gui2/store/stores/mobileread/models.py +++ b/src/calibre/gui2/store/stores/mobileread/models.py @@ -150,8 +150,8 @@ class SearchFilter(SearchQueryParser): query = query.lower() if location not in self.USABLE_LOCATIONS: - return set([]) - matches = set([]) + return set() + matches = set() all_locs = set(self.USABLE_LOCATIONS) - {'all'} locations = all_locs if location == 'all' else [location] q = { diff --git a/src/calibre/library/add_to_library.py b/src/calibre/library/add_to_library.py index b51f418261..78fa2be2e2 100644 --- a/src/calibre/library/add_to_library.py +++ b/src/calibre/library/add_to_library.py @@ -29,7 +29,7 @@ def find_folders_under(root, db, add_root=True, # {{{ root = os.path.abspath(root) - ans = set([]) + ans = set() for dirpath, dirnames, __ in os.walk(root, topdown=True, followlinks=follow_links): if cancel_callback(): break diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index 8904cfea8a..6cc8634b71 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -432,7 +432,7 @@ class ResultCache(SearchQueryParser): # {{{ } def get_numeric_matches(self, location, query, candidates, val_func=None): - matches = set([]) + matches = set() if len(query) == 0: return matches @@ -499,7 +499,7 @@ class ResultCache(SearchQueryParser): # {{{ return matches def get_user_category_matches(self, location, query, candidates): - matches = set([]) + matches = set() if self.db_prefs is None or len(query) < 2: return matches user_cats = self.db_prefs.get('user_categories', []) @@ -522,7 +522,7 @@ class ResultCache(SearchQueryParser): # {{{ return matches def get_keypair_matches(self, location, query, candidates): - matches = set([]) + matches = set() if query.find(':') >= 0: q = [q.strip() for q in query.split(':')] if len(q) != 2: @@ -640,7 +640,7 @@ class ResultCache(SearchQueryParser): # {{{ allow_recursion=True): # If candidates is not None, it must not be modified. Changing its # value will break query optimization in the search parser - matches = set([]) + matches = set() if candidates is None: candidates = self.universal_set() if len(candidates) == 0: @@ -681,7 +681,7 @@ class ResultCache(SearchQueryParser): # {{{ # apply the limit if appropriate if location == 'all' and prefs['limit_search_columns'] and \ prefs['limit_search_columns_to']: - terms = set([]) + terms = set() for l in prefs['limit_search_columns_to']: l = icu_lower(l.strip()) if l and l != 'all' and l in self.all_search_locations: diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 0a43ae247e..843e6ca450 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -159,7 +159,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): self.dirtied_lock = threading.RLock() if not os.path.exists(library_path): os.makedirs(library_path) - self.listeners = set([]) + self.listeners = set() self.library_path = os.path.abspath(library_path) self.row_factory = row_factory self.dbpath = os.path.join(library_path, 'metadata.db') @@ -1122,7 +1122,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): title = pat.sub(repl, title) return title - identical_book_ids = set([]) + identical_book_ids = set() if mi.authors: try: quathors = mi.authors[:10] # Too many authors causes parsing of @@ -1247,7 +1247,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): def all_formats(self): formats = self.conn.get('SELECT DISTINCT format from data') if not formats: - return set([]) + return set() return {f[0] for f in formats} def format_files(self, index, index_is_id=False): @@ -1700,7 +1700,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): self.conn.commit() def get_books_for_category(self, category, id_): - ans = set([]) + ans = set() if category not in self.field_metadata: return ans @@ -2984,7 +2984,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): 'SELECT name FROM tags WHERE id IN (SELECT tag FROM books_tags_link WHERE book=?)', (id,), all=True) if not result: - return set([]) + return set() return {r[0] for r in result} @classmethod @@ -2993,7 +2993,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): tags = [x.decode(preferred_encoding, 'replace') if isbytestring(x) else x for x in tags] tags = [u' '.join(x.split()) for x in tags] - ans, seen = [], set([]) + ans, seen = [], set() for tag in tags: if tag.lower() not in seen: seen.add(tag.lower()) @@ -3580,7 +3580,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): def get_top_level_move_items(self): items = set(os.listdir(self.library_path)) - paths = set([]) + paths = set() for x in self.data.universal_set(): path = self.path(x, index_is_id=True) path = path.split(os.sep)[0] @@ -3602,7 +3602,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): progress = lambda x:x if not os.path.exists(newloc): os.makedirs(newloc) - old_dirs = set([]) + old_dirs = set() items, path_map = self.get_top_level_move_items() for x in items: src = os.path.join(self.library_path, x) diff --git a/src/calibre/library/sqlite.py b/src/calibre/library/sqlite.py index cbc1786d47..95ad9c2898 100644 --- a/src/calibre/library/sqlite.py +++ b/src/calibre/library/sqlite.py @@ -94,7 +94,7 @@ class DynamicFilter(object): def __init__(self, name): self.name = name - self.ids = frozenset([]) + self.ids = frozenset() def __call__(self, id_): return int(id_ in self.ids) diff --git a/src/calibre/utils/search_query_parser.py b/src/calibre/utils/search_query_parser.py index 85255b021e..60691defea 100644 --- a/src/calibre/utils/search_query_parser.py +++ b/src/calibre/utils/search_query_parser.py @@ -337,7 +337,7 @@ class SearchQueryParser(object): def parse(self, query, candidates=None): # empty the list of searches used for recursion testing self.recurse_level = 0 - self.searches_seen = set([]) + self.searches_seen = set() candidates = self.universal_set() return self._parse(query, candidates=candidates) diff --git a/src/calibre/utils/search_query_parser_test.py b/src/calibre/utils/search_query_parser_test.py index 544da2dc61..b7df1e3dab 100644 --- a/src/calibre/utils/search_query_parser_test.py +++ b/src/calibre/utils/search_query_parser_test.py @@ -309,7 +309,7 @@ class Tester(SearchQueryParser): '(tag:txt or tag:pdf)': {33, 258, 354, 305, 242, 51, 55, 56, 154}, '(tag:txt OR tag:pdf) and author:Tolstoy': {55, 56}, 'Tolstoy txt': {55, 56}, - 'Hamilton Amsterdam' : set([]), + 'Hamilton Amsterdam' : set(), u'Beär' : {91}, 'dysfunc or tolstoy': {348, 55, 56}, 'tag:txt AND NOT tolstoy': {33, 258, 354, 305, 242, 154}, @@ -341,7 +341,7 @@ class Tester(SearchQueryParser): getter = lambda x: '' if not query: - return set([]) + return set() query = query.lower() if candidates: return set(key for key, val in self.texts.items() diff --git a/src/calibre/web/feeds/recipes/model.py b/src/calibre/web/feeds/recipes/model.py index 3bc75b33e5..93bf9b4de7 100644 --- a/src/calibre/web/feeds/recipes/model.py +++ b/src/calibre/web/feeds/recipes/model.py @@ -297,7 +297,7 @@ class RecipeModel(QAbstractItemModel, AdaptSQP): query = query.strip().lower() if not query: return self.universal_set() - results = set([]) + results = set() for urn in self.universal_set(): recipe = self.recipe_from_urn(urn) if query in recipe.get('title', '').lower() or \