diff --git a/sabnzbd/api.py b/sabnzbd/api.py index 6427cc3..0c0efb0 100644 --- a/sabnzbd/api.py +++ b/sabnzbd/api.py @@ -1062,7 +1062,7 @@ class xml_factory(object): def _dict(self, keyw, lst): text = [] - for key in list(lst.keys()): + for key in lst.keys(): text.append(self.run(key, lst[key])) if keyw: return '<%s>%s\n' % (keyw, ''.join(text), keyw) @@ -1947,7 +1947,7 @@ def list_cats(default=True): def remove_callable(dic): """ Remove all callable items from dictionary """ - for key, value in list(dic.items()): + for key, value in dic.items(): if callable(value): del dic[key] return dic diff --git a/sabnzbd/bpsmeter.py b/sabnzbd/bpsmeter.py index 4421844..ce5063e 100644 --- a/sabnzbd/bpsmeter.py +++ b/sabnzbd/bpsmeter.py @@ -190,7 +190,7 @@ class BPSMeter(object): self.defaults() # Force update of counters and validate data try: - for server in list(self.grand_total.keys()): + for server in self.grand_total.keys(): self.update(server) except TypeError: self.defaults() @@ -292,10 +292,10 @@ class BPSMeter(object): def get_sums(self): """ return tuple of grand, month, week, day totals """ - return (sum([v for v in list(self.grand_total.values())]), - sum([v for v in list(self.month_total.values())]), - sum([v for v in list(self.week_total.values())]), - sum([v for v in list(self.day_total.values())]) + return (sum([v for v in self.grand_total.values()]), + sum([v for v in self.month_total.values()]), + sum([v for v in self.week_total.values()]), + sum([v for v in self.day_total.values()]) ) def amounts(self, server): @@ -472,7 +472,7 @@ class BPSMeter(object): def midnight(self): """ Midnight action: dummy update for all servers """ - for server in list(self.day_total.keys()): + for server in self.day_total.keys(): self.update(server) diff --git a/sabnzbd/config.py b/sabnzbd/config.py index d0dfc3e..5e49d9f 100644 --- a/sabnzbd/config.py +++ b/sabnzbd/config.py @@ -623,7 +623,7 @@ def get_dconfig(section, keyword, nested=False): """ data = {} if not section: - for section in list(database.keys()): + for section in database.keys(): res, conf = get_dconfig(section, None, True) data.update(conf) @@ -634,12 +634,12 @@ def get_dconfig(section, keyword, nested=False): return False, {} if section in ('servers', 'categories', 'rss'): data[section] = [] - for keyword in list(sect.keys()): + for keyword in sect.keys(): res, conf = get_dconfig(section, keyword, True) data[section].append(conf) else: data[section] = {} - for keyword in list(sect.keys()): + for keyword in sect.keys(): res, conf = get_dconfig(section, keyword, True) data[section].update(conf) @@ -951,7 +951,7 @@ def get_ordered_categories(): # Transform to list and sort categories = [] - for cat in list(database_cats.keys()): + for cat in database_cats.keys(): if cat != '*': categories.append(database_cats[cat].get_dict()) diff --git a/sabnzbd/database.py b/sabnzbd/database.py index 49c1f7e..74bfed3 100644 --- a/sabnzbd/database.py +++ b/sabnzbd/database.py @@ -479,7 +479,7 @@ def build_history_info(nzo, storage='', downpath='', postproc_time=0, script_out # Pack the dictionary up into a single string # Stage Name is separated by ::: stage lines by ; and stages by \r\n lines = [] - for key, results in list(stages.items()): + for key, results in stages.items(): lines.append('%s:::%s' % (key, ';'.join(results))) stage_log = '\r\n'.join(lines) diff --git a/sabnzbd/downloader.py b/sabnzbd/downloader.py index 7f19b53..9186205 100644 --- a/sabnzbd/downloader.py +++ b/sabnzbd/downloader.py @@ -878,7 +878,7 @@ class Downloader(Thread): break def unblock_all(self): - for server_id in list(self._timers.keys()): + for server_id in self._timers.keys(): self.unblock(server_id) @NzbQueueLocker @@ -888,7 +888,7 @@ class Downloader(Thread): # Clean expired timers now = time.time() kicked = [] - for server_id in list(self._timers.keys()): + for server_id in self._timers.keys(): if not [stamp for stamp in self._timers[server_id] if stamp >= now]: logging.debug('Forcing re-evaluation of server %s', server_id) del self._timers[server_id] diff --git a/sabnzbd/interface.py b/sabnzbd/interface.py index f8a197a..e94361c 100644 --- a/sabnzbd/interface.py +++ b/sabnzbd/interface.py @@ -1726,7 +1726,7 @@ def handle_server(kwargs, root=None, new_svr=False): server = unique_svr_name(server) for kw in ('ssl', 'send_group', 'enable', 'optional'): - if kw not in list(kwargs.keys()): + if kw not in kwargs.keys(): kwargs[kw] = None if svr and not new_svr: svr.set_dict(kwargs) diff --git a/sabnzbd/nzbqueue.py b/sabnzbd/nzbqueue.py index 39005dc..fb1270d 100644 --- a/sabnzbd/nzbqueue.py +++ b/sabnzbd/nzbqueue.py @@ -424,7 +424,7 @@ class NzbQueue(object): if search: search = search.lower() removed = [] - for nzo_id in list(self.__nzo_table.keys()): + for nzo_id in self.__nzo_table.keys(): if (not search) or search in self.__nzo_table[nzo_id].final_name_pw_clean.lower(): nzo = self.__nzo_table.pop(nzo_id) nzo.deleted = True diff --git a/sabnzbd/nzbstuff.py b/sabnzbd/nzbstuff.py index 025003b..397eacd 100644 --- a/sabnzbd/nzbstuff.py +++ b/sabnzbd/nzbstuff.py @@ -1002,7 +1002,7 @@ class NzbObject(TryList): # If we couldn't parse it, we ignore it if pack: - if pack not in list(self.md5packs.values()): + if pack not in self.md5packs.values(): logging.debug('Got md5pack for set %s', nzf.setname) self.md5packs[setname] = pack # See if we need to postpone some pars @@ -1348,7 +1348,7 @@ class NzbObject(TryList): if not nzf.is_par2: # We have to find the right par-set blocks_new = 0 - for parset in list(self.extrapars.keys()): + for parset in self.extrapars.keys(): if (parset in nzf.filename or parset in original_filename) and self.extrapars[parset]: for new_nzf in self.extrapars[parset]: self.add_parfile(new_nzf) diff --git a/sabnzbd/osxmenu.py b/sabnzbd/osxmenu.py index 47f08ee..91d15eb 100644 --- a/sabnzbd/osxmenu.py +++ b/sabnzbd/osxmenu.py @@ -80,7 +80,7 @@ class SABnzbdDelegate(NSObject): # logging.info("building menu") status_bar = NSStatusBar.systemStatusBar() self.status_item = status_bar.statusItemWithLength_(NSVariableStatusItemLength) - for i in list(status_icons.keys()): + for i in status_icons.keys(): self.icons[i] = NSImage.alloc().initByReferencingFile_(status_icons[i]) if sabnzbd.DARWIN_VERSION > 9: # Support for Yosemite Dark Mode diff --git a/sabnzbd/rating.py b/sabnzbd/rating.py index eaa1836..3def19b 100644 --- a/sabnzbd/rating.py +++ b/sabnzbd/rating.py @@ -122,7 +122,7 @@ class Rating(Thread): silent=not cfg.rating_enable()) if self.version == 1: ratings = {} - for k, v in list(self.ratings.items()): + for k, v in self.ratings.items(): ratings[k] = NzbRatingV2().to_v2(v) self.ratings = ratings self.version = 2 diff --git a/sabnzbd/rss.py b/sabnzbd/rss.py index ec39a52..9e6db26 100644 --- a/sabnzbd/rss.py +++ b/sabnzbd/rss.py @@ -344,7 +344,7 @@ class RSSQueue(object): # If there's multiple feeds, remove the duplicates based on title and size if len(uris) > 1: skip_job = False - for job_link, job in list(jobs.items()): + for job_link, job in jobs.items(): # Allow 5% size deviation because indexers might have small differences for same release if job.get('title') == title and link != job_link and (job.get('size')*0.95) < size < (job.get('size')*1.05): logging.info("Ignoring job %s from other feed", title) @@ -504,7 +504,7 @@ class RSSQueue(object): if self.next_run < time.time(): self.next_run = time.time() + cfg.rss_rate.get() * 60 feeds = config.get_rss() - for feed in list(feeds.keys()): + for feed in feeds.keys(): try: if feeds[feed].enable.get(): logging.info('Starting scheduled RSS read-out for "%s"', feed) diff --git a/sabnzbd/tvsort.py b/sabnzbd/tvsort.py index ed8199e..c63b0e9 100644 --- a/sabnzbd/tvsort.py +++ b/sabnzbd/tvsort.py @@ -360,7 +360,7 @@ class SeriesSorter(object): # Replace elements path = path_subst(sorter, mapping) - for key, name in list(REPLACE_AFTER.items()): + for key, name in REPLACE_AFTER.items(): path = path.replace(key, name) # Lowercase all characters wrapped in {} @@ -609,7 +609,7 @@ class GenericSorter(object): path = path_subst(sorter, mapping) - for key, name in list(REPLACE_AFTER.items()): + for key, name in REPLACE_AFTER.items(): path = path.replace(key, name) # Lowercase all characters wrapped in {} @@ -676,7 +676,7 @@ class GenericSorter(object): if matched_files: logging.debug("Renaming a series of generic files (%s)", matched_files) renamed = list(matched_files.values()) - for index, file in list(matched_files.items()): + for index, file in matched_files.items(): filepath = os.path.join(current_path, file) renamed.append(filepath) self.fname, ext = os.path.splitext(os.path.split(file)[1]) @@ -828,7 +828,7 @@ class DateSorter(object): path = path_subst(sorter, mapping) - for key, name in list(REPLACE_AFTER.items()): + for key, name in REPLACE_AFTER.items(): path = path.replace(key, name) # Lowercase all characters wrapped in {} diff --git a/sabnzbd/utils/rsslib.py b/sabnzbd/utils/rsslib.py index 2605211..8b07de8 100644 --- a/sabnzbd/utils/rsslib.py +++ b/sabnzbd/utils/rsslib.py @@ -208,7 +208,7 @@ class RSS: c+= "length=\"" + str(i.enclosure.length )+ "\" " c+= "type=\"" + i.enclosure.type + "\"/>\n" - for k in list(i.nsItems.keys()): + for k in i.nsItems.keys(): c += self.optionalWrite( k , i.nsItems[ k ] ) c += "\n\n"