summaryrefslogtreecommitdiffstats
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
parentHotfixes (2) (diff)
downloadpyload-761ca5c66e07559925ebbdbc6531f9ca658b12ce.tar.xz
Code cosmetics
-rw-r--r--module/plugins/accounts/FilecloudIo.py4
-rw-r--r--module/plugins/accounts/HellshareCz.py2
-rw-r--r--module/plugins/accounts/LetitbitNet.py2
-rw-r--r--module/plugins/accounts/LinksnappyCom.py4
-rw-r--r--module/plugins/captcha/CircleCaptcha.py124
-rw-r--r--module/plugins/captcha/LinksaveIn.py4
-rw-r--r--module/plugins/crypter/LinkCryptWs.py4
-rw-r--r--module/plugins/crypter/NCryptIn.py4
-rw-r--r--module/plugins/crypter/RelinkUs.py6
-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
-rw-r--r--module/plugins/hoster/BasePlugin.py2
-rw-r--r--module/plugins/hoster/DateiTo.py4
-rw-r--r--module/plugins/hoster/DlFreeFr.py2
-rw-r--r--module/plugins/hoster/FilecloudIo.py4
-rw-r--r--module/plugins/hoster/FilepostCom.py2
-rw-r--r--module/plugins/hoster/FilesMailRu.py2
-rw-r--r--module/plugins/hoster/FlyFilesNet.py2
-rw-r--r--module/plugins/hoster/LetitbitNet.py4
-rw-r--r--module/plugins/hoster/MegaCoNz.py2
-rw-r--r--module/plugins/hoster/PremiumTo.py2
-rw-r--r--module/plugins/hoster/QuickshareCz.py6
-rw-r--r--module/plugins/hoster/RPNetBiz.py2
-rw-r--r--module/plugins/hoster/RapiduNet.py4
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py4
-rw-r--r--module/plugins/hoster/TurbobitNet.py4
-rw-r--r--module/plugins/hoster/TusfilesNet.py2
-rw-r--r--module/plugins/hoster/UnibytesCom.py4
-rw-r--r--module/plugins/hoster/VkCom.py2
-rw-r--r--module/plugins/hoster/XHamsterCom.py2
-rw-r--r--module/plugins/hoster/Xdcc.py8
-rw-r--r--module/plugins/hoster/YibaishiwuCom.py2
-rw-r--r--module/plugins/hoster/YoutubeCom.py2
-rw-r--r--module/plugins/hoster/ZippyshareCom.py4
-rw-r--r--module/plugins/internal/Account.py6
-rw-r--r--module/plugins/internal/Crypter.py2
-rw-r--r--module/plugins/internal/Hoster.py6
-rw-r--r--module/plugins/internal/MultiHook.py4
-rw-r--r--module/plugins/internal/OCR.py16
-rw-r--r--module/plugins/internal/Plugin.py4
-rw-r--r--module/plugins/internal/SevenZip.py2
-rw-r--r--module/plugins/internal/SimpleCrypter.py2
-rw-r--r--module/plugins/internal/SimpleHoster.py18
-rw-r--r--module/plugins/internal/UnRar.py6
-rw-r--r--module/plugins/internal/XFSHoster.py2
56 files changed, 170 insertions, 176 deletions
diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py
index 379dcfac3..021160f03 100644
--- a/module/plugins/accounts/FilecloudIo.py
+++ b/module/plugins/accounts/FilecloudIo.py
@@ -22,9 +22,9 @@ class FilecloudIo(Account):
rep = self.load("https://secure.filecloud.io/api-fetch_apikey.api",
post={'username': user, 'password': self.get_account_data(user)['password']})
rep = json_loads(rep)
- if rep['status'] == 'ok':
+ if rep['status'] == "ok":
break
- elif rep['status'] == 'error' and rep['message'] == 'no such user or wrong password':
+ elif rep['status'] == "error" and rep['message'] == "no such user or wrong password":
self.log_error(_("Wrong username or password"))
return {'valid': False, 'premium': False}
else:
diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py
index 3b689e275..08030895a 100644
--- a/module/plugins/accounts/HellshareCz.py
+++ b/module/plugins/accounts/HellshareCz.py
@@ -37,7 +37,7 @@ class HellshareCz(Account):
#: Time-based account
vt = [int(x) for x in credit.split('.')[:2]]
lt = time.localtime()
- year = lt.tm_year + int(vt[1] < lt.tm_mon or (vt[1] == lt.tm_mon and vt[0] < lt.tm_mday))
+ year = lt.tm_year + int(vt[1] < lt.tm_mon or (vt[1] is lt.tm_mon and vt[0] < lt.tm_mday))
validuntil = time.mktime(time.strptime("%s%d 23:59:59" % (credit, year), "%d.%m.%Y %H:%M:%S"))
trafficleft = -1
else:
diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py
index 492d2db77..c4265761a 100644
--- a/module/plugins/accounts/LetitbitNet.py
+++ b/module/plugins/accounts/LetitbitNet.py
@@ -24,7 +24,7 @@ class LetitbitNet(Account):
# self.log_debug("API Key Info: " + api_rep)
# api_rep = json_loads(api_rep)
#
- # if api_rep['status'] == 'FAIL':
+ # if api_rep['status'] == "FAIL":
# self.log_warning(api_rep['data'])
# return {'valid': False, 'premium': False}
diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py
index 03ddc31e6..adad37148 100644
--- a/module/plugins/accounts/LinksnappyCom.py
+++ b/module/plugins/accounts/LinksnappyCom.py
@@ -33,10 +33,10 @@ class LinksnappyCom(Account):
validuntil = j['return']['expire']
- if validuntil == 'lifetime':
+ if validuntil == "lifetime":
validuntil = -1
- elif validuntil == 'expired':
+ elif validuntil == "expired":
return {'premium': False}
else:
diff --git a/module/plugins/captcha/CircleCaptcha.py b/module/plugins/captcha/CircleCaptcha.py
index 8ff488a2d..2b34f073c 100644
--- a/module/plugins/captcha/CircleCaptcha.py
+++ b/module/plugins/captcha/CircleCaptcha.py
@@ -89,7 +89,7 @@ class CircleCaptcha(OCR):
howmany = 0
for y in imageheight:
curpix = pix[x, y]
- # if jump == True:
+ # if jump is True:
if curpix > self.BACKGROUND:
if howmany <= cleandeep and howmany > 0:
#: Clean pixel
@@ -128,7 +128,7 @@ class CircleCaptcha(OCR):
if curpix < self.BLACKCOLOR:
blackfound = blackfound + 1
- if ExitWithBlack == True and blackfound >= 3:
+ if ExitWithBlack is True and blackfound >= 3:
break #: Exit if found black
else:
continue
@@ -138,8 +138,8 @@ class CircleCaptcha(OCR):
jump = False
continue
- if (curpix < self.BACKGROUND and color == -1) or (curpix == color and color > -1):
- if jump == False:
+ if (curpix < self.BACKGROUND and color == -1) or (curpix is color and color > -1):
+ if jump is False:
#: Found pixel
curcolor = curpix
newx = x, curcolor
@@ -158,7 +158,7 @@ class CircleCaptcha(OCR):
if curpix < self.BLACKCOLOR:
blackfound = blackfound + 1
- if ExitWithBlack == True and blackfound >= 3:
+ if ExitWithBlack is True and blackfound >= 3:
break #: Exit if found black
else:
continue
@@ -168,7 +168,7 @@ class CircleCaptcha(OCR):
#: Found last pixel and the first white
break
- if (curpix < self.BACKGROUND and color == -1) or (curpix == color and color > -1):
+ if (curpix < self.BACKGROUND and color == -1) or (curpix is color and color > -1):
#: Found pixel
curcolor = curpix
newx = x, curcolor
@@ -177,7 +177,7 @@ class CircleCaptcha(OCR):
def find_last_pixel_y(self, im, pix, curx, cury, DownToUp, color = -1, ExitWithBlack = False):
- if DownToUp == False:
+ if DownToUp is False:
imageheight = xrange(int(cury)+1, int(im.size[1])-1)
else:
imageheight = xrange(int(cury)-1, 1, -1)
@@ -189,7 +189,7 @@ class CircleCaptcha(OCR):
if curpix < self.BLACKCOLOR:
blackfound = blackfound + 1
- if ExitWithBlack == True and blackfound >= 3:
+ if ExitWithBlack is True and blackfound >= 3:
break #: Exit if found black
else:
continue
@@ -199,7 +199,7 @@ class CircleCaptcha(OCR):
#: Found last pixel and the first white
break
- if (curpix < self.BACKGROUND and color == -1) or (curpix == color and color > -1):
+ if (curpix < self.BACKGROUND and color == -1) or (curpix is color and color > -1):
#: Found pixel
curcolor = curpix
newy = y, color
@@ -422,30 +422,30 @@ class CircleCaptcha(OCR):
for p in missinglist:
#: Left and bottom
- if (self.verify_point(im, pix, p[0]-1, p[1], exactfind) == 1 and \
- self.verify_point(im, pix, p[0], p[1]+1, exactfind) == 1):
+ if (self.verify_point(im, pix, p[0]-1, p[1], exactfind) == 1
+ and self.verify_point(im, pix, p[0], p[1]+1, exactfind) == 1):
missing = missing - 1
- elif (self.verify_point(im, pix, p[0]-1, p[1], exactfind) == 1 and \
- self.verify_point(im, pix, p[0], p[1]-1, exactfind) == 1):
+ elif (self.verify_point(im, pix, p[0]-1, p[1], exactfind) == 1
+ and self.verify_point(im, pix, p[0], p[1]-1, exactfind) == 1):
missing = missing - 1
#: Right and bottom
- elif (self.verify_point(im, pix, p[0]+1, p[1], exactfind) == 1 and \
- self.verify_point(im, pix, p[0], p[1]+1, exactfind) == 1):
+ elif (self.verify_point(im, pix, p[0]+1, p[1], exactfind) == 1
+ and self.verify_point(im, pix, p[0], p[1]+1, exactfind) == 1):
missing = missing - 1
#: Right and up
- elif (self.verify_point(im, pix, p[0]+1, p[1], exactfind) == 1 and \
- self.verify_point(im, pix, p[0], p[1]-1, exactfind) == 1):
+ elif (self.verify_point(im, pix, p[0]+1, p[1], exactfind) == 1
+ and self.verify_point(im, pix, p[0], p[1]-1, exactfind) == 1):
missing = missing - 1
- if (p[0], p[1]+1) in missinglist or \
- (p[0], p[1]-1) in missinglist or \
- (p[0]+1, p[1]) in missinglist or \
- (p[0]-1, p[1]) in missinglist or \
- (p[0]+1, p[1]+1) in missinglist or \
- (p[0]-1, p[1]+1) in missinglist or \
- (p[0]+1, p[1]-1) in missinglist or \
- (p[0]-1, p[1]-1) in missinglist or \
- self.verify_point(im, pix, p[0], p[1], False) == 1:
+ if ((p[0], p[1]+1) in missinglist
+ or (p[0], p[1]-1) in missinglist
+ or (p[0]+1, p[1]) in missinglist
+ or (p[0]-1, p[1]) in missinglist
+ or (p[0]+1, p[1]+1) in missinglist
+ or (p[0]-1, p[1]+1) in missinglist
+ or (p[0]+1, p[1]-1) in missinglist
+ or (p[0]-1, p[1]-1) in missinglist
+ or self.verify_point(im, pix, p[0], p[1], False) == 1):
missingconsecutive = missingconsecutive + 1
# else:
# pix[p[0], p[1]] = 0
@@ -511,17 +511,17 @@ class CircleCaptcha(OCR):
return result
curpix = pix[x, y]
- if (curpix == color and color > -1) or (curpix < self.BACKGROUND and color == -1):
+ if (curpix is color and color > -1) or (curpix < self.BACKGROUND and color == -1):
if curpix > self.BLACKCOLOR:
result = 1
else:
result = -1
#: Verify around
- if (exact == False):
+ if exact is False:
if x + 1 < im.size[0]:
curpix = pix[x+1, y]
- if (curpix == color and color > -1) or (curpix < self.BACKGROUND and color == -1):
+ if (curpix is color and color > -1) or (curpix < self.BACKGROUND and color == -1):
if curpix > self.BLACKCOLOR:
result = 1
if curpix <= self.BLACKCOLOR:
@@ -529,7 +529,7 @@ class CircleCaptcha(OCR):
if x > 0:
curpix = pix[x-1, y]
- if (curpix == color and color > -1) or (curpix < self.BACKGROUND and color == -1):
+ if (curpix is color and color > -1) or (curpix < self.BACKGROUND and color == -1):
if curpix > self.BLACKCOLOR:
result = 1
if curpix <= self.BLACKCOLOR:
@@ -543,7 +543,7 @@ class CircleCaptcha(OCR):
mypalette = None
for im in ImageSequence(img):
im.save("orig.png", "png")
- if mypalette != None:
+ if mypalette not is None:
im.putpalette(mypalette)
mypalette = im.getpalette()
im = im.convert('L')
@@ -690,14 +690,14 @@ class CircleCaptcha(OCR):
if _pause != "":
valore = raw_input('Found ' + _pause + ' CIRCLE circle press [Enter] = continue / [q] for Quit: ' + str(verified))
- if valore == 'q':
+ if valore == "q":
sys.exit()
- if findnewcircle == True:
+ if findnewcircle is True:
break
- if findnewcircle == True:
+ if findnewcircle is True:
break
- if findnewcircle == True:
+ if findnewcircle is True:
break
if self.pyload.debug:
@@ -708,42 +708,36 @@ class CircleCaptcha(OCR):
verify = c[1]
if verify == 0:
p = c[0]
- if (
- ((p[0], p[1]+1, p[2]), 1) in found or \
- ((p[0], p[1]-1, p[2]), 1) in found or \
- ((p[0]+1, p[1], p[2]), 1) in found or \
- ((p[0]-1, p[1], p[2]), 1) in found or \
- ((p[0]+1, p[1]+1, p[2]), 1) in found or \
- ((p[0]-1, p[1]+1, p[2]), 1) in found or \
- ((p[0]+1, p[1]-1, p[2]), 1) in found or \
- ((p[0]-1, p[1]-1, p[2]), 1) in found \
- ):
+ if (((p[0], p[1]+1, p[2]), 1) in found
+ or ((p[0], p[1]-1, p[2]), 1) in found
+ or ((p[0]+1, p[1], p[2]), 1) in found
+ or ((p[0]-1, p[1], p[2]), 1) in found
+ or ((p[0]+1, p[1]+1, p[2]), 1) in found
+ or ((p[0]-1, p[1]+1, p[2]), 1) in found
+ or ((p[0]+1, p[1]-1, p[2]), 1) in found
+ or ((p[0]-1, p[1]-1, p[2]), 1) in found):
#: Delete nearly circle
verify = -1
- if (
- ((p[0], p[1]+1, p[2]+1), 1) in found or \
- ((p[0], p[1]-1, p[2]+1), 1) in found or \
- ((p[0]+1, p[1], p[2]+1), 1) in found or \
- ((p[0]-1, p[1], p[2]+1), 1) in found or \
- ((p[0]+1, p[1]+1, p[2]+1), 1) in found or \
- ((p[0]-1, p[1]+1, p[2]+1), 1) in found or \
- ((p[0]+1, p[1]-1, p[2]+1), 1) in found or \
- ((p[0]-1, p[1]-1, p[2]+1), 1) in found \
- ):
+ if (((p[0], p[1]+1, p[2]+1), 1) in found
+ or ((p[0], p[1]-1, p[2]+1), 1) in found
+ or ((p[0]+1, p[1], p[2]+1), 1) in found
+ or ((p[0]-1, p[1], p[2]+1), 1) in found
+ or ((p[0]+1, p[1]+1, p[2]+1), 1) in found
+ or ((p[0]-1, p[1]+1, p[2]+1), 1) in found
+ or ((p[0]+1, p[1]-1, p[2]+1), 1) in found
+ or ((p[0]-1, p[1]-1, p[2]+1), 1) in found):
#: Delete nearly circle
verify = -1
- if (
- ((p[0], p[1]+1, p[2]-1), 1) in found or \
- ((p[0], p[1]-1, p[2]-1), 1) in found or \
- ((p[0]+1, p[1], p[2]-1), 1) in found or \
- ((p[0]-1, p[1], p[2]-1), 1) in found or \
- ((p[0]+1, p[1]+1, p[2]-1), 1) in found or \
- ((p[0]-1, p[1]+1, p[2]-1), 1) in found or \
- ((p[0]+1, p[1]-1, p[2]-1), 1) in found or \
- ((p[0]-1, p[1]-1, p[2]-1), 1) in found \
- ):
+ if (((p[0], p[1]+1, p[2]-1), 1) in found
+ or ((p[0], p[1]-1, p[2]-1), 1) in found
+ or ((p[0]+1, p[1], p[2]-1), 1) in found
+ or ((p[0]-1, p[1], p[2]-1), 1) in found
+ or ((p[0]+1, p[1]+1, p[2]-1), 1) in found
+ or ((p[0]-1, p[1]+1, p[2]-1), 1) in found
+ or ((p[0]+1, p[1]-1, p[2]-1), 1) in found
+ or ((p[0]-1, p[1]-1, p[2]-1), 1) in found):
#: Delete nearly circle
verify = -1
diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py
index de51a09f3..ab9f54068 100644
--- a/module/plugins/captcha/LinksaveIn.py
+++ b/module/plugins/captcha/LinksaveIn.py
@@ -81,7 +81,7 @@ class LinksaveIn(OCR):
cstat[rgb_c] += 1
except Exception:
cstat[rgb_c] = 1
- if rgb_bg == rgb_c:
+ if rgb_bg is rgb_c:
stat[bgpath] += 1
max_p = 0
bg = ""
@@ -111,7 +111,7 @@ class LinksaveIn(OCR):
for y in xrange(bg.size[1]):
rgb_bg = bglut[bgpix[x, y]]
rgb_c = lut[pix[x, y]]
- if rgb_c == rgb_bg:
+ if rgb_c is rgb_bg:
orgpix[x, y] = (255, 255, 255)
diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py
index f7bea666b..f235a9406 100644
--- a/module/plugins/crypter/LinkCryptWs.py
+++ b/module/plugins/crypter/LinkCryptWs.py
@@ -174,10 +174,10 @@ class LinkCryptWs(Crypter):
def handle_link_source(self, type):
- if type == 'cnl':
+ if type == "cnl":
return self.handle_CNL2()
- elif type == 'web':
+ elif type == "web":
return self.handle_web_links()
elif type in ('rsdf', 'ccf', 'dlc'):
diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py
index 37e6a26af..4e419a9c9 100644
--- a/module/plugins/crypter/NCryptIn.py
+++ b/module/plugins/crypter/NCryptIn.py
@@ -196,9 +196,9 @@ class NCryptIn(Crypter):
return []
#: Select suitable handler
- if link_source_type == 'single':
+ if link_source_type == "single":
return self.handle_single_link()
- if link_source_type == 'cnl2':
+ if link_source_type == "cnl2":
return self.handle_CNL2()
elif link_source_type in ("rsdf", "ccf", "dlc"):
return self.handle_container(link_source_type)
diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py
index fc8938b2e..d2f0a278b 100644
--- a/module/plugins/crypter/RelinkUs.py
+++ b/module/plugins/crypter/RelinkUs.py
@@ -185,11 +185,11 @@ class RelinkUs(Crypter):
def handle_link_source(self, source):
- if source == 'cnl2':
+ if source == "cnl2":
return self.handle_CNL2Links()
- elif source == 'dlc':
+ elif source == "dlc":
return self.handle_DLC_links()
- elif source == 'web':
+ elif source == "web":
return self.handle_WEB_links()
else:
self.error(_('Unknown source type "%s"') % source)
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)
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py
index 538e5ded2..dd7490365 100644
--- a/module/plugins/hoster/BasePlugin.py
+++ b/module/plugins/hoster/BasePlugin.py
@@ -60,7 +60,7 @@ class BasePlugin(Hoster):
self.fail(_("File not found"))
except BadHeader, e:
- if e.code is 404:
+ if e.code == 404:
self.offline()
elif e.code in (401, 403):
diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py
index 753494c53..d90fc5864 100644
--- a/module/plugins/hoster/DateiTo.py
+++ b/module/plugins/hoster/DateiTo.py
@@ -41,10 +41,10 @@ class DateiTo(SimpleHoster):
self.check_errors()
if url.endswith('download.php') and 'P' in data:
- if data['P'] == 'I':
+ if data['P'] == "I":
self.do_wait()
- elif data['P'] == 'IV':
+ elif data['P'] == "IV":
break
m = re.search(self.DATA_PATTERN, self.html)
diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py
index e8df5e3f0..f9d427c1b 100644
--- a/module/plugins/hoster/DlFreeFr.py
+++ b/module/plugins/hoster/DlFreeFr.py
@@ -124,7 +124,7 @@ class DlFreeFr(SimpleHoster):
value = value.strip()
if key in header:
- if type(header[key]) == list:
+ if type(header[key]) is list:
header[key].append(value)
else:
header[key] = [header[key], value]
diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py
index 9de7c9c06..7d828f706 100644
--- a/module/plugins/hoster/FilecloudIo.py
+++ b/module/plugins/hoster/FilecloudIo.py
@@ -30,7 +30,7 @@ class FilecloudIo(SimpleHoster):
TEMP_OFFLINE_PATTERN = r'l10n\.FILES__WARNING'
UKEY_PATTERN = r'\'ukey\'\s*:\'(\w+)'
- AB1_PATTERN = r'if\( __ab1 == \'(\w+)\' \)'
+ AB1_PATTERN = r'if\( __ab1 is \'(\w+)\' \)'
ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);'
@@ -118,7 +118,7 @@ class FilecloudIo(SimpleHoster):
post={'akey': akey, 'ukey': ukey})
self.log_debug("FetchDownloadUrl: " + rep)
rep = json_loads(rep)
- if rep['status'] == 'ok':
+ if rep['status'] == "ok":
self.link = rep['download_url']
else:
self.fail(rep['message'])
diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py
index 49837ec28..d8c626ef2 100644
--- a/module/plugins/hoster/FilepostCom.py
+++ b/module/plugins/hoster/FilepostCom.py
@@ -100,7 +100,7 @@ class FilepostCom(SimpleHoster):
#: See the two lines commented out with "# ~?".
if 'error' in res['js']:
- if res['js']['error'] == 'download_delay':
+ if res['js']['error'] == "download_delay":
self.retry(wait_time=res['js']['params']['next_download'])
#: ~? self.retry(wait_time=js_answer['params']['next_download'])
diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py
index b3dbcbeb4..a6dd56152 100644
--- a/module/plugins/hoster/FilesMailRu.py
+++ b/module/plugins/hoster/FilesMailRu.py
@@ -99,7 +99,7 @@ class FilesMailRu(Hoster):
#: then the download will be restarted. It's only bad for these
#: who want download a HTML-File (it's one in a million ;-) )
#
- #: The maximum UploadSize allowed on files.mail.ru at the moment is 100MB
+ #: The maximum UploadSize allowed on files.mail.ru at the moment == 100MB
#: so i set it to check every download because sometimes there are downloads
#: that contain the HTML-Text and 60MB ZEROs after that in a xyzfile.part1.rar file
#: (Loading 100MB in to ram is not an option)
diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py
index 72274ba40..ca2f7f270 100644
--- a/module/plugins/hoster/FlyFilesNet.py
+++ b/module/plugins/hoster/FlyFilesNet.py
@@ -35,7 +35,7 @@ class FlyFilesNet(SimpleHoster):
parsed_url = self.load(url, post={'getDownLink': session})
self.log_debug("Parsed URL: %s" % parsed_url)
- if parsed_url == '#downlink|' or parsed_url == "#downlink|#":
+ if parsed_url == "#downlink|" or parsed_url == "#downlink|#":
self.log_warning(_("Could not get the download URL. Please wait 10 minutes"))
self.wait(10 * 60, True)
self.retry()
diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py
index b08fd515f..03314548c 100644
--- a/module/plugins/hoster/LetitbitNet.py
+++ b/module/plugins/hoster/LetitbitNet.py
@@ -25,7 +25,7 @@ def api_response(url):
def get_info(urls):
for url in urls:
api_rep = api_response(url)
- if api_rep['status'] == 'OK':
+ if api_rep['status'] == "OK":
info = api_rep['data'][0]
yield (info['name'], info['size'], 2, url)
else:
@@ -131,7 +131,7 @@ class LetitbitNet(SimpleHoster):
self.log_debug("API Data: " + api_rep)
api_rep = json_loads(api_rep)
- if api_rep['status'] == 'FAIL':
+ if api_rep['status'] == "FAIL":
self.fail(api_rep['data'])
self.link = api_rep['data'][0][0]
diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py
index 8bec3b37e..e4902f2fc 100644
--- a/module/plugins/hoster/MegaCoNz.py
+++ b/module/plugins/hoster/MegaCoNz.py
@@ -163,7 +163,7 @@ class MegaCoNz(Hoster):
f.close()
df.close()
- # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac:
+ # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] not is meta_mac:
# os.remove(file_decrypted)
# self.fail(_("Checksum mismatch"))
diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py
index dcb9ecceb..bade22519 100644
--- a/module/plugins/hoster/PremiumTo.py
+++ b/module/plugins/hoster/PremiumTo.py
@@ -42,7 +42,7 @@ class PremiumTo(MultiHoster):
self.retry(60, 5 * 60, "No premium account available")
err = ""
- if self.req.http.code == '420':
+ if self.req.http.code == "420":
#: Custom error code send - fail
file = fs_encode(self.last_download)
with open(file, "rb") as f:
diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py
index cb3d34027..4311a82aa 100644
--- a/module/plugins/hoster/QuickshareCz.py
+++ b/module/plugins/hoster/QuickshareCz.py
@@ -37,7 +37,7 @@ class QuickshareCz(SimpleHoster):
#: Determine download type - free or premium
if self.premium:
if 'UU_prihlasen' in self.jsvars:
- if self.jsvars['UU_prihlasen'] == '0':
+ if self.jsvars['UU_prihlasen'] == "0":
self.log_warning(_("User not logged in"))
self.relogin(self.user)
self.retry()
@@ -75,9 +75,9 @@ class QuickshareCz(SimpleHoster):
#: Check errors
m = re.search(r'/chyba/(\d+)', self.link)
if m:
- if m.group(1) == '1':
+ if m.group(1) == "1":
self.retry(60, 2 * 60, "This IP is already downloading")
- elif m.group(1) == '2':
+ elif m.group(1) == "2":
self.retry(60, 60, "No free slots available")
else:
self.fail(_("Error %d") % m.group(1))
diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py
index d8cdd59e9..c7c90d01c 100644
--- a/module/plugins/hoster/RPNetBiz.py
+++ b/module/plugins/hoster/RPNetBiz.py
@@ -56,7 +56,7 @@ class RPNetBiz(MultiHoster):
self.log_debug("JSON data hdd query: %s" % res)
download_status = json_loads(res)['download']
- if download_status['status'] == '100':
+ if download_status['status'] == "100":
link_status['generated'] = download_status['rpnet_link']
self.log_debug("Successfully downloaded to rpnet HDD: %s" % link_status['generated'])
break
diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py
index 8767e23b9..267f41f36 100644
--- a/module/plugins/hoster/RapiduNet.py
+++ b/module/plugins/hoster/RapiduNet.py
@@ -46,7 +46,7 @@ class RapiduNet(SimpleHoster):
get={'a': "getLoadTimeToDownload"},
post={'_go': ""})
- if str(jsvars['timeToDownload']) is "stop":
+ if str(jsvars['timeToDownload']) == "stop":
t = (24 * 60 * 60) - (int(time.time()) % (24 * 60 * 60)) + time.altzone
self.log_info(_("You've reach your daily download transfer"))
@@ -66,7 +66,7 @@ class RapiduNet(SimpleHoster):
'captcha2': response,
'fileId' : self.info['pattern']['ID']})
- if jsvars['message'] == 'success':
+ if jsvars['message'] == "success":
self.link = jsvars['url']
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index c16604ab0..bdbaa1e6f 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -79,7 +79,7 @@ class ShareonlineBiz(SimpleHoster):
post={'dl_free' : "1",
'recaptcha_challenge_field': challenge,
'recaptcha_response_field' : response})
- if not res == '0':
+ if not res == "0":
self.captcha.correct()
return res
else:
@@ -163,7 +163,7 @@ class ShareonlineBiz(SimpleHoster):
except Exception:
self.log_error(_("Unknown error occurred"), errmsg)
- if errmsg is "invalid":
+ if errmsg == "invalid":
self.fail(_("File not available"))
elif errmsg in ("full", "freelimit", "size", "proxy"):
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index 2b1304470..25b8d90c4 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -73,7 +73,7 @@ class TurbobitNet(SimpleHoster):
self.error(_("Captcha form not found"))
self.log_debug(inputs)
- if inputs['captcha_type'] == 'recaptcha':
+ if inputs['captcha_type'] == "recaptcha":
recaptcha = ReCaptcha(self)
inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge()
else:
@@ -98,7 +98,7 @@ class TurbobitNet(SimpleHoster):
def get_rt_update(self):
rtUpdate = self.retrieve("rtUpdate")
if not rtUpdate:
- if self.retrieve("version") != self.__version__ \
+ if self.retrieve("version") not is self.__version__ \
or int(self.retrieve("timestamp", 0)) + 86400000 < timestamp():
#: that's right, we are even using jdownloader updates
rtUpdate = self.load("http://update0.jdownloader.org/pluginstuff/tbupdate.js")
diff --git a/module/plugins/hoster/TusfilesNet.py b/module/plugins/hoster/TusfilesNet.py
index 2bac6b69f..8fadb41c3 100644
--- a/module/plugins/hoster/TusfilesNet.py
+++ b/module/plugins/hoster/TusfilesNet.py
@@ -33,7 +33,7 @@ class TusfilesNet(XFSHoster):
return super(TusfilesNet, self).download(url, *args, **kwargs)
except BadHeader, e:
- if e.code is 503:
+ if e.code == 503:
self.multiDL = False
raise Retry("503")
diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py
index 1410a7e59..3ea53e719 100644
--- a/module/plugins/hoster/UnibytesCom.py
+++ b/module/plugins/hoster/UnibytesCom.py
@@ -48,7 +48,7 @@ class UnibytesCom(SimpleHoster):
self.wait(10 * 60, True)
self.retry()
- if post_data['step'] == 'last':
+ if post_data['step'] == "last"':
m = re.search(self.LINK_FREE_PATTERN, self.html)
if m:
self.link = m.group(1)
@@ -60,7 +60,7 @@ class UnibytesCom(SimpleHoster):
last_step = post_data['step']
action, post_data = self.parse_html_form('id="stepForm"')
- if last_step == 'timer':
+ if last_step == "timer":
m = re.search(self.WAIT_PATTERN, self.html)
self.wait(m.group(1) if m else 60, False)
diff --git a/module/plugins/hoster/VkCom.py b/module/plugins/hoster/VkCom.py
index b720344e1..d0b0b780e 100644
--- a/module/plugins/hoster/VkCom.py
+++ b/module/plugins/hoster/VkCom.py
@@ -29,7 +29,7 @@ class VkCom(SimpleHoster):
def handle_free(self, pyfile):
- self.link = re.findall(self.LINK_FREE_PATTERN, self.html)[0 if self.get_config('quality') is "Low" else -1]
+ self.link = re.findall(self.LINK_FREE_PATTERN, self.html)[0 if self.get_config('quality') == "Low" else -1]
getInfo = create_getInfo(VkCom)
diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py
index 268c7e800..8df1a441f 100644
--- a/module/plugins/hoster/XHamsterCom.py
+++ b/module/plugins/hoster/XHamsterCom.py
@@ -88,7 +88,7 @@ class XHamsterCom(Hoster):
else:
self.error(_("file_url not found"))
- if url_mode == '3':
+ if url_mode == "3":
long_url = file_url
self.log_debug("long_url = " + long_url)
else:
diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py
index 84401498e..9fa64ff0c 100644
--- a/module/plugins/hoster/Xdcc.py
+++ b/module/plugins/hoster/Xdcc.py
@@ -150,7 +150,7 @@ class Xdcc(Hoster):
'text': msg[3][1:]
}
- if nick == msg['target'][0:len(nick)] and "PRIVMSG" == msg['action']:
+ if nick is msg['target'][0:len(nick)] and "PRIVMSG" is msg['action']:
if msg['text'] == "\x01VERSION\x01":
self.log_debug("Sending CTCP VERSION")
sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface"))
@@ -160,8 +160,8 @@ class Xdcc(Hoster):
elif msg['text'] == "\x01LAG\x01":
pass #: don't know how to answer
- if not (bot == msg['origin'][0:len(bot)]
- and nick == msg['target'][0:len(nick)]
+ if not (bot is msg['origin'][0:len(bot)]
+ and nick is msg['target'][0:len(nick)]
and msg['action'] in ("PRIVMSG", "NOTICE")):
continue
@@ -195,7 +195,7 @@ class Xdcc(Hoster):
self.pyfile.setStatus("downloading")
newname = self.req.download(ip, port, filename, sock, self.pyfile.setProgress)
- if newname and newname != filename:
+ if newname and newname not is filename:
self.log_info(_("%(name)s saved as %(newname)s") % {'name': self.pyfile.name, 'newname': newname})
filename = newname
diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py
index 46ea673d5..e0e90a311 100644
--- a/module/plugins/hoster/YibaishiwuCom.py
+++ b/module/plugins/hoster/YibaishiwuCom.py
@@ -35,7 +35,7 @@ class YibaishiwuCom(SimpleHoster):
url = m.group(1)
- self.log_debug(('FREEUSER' if m.group(2) == 'download' else 'GUEST') + ' URL', url)
+ self.log_debug(('FREEUSER' if m.group(2) == "download" else 'GUEST') + ' URL', url)
res = json_loads(self.load(urlparse.urljoin("http://115.com", url), decode=False))
if "urls" in res:
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
index 5dfeb8ac7..865eeef2e 100644
--- a/module/plugins/hoster/YoutubeCom.py
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -131,7 +131,7 @@ class YoutubeCom(Hoster):
if not streams:
self.fail(_("No available stream meets your preferences"))
- fmt_dict = dict([x for x in streams if self.formats[x[0]][4] == use3d] or streams)
+ fmt_dict = dict([x for x in streams if self.formats[x[0]][4] is use3d] or streams)
self.log_debug("DESIRED STREAM: ITAG:%d (%s) %sfound, %sallowed" %
(desired_fmt, "%s %dx%d Q:%d 3D:%s" % self.formats[desired_fmt],
diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index f75068e58..e48627618 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -54,7 +54,7 @@ class ZippyshareCom(SimpleHoster):
else:
self.link = self.get_link()
- if self.link and pyfile.name == 'file.html':
+ if self.link and pyfile.name == "file.html":
pyfile.name = urllib.unquote(self.link.split('/')[-1])
@@ -73,7 +73,7 @@ class ZippyshareCom(SimpleHoster):
varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr))
realid = id.strip('"\'')
- if id != realid: #: Id is not a variable, so look for realid.attr in the html
+ if id not is realid: #: Id is not a variable, so look for realid.attr in the html
initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)])
initValue = '"%s"' % initValues[-1] if initValues else 'null'
initScripts.add('%s = %s;' % (varName, initValue))
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index 158a5c7bc..eaf988974 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -126,7 +126,7 @@ class Account(Plugin):
if options:
before = self.accounts[user]['options']
self.accounts[user]['options'].update(options)
- return self.accounts[user]['options'] != before
+ return self.accounts[user]['options'] not is before
else:
self.accounts[user] = {'password': password, 'options': options, 'valid': True}
self._login(user, self.accounts[user])
@@ -279,7 +279,7 @@ class Account(Plugin):
if self.infos[user]['validuntil'] > 0 and time.time() > self.infos[user]['validuntil']:
continue
if "trafficleft" in self.infos[user]:
- if self.infos[user]['trafficleft'] is 0:
+ if self.infos[user]['trafficleft'] == 0:
continue
usable.append((user, data))
@@ -291,7 +291,7 @@ class Account(Plugin):
def can_use(self):
- return self.select_account() != (None, None)
+ return self.select_account() not is (None, None)
def parse_traffic(self, value, unit=None): #: Return kilobytes
diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py
index 715791949..9b09fc9c1 100644
--- a/module/plugins/internal/Crypter.py
+++ b/module/plugins/internal/Crypter.py
@@ -91,7 +91,7 @@ class Crypter(Hoster):
setFolder(package_folder)
self.log_debug("Set package %(name)s folder to: %(folder)s" % {'name': name, 'folder': folder})
- elif not folder_per_package or name != folder:
+ elif not folder_per_package or name not is folder:
if not folder:
folder = urlparse.urlparse(name).path.split("/")[-1]
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index 1cc127522..dbc5e88a8 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -408,7 +408,7 @@ class Hoster(Plugin):
if newname:
newname = urlparse.urlparse(newname).path.split('/')[-1]
- if disposition and newname != name:
+ if disposition and newname not is name:
self.log_info(_("%(name)s saved as %(newname)s") % {'name': name, 'newname': newname})
self.pyfile.name = newname
filename = os.path.join(location, newname)
@@ -550,7 +550,7 @@ class Hoster(Plugin):
baseurl = "%s://%s" % (url_p.scheme, url_p.netloc)
location = urlparse.urljoin(baseurl, location)
- if 'code' in header and header['code'] is 302:
+ if 'code' in header and header['code'] == 302:
link = location
if follow_location:
@@ -597,7 +597,7 @@ class Hoster(Plugin):
if traffic is None:
return False
- elif traffic is -1:
+ elif traffic == -1:
return True
else:
size = self.pyfile.size / 1024
diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py
index 32d83e1ca..0fa75df98 100644
--- a/module/plugins/internal/MultiHook.py
+++ b/module/plugins/internal/MultiHook.py
@@ -119,7 +119,7 @@ class MultiHook(Hook):
pluginlist = self.get_config('pluginlist', '').replace('|', ',').replace(';', ',').split(',')
configset = self._plugin_set(pluginlist)
- if configmode is "listed":
+ if configmode == "listed":
pluginset &= configset
else:
pluginset -= configset
@@ -186,7 +186,7 @@ class MultiHook(Hook):
def override_plugins(self):
excludedList = []
- if self.plugintype is "hoster":
+ if self.plugintype == "hoster":
pluginMap = dict((name.lower(), name) for name in self.pyload.pluginManager.hosterPlugins.iterkeys())
accountList = [account.type.lower() for account in self.pyload.api.getAccounts(False) if account.valid and account.premium]
else:
diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py
index 064bf1d7d..36d259e0c 100644
--- a/module/plugins/internal/OCR.py
+++ b/module/plugins/internal/OCR.py
@@ -88,7 +88,7 @@ class OCR(Plugin):
self.pyload.log_debug("Saving tiff...")
self.image.save(tmpTif.name, 'TIFF')
- if os.name is "nt":
+ if os.name == "nt":
tessparams = [os.path.join(pypath, "tesseract", "tesseract.exe")]
else:
tessparams = ["tesseract"]
@@ -165,7 +165,7 @@ class OCR(Plugin):
for x in xrange(w):
for y in xrange(h):
- if pixels[x, y] is 255:
+ if pixels[x, y] == 255:
continue
#: No point in processing white pixels since we only want to remove black pixel
count = 0
@@ -198,7 +198,7 @@ class OCR(Plugin):
#: Second pass: this time set all 1's to 255 (white)
for x in xrange(w):
for y in xrange(h):
- if pixels[x, y] is 1:
+ if pixels[x, y] == 1:
pixels[x, y] = 255
self.pixels = pixels
@@ -213,7 +213,7 @@ class OCR(Plugin):
for x in xrange(w):
for y in xrange(h):
- if pixels[x, y] is 0:
+ if pixels[x, y] == 0:
pixels[x, y] = 155
highest = {}
@@ -229,7 +229,7 @@ class OCR(Plugin):
for x in xrange(w):
for y in xrange(h):
- if pixels[x, y] is 0:
+ if pixels[x, y] == 0:
pixels[x, y] = 255
count = {}
@@ -237,7 +237,7 @@ class OCR(Plugin):
for x in xrange(w):
count[x] = 0
for y in xrange(h):
- if pixels[x, y] is 155:
+ if pixels[x, y] == 155:
count[x] += 1
sum = 0
@@ -270,10 +270,10 @@ class OCR(Plugin):
for x in xrange(w):
for y in xrange(h):
- if pixels[x, y] is 0:
+ if pixels[x, y] == 0:
pixels[x, y] = 255
- if pixels[x, y] is 155:
+ if pixels[x, y] == 155:
pixels[x, y] = 0
self.pixels = pixels
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index e70c099b1..9ac89501c 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -42,7 +42,7 @@ def timestamp():
def seconds_to_midnight(gmt=0):
now = datetime.datetime.utcnow() + datetime.timedelta(hours=gmt)
- if now.hour is 0 and now.minute < 10:
+ if now.hour == 0 and now.minute < 10:
midnight = now
else:
midnight = now + datetime.timedelta(days=1)
@@ -66,7 +66,7 @@ def replace_patterns(string, ruleslist):
def set_cookies(cj, cookies):
for cookie in cookies:
- if isinstance(cookie, tuple) and len(cookie) is 3:
+ if isinstance(cookie, tuple) and len(cookie) == 3:
domain, name, value = cookie
cj.setCookie(domain, name, value)
diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py
index dde12d17e..a5ccf2a26 100644
--- a/module/plugins/internal/SevenZip.py
+++ b/module/plugins/internal/SevenZip.py
@@ -40,7 +40,7 @@ class SevenZip(UnRar):
@classmethod
def find(cls):
try:
- if os.name is "nt":
+ if os.name == "nt":
cls.CMD = os.path.join(pypath, "7z.exe")
p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index dd3b97e91..7fa399276 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -132,7 +132,7 @@ class SimpleCrypter(Crypter, SimpleHoster):
try:
url = self.info['url'].strip()
name = self.info['name'].strip()
- if name and name != url:
+ if name and name not is url:
self.pyfile.name = name
except Exception:
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 2a5263449..f86e6fbe0 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -121,7 +121,7 @@ class SimpleHoster(Hoster):
@classmethod
def get_info(cls, url="", html=""):
info = cls.api_info(url)
- online = True if info['status'] is 2 else False
+ online = True if info['status'] == 2 else False
try:
info['pattern'] = re.match(cls.__pattern__, url).groupdict() #: Pattern groups will be saved here
@@ -134,17 +134,17 @@ class SimpleHoster(Hoster):
info['error'] = "missing url"
info['status'] = 1
- elif info['status'] is 3:
+ elif info['status'] == 3:
try:
html = get_url(url, cookies=cls.COOKIES, decode=cls.TEXT_ENCODING)
except BadHeader, e:
info['error'] = "%d: %s" % (e.code, e.content)
- if e.code is 404:
+ if e.code == 404:
info['status'] = 1
- elif e.code is 503:
+ elif e.code == 503:
info['status'] = 6
except Exception:
@@ -232,7 +232,7 @@ class SimpleHoster(Hoster):
self.LINK_PREMIUM_PATTERN = self.LINK_PATTERN
if (self.MULTI_HOSTER
- and (self.__pattern__ != self.pyload.pluginManager.hosterPlugins[self.__name__]['pattern']
+ and (self.__pattern__ not is self.pyload.pluginManager.hosterPlugins[self.__name__]['pattern']
or re.match(self.__pattern__, self.pyfile.url) is None)):
self.multihost = True
return
@@ -448,13 +448,13 @@ class SimpleHoster(Hoster):
try:
status = self.info['status']
- if status is 1:
+ if status == 1:
self.offline()
- elif status is 6:
+ elif status == 6:
self.temp_offline()
- elif status is 8:
+ elif status == 8:
self.fail(self.info['error'] if 'error' in self.info else _("Failed"))
finally:
@@ -471,7 +471,7 @@ class SimpleHoster(Hoster):
try:
url = self.info['url'].strip()
name = self.info['name'].strip()
- if name and name != url:
+ if name and name not is url:
self.pyfile.name = name
except Exception:
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index 90b6431ab..a2c2070b8 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -51,7 +51,7 @@ class UnRar(Extractor):
@classmethod
def find(cls):
try:
- if os.name is "nt":
+ if os.name == "nt":
cls.CMD = os.path.join(pypath, "RAR.exe")
else:
cls.CMD = "rar"
@@ -63,7 +63,7 @@ class UnRar(Extractor):
except OSError:
try:
- if os.name is "nt":
+ if os.name == "nt":
cls.CMD = os.path.join(pypath, "UnRAR.exe")
else:
cls.CMD = "unrar"
@@ -134,7 +134,7 @@ class UnRar(Extractor):
if not c:
break
#: Reading a percentage sign -> set progress and restart
- if c is '%':
+ if c == "%":
self.notify_progress(int(s))
s = ""
#: Not reading a digit -> therefore restart
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index 48772a817..6508b9bd3 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -152,7 +152,7 @@ class XFSHoster(SimpleHoster):
stmsg = inputs['st']
- if stmsg is 'OK':
+ if stmsg == 'OK':
self.html = self.load(action, post=inputs)
elif 'Can not leech file' in stmsg: