summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-25 09:42:49 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-25 09:42:49 +0200
commit952001324e1faf584b1adcb01c4a0406a3722932 (patch)
treeed87ade69e207e677d1144147b381bcd508ab25d
parentAccount rewritten (2) (diff)
downloadpyload-952001324e1faf584b1adcb01c4a0406a3722932.tar.xz
Don't user dictionary’s iterator methods
-rw-r--r--module/plugins/captcha/LinksaveIn.py2
-rw-r--r--module/plugins/container/TXT.py4
-rw-r--r--module/plugins/crypter/ShareLinksBiz.py2
-rw-r--r--module/plugins/crypter/YoutubeComFolder.py4
-rw-r--r--module/plugins/hooks/Checksum.py2
-rw-r--r--module/plugins/hooks/ExternalScripts.py2
-rw-r--r--module/plugins/hooks/ExtractArchive.py2
-rw-r--r--module/plugins/hooks/MegaRapidoNetHook.py2
-rw-r--r--module/plugins/hooks/MergeFiles.py4
-rw-r--r--module/plugins/hooks/UpdateManager.py2
-rw-r--r--module/plugins/hoster/SoundcloudCom.py2
-rw-r--r--module/plugins/internal/Account.py6
-rw-r--r--module/plugins/internal/Addon.py2
-rw-r--r--module/plugins/internal/Crypter.py2
-rw-r--r--module/plugins/internal/Hoster.py4
-rw-r--r--module/plugins/internal/MultiHook.py4
-rw-r--r--module/plugins/internal/OCR.py4
-rw-r--r--module/plugins/internal/Plugin.py4
-rw-r--r--module/plugins/internal/SimpleHoster.py2
19 files changed, 28 insertions, 28 deletions
diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py
index ab9f54068..4d2e2bc34 100644
--- a/module/plugins/captcha/LinksaveIn.py
+++ b/module/plugins/captcha/LinksaveIn.py
@@ -85,7 +85,7 @@ class LinksaveIn(OCR):
stat[bgpath] += 1
max_p = 0
bg = ""
- for bgpath, value in stat.iteritems():
+ for bgpath, value in stat.items():
if max_p < value:
bg = bgpath
max_p = value
diff --git a/module/plugins/container/TXT.py b/module/plugins/container/TXT.py
index 90b7ccc90..8c9f99c27 100644
--- a/module/plugins/container/TXT.py
+++ b/module/plugins/container/TXT.py
@@ -54,7 +54,7 @@ class TXT(Container):
txt.close()
#: Empty packages fix
- for key, value in packages.iteritems():
+ for key, value in packages.items():
if not value:
packages.pop(key, None)
@@ -66,5 +66,5 @@ class TXT(Container):
except IOError:
self.log_warning(_("Failed to flush list"))
- for name, links in packages.iteritems():
+ for name, links in packages.items():
self.packages.append((name, links, name))
diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py
index d9c31dc5b..b9ddd953f 100644
--- a/module/plugins/crypter/ShareLinksBiz.py
+++ b/module/plugins/crypter/ShareLinksBiz.py
@@ -140,7 +140,7 @@ class ShareLinksBiz(Crypter):
def _resolve_coords(self, coords, captchaMap):
x, y = coords
- for rect, href in captchaMap.iteritems():
+ for rect, href in captchaMap.items():
x1, y1, x2, y2 = rect
if (x >= x1 and x <= x2) and (y >= y1 and y <= y2):
return href
diff --git a/module/plugins/crypter/YoutubeComFolder.py b/module/plugins/crypter/YoutubeComFolder.py
index 463e48c2d..ea09c63f9 100644
--- a/module/plugins/crypter/YoutubeComFolder.py
+++ b/module/plugins/crypter/YoutubeComFolder.py
@@ -108,13 +108,13 @@ class YoutubeComFolder(Crypter):
playlists = self.get_playlists(channel['id'])
self.log_debug("%s playlist\s found on channel \"%s\"" % (len(playlists), channel['title']))
- relatedplaylist = {p_name: self.get_playlist(p_id) for p_name, p_id in channel['relatedPlaylists'].iteritems()}
+ relatedplaylist = {p_name: self.get_playlist(p_id) for p_name, p_id in channel['relatedPlaylists'].items()}
self.log_debug("Channel's related playlists found = %s" % relatedplaylist.keys())
relatedplaylist['uploads']['title'] = "Unplaylisted videos"
relatedplaylist['uploads']['checkDups'] = True #: checkDups flag
- for p_name, p_data in relatedplaylist.iteritems():
+ for p_name, p_data in relatedplaylist.items():
if self.get_config(p_name):
p_data['title'] += " of " + user
playlists.append(p_data)
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py
index 9eb47e8a6..251918df5 100644
--- a/module/plugins/hooks/Checksum.py
+++ b/module/plugins/hooks/Checksum.py
@@ -166,7 +166,7 @@ class Checksum(Addon):
def package_finished(self, pypack):
download_folder = fs_join(self.pyload.config.get("general", "download_folder"), pypack.folder, "")
- for link in pypack.getChildren().itervalues():
+ for link in pypack.getChildren().values():
file_type = os.path.splitext(link['name'])[1][1:].lower()
if file_type not in self.formats:
diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py
index 126a17635..9c9cd51c6 100644
--- a/module/plugins/hooks/ExternalScripts.py
+++ b/module/plugins/hooks/ExternalScripts.py
@@ -48,7 +48,7 @@ class ExternalScripts(Addon):
for dir in (pypath, ''):
self.init_plugin_type(folder, os.path.join(dir, 'scripts', folder))
- for script_type, names in self.scripts.iteritems():
+ for script_type, names in self.scripts.items():
if names:
self.log_info(_("Installed scripts for: ") + script_type, ", ".join(map(os.path.basename, names)))
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 5a51319ad..2e45f4a38 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -299,7 +299,7 @@ class ExtractArchive(Addon):
matched = False
success = True
files_ids = dict((pylink['name'], ((fs_join(download_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \
- in sorted(pypack.getChildren().itervalues(), key=lambda k: k['name'])).values() #: Remove duplicates
+ in sorted(pypack.getChildren().values(), key=lambda k: k['name'])).values() #: Remove duplicates
#: Check as long there are unseen files
while files_ids:
diff --git a/module/plugins/hooks/MegaRapidoNetHook.py b/module/plugins/hooks/MegaRapidoNetHook.py
index f66129a9e..4956427ff 100644
--- a/module/plugins/hooks/MegaRapidoNetHook.py
+++ b/module/plugins/hooks/MegaRapidoNetHook.py
@@ -76,7 +76,7 @@ class MegaRapidoNetHook(MultiHook):
hoster_list = []
- for item in hosters.itervalues():
+ for item in hosters.values():
hoster_list.extend(item)
return hoster_list
diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py
index 94c477b38..a76a578bf 100644
--- a/module/plugins/hooks/MergeFiles.py
+++ b/module/plugins/hooks/MergeFiles.py
@@ -30,7 +30,7 @@ class MergeFiles(Addon):
def package_finished(self, pack):
files = {}
fid_dict = {}
- for fid, data in pack.getChildren().iteritems():
+ for fid, data in pack.getChildren().items():
if re.search("\.\d{3}$", data['name']):
if data['name'][:-4] not in files:
files[data['name'][:-4]] = []
@@ -43,7 +43,7 @@ class MergeFiles(Addon):
if self.pyload.config.get("general", "folder_per_package"):
download_folder = fs_join(download_folder, pack.folder)
- for name, file_list in files.iteritems():
+ for name, file_list in files.items():
self.log_info(_("Starting merging of"), name)
with open(fs_join(download_folder, name), "wb") as final_file:
diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py
index 4e13bfe9c..c36b6c539 100644
--- a/module/plugins/hooks/UpdateManager.py
+++ b/module/plugins/hooks/UpdateManager.py
@@ -114,7 +114,7 @@ class UpdateManager(Addon):
modules = filter(
lambda m: m and (m.__name__.startswith("module.plugins.") or
m.__name__.startswith("userplugins.")) and
- m.__name__.count(".") >= 2, sys.modules.itervalues()
+ m.__name__.count(".") >= 2, sys.modules.values()
)
reloads = []
diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py
index 3380d1dd8..b189ee1ba 100644
--- a/module/plugins/hoster/SoundcloudCom.py
+++ b/module/plugins/hoster/SoundcloudCom.py
@@ -43,7 +43,7 @@ class SoundcloudCom(SimpleHoster):
get={'client_id': client_id}))
regex = re.compile(r'[^\d]')
- http_streams = sorted([(key, value) for key, value in streams.iteritems() if key.startswith('http_')],
+ http_streams = sorted([(key, value) for key, value in streams.items() if key.startswith('http_')],
key=lambda t: regex.sub(t[0], ''),
reverse=True)
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index f33d44179..b59a59932 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -88,7 +88,7 @@ class Account(Plugin):
#@TODO: Rewrite in 0.4.10
def init_accounts(self, accounts):
- for user, data in accounts.iteritems():
+ for user, data in accounts.items():
self.add(user, data['password'], data['options'])
self._login(user)
@@ -254,7 +254,7 @@ class Account(Plugin):
#: Remove in 0.4.10
def getAllAccounts(self, *args, **kwargs):
- return [self.getAccountData(user, *args, **kwargs) for user, info in self.info.iteritems()]
+ return [self.getAccountData(user, *args, **kwargs) for user, info in self.info.items()]
def login_fail(self, reason=_("Login handshake has failed")):
@@ -281,7 +281,7 @@ class Account(Plugin):
Returns an valid account name and data
"""
usable = []
- for user, info in self.info.iteritems():
+ for user, info in self.info.items():
if not info['login']['valid']:
continue
diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py
index 248518128..3c617f730 100644
--- a/module/plugins/internal/Addon.py
+++ b/module/plugins/internal/Addon.py
@@ -60,7 +60,7 @@ class Addon(Plugin):
def init_events(self):
if self.event_map:
- for event, funcs in self.event_map.iteritems():
+ for event, funcs in self.event_map.items():
if type(funcs) in (list, tuple):
for f in funcs:
self.manager.addEvent(event, getattr(self, f))
diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py
index 7e97c8228..c677b2852 100644
--- a/module/plugins/internal/Crypter.py
+++ b/module/plugins/internal/Crypter.py
@@ -57,7 +57,7 @@ class Crypter(Hoster):
"""
Generate new packages from self.urls
"""
- packages = [(name, links, None) for name, links in self.pyload.api.generatePackages(self.urls).iteritems()]
+ packages = [(name, links, None) for name, links in self.pyload.api.generatePackages(self.urls).items()]
self.packages.extend(packages)
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index 840d73847..10cab5616 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -362,7 +362,7 @@ class Hoster(Plugin):
self.fail(_("No url given"))
if self.pyload.debug:
- self.log_debug("DOWNLOAD URL " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")])
+ self.log_debug("DOWNLOAD URL " + url, *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url")])
self.captcha.correct()
self.check_for_same_files()
@@ -474,7 +474,7 @@ class Hoster(Plugin):
#: Produces encoding errors, better log to other file in the future?
# self.log_debug("Content: %s" % content)
- for name, rule in rules.iteritems():
+ for name, rule in rules.items():
if isinstance(rule, basestring):
if rule in content:
do_delete = True
diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py
index 0fa75df98..c49a3c89a 100644
--- a/module/plugins/internal/MultiHook.py
+++ b/module/plugins/internal/MultiHook.py
@@ -187,11 +187,11 @@ class MultiHook(Hook):
excludedList = []
if self.plugintype == "hoster":
- pluginMap = dict((name.lower(), name) for name in self.pyload.pluginManager.hosterPlugins.iterkeys())
+ pluginMap = dict((name.lower(), name) for name in self.pyload.pluginManager.hosterPlugins.keys())
accountList = [account.type.lower() for account in self.pyload.api.getAccounts(False) if account.valid and account.premium]
else:
pluginMap = {}
- accountList = [name[::-1].replace("Folder"[::-1], "", 1).lower()[::-1] for name in self.pyload.pluginManager.crypterPlugins.iterkeys()]
+ accountList = [name[::-1].replace("Folder"[::-1], "", 1).lower()[::-1] for name in self.pyload.pluginManager.crypterPlugins.keys()]
for plugin in self.plugins_cached():
name = remove_chars(plugin, "-.")
diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py
index 36d259e0c..9896837b5 100644
--- a/module/plugins/internal/OCR.py
+++ b/module/plugins/internal/OCR.py
@@ -260,7 +260,7 @@ class OCR(Plugin):
hkey = 0
hvalue = 0
- for key, value in highest.iteritems():
+ for key, value in highest.items():
if value > hvalue:
hkey = key
hvalue = value
@@ -325,7 +325,7 @@ class OCR(Plugin):
else:
result = self.result_captcha
- for key, item in values.iteritems():
+ for key, item in values.items():
if key.__class__ is str:
result = result.replace(key, item)
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 02ef326d6..7b3d03752 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -94,7 +94,7 @@ def parse_html_form(attr_str, html, input_names={}):
if input_names:
#: Check input attributes
- for key, val in input_names.iteritems():
+ for key, val in input_names.items():
if key in inputs:
if isinstance(val, basestring) and inputs[key] is val:
continue
@@ -271,7 +271,7 @@ class Plugin(object):
self.fail(_("No url given"))
if self.pyload.debug:
- self.log_debug("LOAD URL " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")])
+ self.log_debug("LOAD URL " + url, *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url")])
if req is None:
if hasattr(self, "req"):
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 8eea9dd5a..b063bcac2 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -18,7 +18,7 @@ from module.utils import fixup, fs_encode, parseFileSize as parse_size
#@TODO: Adapt and move to PyFile in 0.4.10
-statusMap = dict((v, k) for k, v in _statusMap.iteritems())
+statusMap = dict((v, k) for k, v in _statusMap.items())
class SimpleHoster(Hoster):