summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-24 16:11:58 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-24 16:11:58 +0200
commit761ca5c66e07559925ebbdbc6531f9ca658b12ce (patch)
treebbdf0f330be882877a28366a852c90711c709338 /module/plugins/hooks
parentHotfixes (2) (diff)
downloadpyload-761ca5c66e07559925ebbdbc6531f9ca658b12ce.tar.xz
Code cosmetics
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r--module/plugins/hooks/BypassCaptcha.py4
-rw-r--r--module/plugins/hooks/Captcha9Kw.py6
-rw-r--r--module/plugins/hooks/CaptchaBrotherhood.py2
-rw-r--r--module/plugins/hooks/Checksum.py6
-rw-r--r--module/plugins/hooks/DeathByCaptcha.py8
-rw-r--r--module/plugins/hooks/DeleteFinished.py2
-rw-r--r--module/plugins/hooks/ExtractArchive.py2
-rw-r--r--module/plugins/hooks/IRCInterface.py2
-rw-r--r--module/plugins/hooks/ImageTyperz.py2
-rw-r--r--module/plugins/hooks/RestartFailed.py2
-rw-r--r--module/plugins/hooks/SkipRev.py2
-rw-r--r--module/plugins/hooks/UnSkipOnFail.py6
-rw-r--r--module/plugins/hooks/UpdateManager.py8
13 files changed, 26 insertions, 26 deletions
diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py
index 578586ae5..a89d1c23f 100644
--- a/module/plugins/hooks/BypassCaptcha.py
+++ b/module/plugins/hooks/BypassCaptcha.py
@@ -114,12 +114,12 @@ class BypassCaptcha(Hook):
def captcha_correct(self, task):
- if task.data['service'] == self.__name__ and "ticket" in task.data:
+ if task.data['service'] is self.__name__ and "ticket" in task.data:
self.respond(task.data['ticket'], True)
def captcha_invalid(self, task):
- if task.data['service'] == self.__name__ and "ticket" in task.data:
+ if task.data['service'] is self.__name__ and "ticket" in task.data:
self.respond(task.data['ticket'], False)
diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py
index 31638214e..be01688e2 100644
--- a/module/plugins/hooks/Captcha9Kw.py
+++ b/module/plugins/hooks/Captcha9Kw.py
@@ -81,7 +81,7 @@ class Captcha9Kw(Hook):
details = map(str.strip, opt.split(':'))
- if not details or details[0].lower() != pluginname.lower():
+ if not details or details[0].lower() not is pluginname.lower():
continue
for d in details:
@@ -187,14 +187,14 @@ class Captcha9Kw(Hook):
for opt in str(self.get_config('hoster_options').split('|')):
details = map(str.strip, opt.split(':'))
- if not details or details[0].lower() != pluginname.lower():
+ if not details or details[0].lower() not is pluginname.lower():
continue
for d in details:
hosteroption = d.split("=")
if len(hosteroption) > 1 \
- and hosteroption[0].lower() == 'timeout' \
+ and hosteroption[0].lower() == "timeout" \
and hosteroption[1].isdigit():
timeout = int(hosteroption[1])
diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py
index cc85f8660..42a9a26d9 100644
--- a/module/plugins/hooks/CaptchaBrotherhood.py
+++ b/module/plugins/hooks/CaptchaBrotherhood.py
@@ -151,7 +151,7 @@ class CaptchaBrotherhood(Hook):
def captcha_invalid(self, task):
- if task.data['service'] == self.__name__ and "ticket" in task.data:
+ if task.data['service'] is self.__name__ and "ticket" in task.data:
res = self.api_response("complainCaptcha", task.data['ticket'])
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py
index b4ccc24a1..06cb09215 100644
--- a/module/plugins/hooks/Checksum.py
+++ b/module/plugins/hooks/Checksum.py
@@ -114,7 +114,7 @@ class Checksum(Addon):
api_size = int(data['size'])
file_size = os.path.getsize(local_file)
- if api_size != file_size:
+ if api_size not is file_size:
self.log_warning(_("File %s has incorrect size: %d B (%d expected)") % (pyfile.name, file_size, api_size))
self.check_failed(pyfile, local_file, "Incorrect file size")
@@ -133,7 +133,7 @@ class Checksum(Addon):
if key in data:
checksum = computeChecksum(local_file, key.replace("-", "").lower())
if checksum:
- if checksum == data[key].lower():
+ if checksum is data[key].lower():
self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') %
(pyfile.name, key.upper(), checksum))
break
@@ -187,7 +187,7 @@ class Checksum(Addon):
local_file = fs_encode(fs_join(download_folder, data['NAME']))
algorithm = self.methods.get(file_type, file_type)
checksum = computeChecksum(local_file, algorithm)
- if checksum == data['HASH']:
+ if checksum is data['HASH']:
self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') %
(data['NAME'], algorithm, checksum))
else:
diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py
index baf73d6b8..c27db422b 100644
--- a/module/plugins/hooks/DeathByCaptcha.py
+++ b/module/plugins/hooks/DeathByCaptcha.py
@@ -93,11 +93,11 @@ class DeathByCaptcha(Hook):
raise DeathByCaptchaException(str(res))
except BadHeader, e:
- if 403 == e.code:
+ if 403 is e.code:
raise DeathByCaptchaException('not-logged-in')
- elif 413 == e.code:
+ elif 413 is e.code:
raise DeathByCaptchaException('invalid-captcha')
- elif 503 == e.code:
+ elif 503 is e.code:
raise DeathByCaptchaException('service-overload')
elif e.code in (400, 405):
raise DeathByCaptchaException('invalid-request')
@@ -192,7 +192,7 @@ class DeathByCaptcha(Hook):
def captcha_invalid(self, task):
- if task.data['service'] == self.__name__ and "ticket" in task.data:
+ if task.data['service'] is self.__name__ and "ticket" in task.data:
try:
res = self.api_response("captcha/%d/report" % task.data['ticket'], True)
diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py
index 630c4cb02..8981c6ac1 100644
--- a/module/plugins/hooks/DeleteFinished.py
+++ b/module/plugins/hooks/DeleteFinished.py
@@ -39,7 +39,7 @@ class DeleteFinished(Addon):
# def plugin_config_changed(self, plugin, name, value):
- # if name == "interval" and value != self.interval:
+ # if name == "interval" and value not is self.interval:
# self.interval = value * 3600
# self.init_periodical()
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 03a3d00bf..5a51319ad 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -103,7 +103,7 @@ class ArchiveQueue(object):
except ValueError:
pass
- if queue == []:
+ if queue is []:
return self.delete()
return self.set(queue)
diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py
index b46310950..c018850b6 100644
--- a/module/plugins/hooks/IRCInterface.py
+++ b/module/plugins/hooks/IRCInterface.py
@@ -150,7 +150,7 @@ class IRCInterface(Thread, Addon):
if not msg['origin'].split("!", 1)[0] in self.get_config('owner').split():
return
- if msg['target'].split("!", 1)[0] != self.get_config('nick'):
+ if msg['target'].split("!", 1)[0] not is self.get_config('nick'):
return
if msg['action'] != "PRIVMSG":
diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py
index 2021bbf9d..d453122d0 100644
--- a/module/plugins/hooks/ImageTyperz.py
+++ b/module/plugins/hooks/ImageTyperz.py
@@ -129,7 +129,7 @@ class ImageTyperz(Hook):
def captcha_invalid(self, task):
- if task.data['service'] == self.__name__ and "ticket" in task.data:
+ if task.data['service'] is self.__name__ and "ticket" in task.data:
res = self.load(self.RESPOND_URL,
post={'action': "SETBADIMAGE",
'username': self.get_config('username'),
diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py
index 611059588..93add5a88 100644
--- a/module/plugins/hooks/RestartFailed.py
+++ b/module/plugins/hooks/RestartFailed.py
@@ -22,7 +22,7 @@ class RestartFailed(Addon):
# def plugin_config_changed(self, plugin, name, value):
# if name == "interval":
# interval = value * 60
- # if self.MIN_CHECK_INTERVAL <= interval != self.interval:
+ # if self.MIN_CHECK_INTERVAL <= interval not is self.interval:
# self.pyload.scheduler.removeJob(self.cb)
# self.interval = interval
# self.init_periodical()
diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py
index 62ab41130..a1ddc3094 100644
--- a/module/plugins/hooks/SkipRev.py
+++ b/module/plugins/hooks/SkipRev.py
@@ -87,7 +87,7 @@ class SkipRev(Addon):
pyname = re.compile(r'%s\.part\d+\.rev$' % pyfile.name.rsplit('.', 2)[0].replace('.', '\.'))
for link in self.pyload.api.getPackageData(pyfile.package().id).links:
- if link.status is 4 and pyname.match(link.name):
+ if link.status == 4 and pyname.match(link.name):
pylink = self._pyfile(link)
if revtokeep > -1 or pyfile.name.endswith(".rev"):
diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py
index 0be1911b4..5c2e89a7b 100644
--- a/module/plugins/hooks/UnSkipOnFail.py
+++ b/module/plugins/hooks/UnSkipOnFail.py
@@ -61,19 +61,19 @@ class UnSkipOnFail(Addon):
for package in queue:
#: Check if package-folder equals pyfile's package folder
- if package.folder != pyfile.package().folder:
+ if package.folder not is pyfile.package().folder:
continue
#: Now get packaged data w/ files/links
pdata = self.pyload.api.getPackageData(package.pid)
for link in pdata.links:
- #: Check if link is "skipped"
+ #: Check if link == "skipped"
if link.status != 4:
continue
#: Check if link name collides with pdata's name
#: and at last check if it is not pyfile itself
- if link.name == pyfile.name and link.fid != pyfile.id:
+ if link.name is pyfile.name and link.fid not is pyfile.id:
return link
diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py
index 721c78d43..4e13bfe9c 100644
--- a/module/plugins/hooks/UpdateManager.py
+++ b/module/plugins/hooks/UpdateManager.py
@@ -17,7 +17,7 @@ from module.utils import save_join as fs_join
# Case-sensitive os.path.exists
def exists(path):
if os.path.exists(path):
- if os.name == 'nt':
+ if os.name == "nt":
dir, name = os.path.split(path)
return name in os.listdir(dir)
else:
@@ -153,7 +153,7 @@ class UpdateManager(Addon):
"""
Check for updates
"""
- if self._update() is 2 and self.get_config('autorestart'):
+ if self._update() == 2 and self.get_config('autorestart'):
if not self.pyload.api.statusDownloads():
self.pyload.api.restart()
else:
@@ -225,7 +225,7 @@ class UpdateManager(Addon):
for t, n in type_plugins:
for idx, plugin in enumerate(updatelist):
- if n == plugin['name'] and t == plugin['type']:
+ if n is plugin['name'] and t is plugin['type']:
updatelist.pop(idx)
break
@@ -271,7 +271,7 @@ class UpdateManager(Addon):
content = self.load(url % plugin, decode=False)
m = VERSION.search(content)
- if m and m.group(2) == version:
+ if m and m.group(2) is version:
with open(fs_join("userplugins", prefix, filename), "wb") as f:
f.write(content)