diff options
author | Nitzo <nitzo2001@yahoo.com> | 2016-01-02 00:37:43 +0100 |
---|---|---|
committer | Nitzo <nitzo2001@yahoo.com> | 2016-01-02 00:37:43 +0100 |
commit | 7ab16b360739c4754c954ceb54b226ab0a30c215 (patch) | |
tree | c7d522cfe574f43ebb862d51f3693cd974cde04f /module | |
parent | [ExternalScripts] fix #2251 + much more (diff) | |
download | pyload-7ab16b360739c4754c954ceb54b226ab0a30c215.tar.xz |
"is" is evil
Diffstat (limited to 'module')
42 files changed, 169 insertions, 169 deletions
diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 65167e176..3e3d3c51e 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -7,7 +7,7 @@ from module.plugins.internal.misc import json, set_cookie class FilecloudIo(Account): __name__ = "FilecloudIo" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __description__ = """FilecloudIo account plugin""" @@ -36,7 +36,7 @@ class FilecloudIo(Account): post={'akey': akey}) rep = json.loads(rep) - if rep['is_premium'] is 1: + if rep['is_premium'] == 1: return {'validuntil': float(rep['premium_until']), 'trafficleft': -1} else: return {'premium': False} diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index cb3342e49..f6e9ed129 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -40,7 +40,7 @@ class OboomCom(Account): 'pass': pbkdf2}) result = json.loads(html) - if result[0] is not 200: + if result[0] != 200: self.log_warning(_("Failed to log in: %s") % result[1]) self.fail_login() diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py index 0155d4efc..ae5476f87 100644 --- a/module/plugins/accounts/OverLoadMe.py +++ b/module/plugins/accounts/OverLoadMe.py @@ -7,7 +7,7 @@ from module.plugins.internal.misc import json class OverLoadMe(MultiAccount): __name__ = "OverLoadMe" __type__ = "account" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -47,5 +47,5 @@ class OverLoadMe(MultiAccount): data = json.loads(html) - if data['err'] is 1: + if data['err'] == 1: self.fail_login() diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index 66ecfb214..2774f267b 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -7,7 +7,7 @@ from module.plugins.internal.misc import json class PremiumizeMe(MultiAccount): __name__ = "PremiumizeMe" __type__ = "account" - __version__ = "0.23" + __version__ = "0.24" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -29,7 +29,7 @@ class PremiumizeMe(MultiAccount): data = json.loads(answer) #: If account is not valid thera are no hosters available - if data['status'] is not 200: + if data['status'] != 200: return [] #: Extract hosters from json file @@ -56,7 +56,7 @@ class PremiumizeMe(MultiAccount): status = self.get_account_status(user, password) #: Check if user and password are valid - if status['status'] is not 200: + if status['status'] != 200: self.fail_login() diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index 3057fb34c..3fb2cf928 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -36,7 +36,7 @@ class RapidgatorNet(Account): json_data = json.loads(html) - if json_data['response_status'] is 200: + if json_data['response_status'] == 200: if "reset_in" in json_data['response']: self._schedule_refresh(user, json_data['response']['reset_in']) @@ -65,7 +65,7 @@ class RapidgatorNet(Account): json_data = json.loads(html) - if json_data['response_status'] is 200: + if json_data['response_status'] == 200: data['sid'] = str(json_data['response']['session_id']) return else: diff --git a/module/plugins/captcha/CircleCaptcha.py b/module/plugins/captcha/CircleCaptcha.py index 482779321..e76cdc756 100644 --- a/module/plugins/captcha/CircleCaptcha.py +++ b/module/plugins/captcha/CircleCaptcha.py @@ -31,7 +31,7 @@ class ImageSequence: class CircleCaptcha(OCR): __name__ = "CircleCaptcha" __type__ = "ocr" - __version__ = "1.06" + __version__ = "1.07" __status__ = "testing" __description__ = """Circle captcha ocr plugin""" @@ -71,7 +71,7 @@ class CircleCaptcha(OCR): curcolor = curpix # self.log_debug(x, y, jump, 2) else: - if howmany is 0: + if howmany == 0: #: Found pixel jump = True howmany = howmany + 1 @@ -79,7 +79,7 @@ class CircleCaptcha(OCR): # self.log_debug(x, y, jump, 2) else: howmany = howmany + 1 - if howmany is 1: + if howmany == 1: #: Clean pixel pix[x-1, y] = self.BACKGROUND @@ -102,7 +102,7 @@ class CircleCaptcha(OCR): curcolor = curpix # self.log_debug(x, y, jump) else: - if howmany is 0: + if howmany == 0: #: Found pixel jump = True howmany = howmany + 1 @@ -110,7 +110,7 @@ class CircleCaptcha(OCR): # self.log_debug(x, y, jump) else: howmany = howmany + 1 - if howmany is 1: + if howmany == 1: #: Clean pixel pix[x-1, y] = self.BACKGROUND @@ -277,19 +277,19 @@ class CircleCaptcha(OCR): return -2 cardinalpoints = 0 - if self.verify_point(im, pix, c[0] + c[2], c[1], True) is 1: + if self.verify_point(im, pix, c[0] + c[2], c[1], True) == 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0] + c[2], c[1], False) == -1: return -2 - if self.verify_point(im, pix, c[0] - c[2], c[1], True) is 1: + if self.verify_point(im, pix, c[0] - c[2], c[1], True) == 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0] - c[2], c[1], False) == -1: return -2 - if self.verify_point(im, pix, c[0], c[1] + c[2], True) is 1: + if self.verify_point(im, pix, c[0], c[1] + c[2], True) == 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0], c[1] + c[2], False) == -1: return -2 - if self.verify_point(im, pix, c[0], c[1] - c[2], True) is 1: + if self.verify_point(im, pix, c[0], c[1] - c[2], True) == 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0], c[1] - c[2], False) == -1: return -2 @@ -302,7 +302,7 @@ class CircleCaptcha(OCR): y2= int(round(c[1]+ math.sqrt(c[2]**2-(c[0]-x)**2))) howmany = howmany + 2 - if self.verify_point(im, pix, x, y, exactfind) is 0: + if self.verify_point(im, pix, x, y, exactfind) == 0: missing = missing + 1 missinglist.append((x, y)) else: @@ -311,7 +311,7 @@ class CircleCaptcha(OCR): if self.verify_point(im, pix, x, y, False) == -1: return -2 - if self.verify_point(im, pix, x, y2, exactfind) is 0: + if self.verify_point(im, pix, x, y2, exactfind) == 0: missing = missing + 1 missinglist.append((x, y2)) else: @@ -363,19 +363,19 @@ class CircleCaptcha(OCR): return -2 cardinalpoints = 0 - if self.verify_point(im, pix, c[0] + c[2], c[1], True) is 1: + if self.verify_point(im, pix, c[0] + c[2], c[1], True) == 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0] + c[2], c[1], False) == -1: return -2 - if self.verify_point(im, pix, c[0] - c[2], c[1], True) is 1: + if self.verify_point(im, pix, c[0] - c[2], c[1], True) == 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0] - c[2], c[1], False) == -1: return -2 - if self.verify_point(im, pix, c[0], c[1] + c[2], True) is 1: + if self.verify_point(im, pix, c[0], c[1] + c[2], True) == 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0], c[1] + c[2], False) == -1: return -2 - if self.verify_point(im, pix, c[0], c[1] - c[2], True) is 1: + if self.verify_point(im, pix, c[0], c[1] - c[2], True) == 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0], c[1] - c[2], False) == -1: return -2 @@ -388,7 +388,7 @@ class CircleCaptcha(OCR): y2= int(round(c[1]+ math.sqrt(c[2]**2-(c[0]-x)**2))) howmany = howmany + 2 - if self.verify_point(im, pix, x, y, exactfind) is 0: + if self.verify_point(im, pix, x, y, exactfind) == 0: missing = missing + 1 missinglist.append((x, y)) else: @@ -397,7 +397,7 @@ class CircleCaptcha(OCR): if self.verify_point(im, pix, x, y, False) == -1: return -2 - if self.verify_point(im, pix, x, y2, exactfind) is 0: + if self.verify_point(im, pix, x, y2, exactfind) == 0: missing = missing + 1 missinglist.append((x, y2)) else: @@ -412,7 +412,7 @@ class CircleCaptcha(OCR): x2= int(round(c[0]+ math.sqrt(c[2]**2-(c[1]-y)**2))) howmany = howmany + 2 - if self.verify_point(im, pix, x, y, exactfind) is 0: + if self.verify_point(im, pix, x, y, exactfind) == 0: missing = missing + 1 missinglist.append((x, y)) else: @@ -421,7 +421,7 @@ class CircleCaptcha(OCR): if self.verify_point(im, pix, x, y, False) == -1: return -2 - if self.verify_point(im, pix, x2, y, exactfind) is 0: + if self.verify_point(im, pix, x2, y, exactfind) == 0: missing = missing + 1 missinglist.append((x2, y)) else: @@ -432,19 +432,19 @@ class CircleCaptcha(OCR): for p in missinglist: #: Left and bottom - if (self.verify_point(im, pix, p[0]-1, p[1], exactfind) is 1 - and self.verify_point(im, pix, p[0], p[1]+1, exactfind) is 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) is 1 - and self.verify_point(im, pix, p[0], p[1]-1, exactfind) is 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) is 1 - and self.verify_point(im, pix, p[0], p[1]+1, exactfind) is 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) is 1 - and self.verify_point(im, pix, p[0], p[1]-1, exactfind) is 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 @@ -455,7 +455,7 @@ class CircleCaptcha(OCR): 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) is 1): + or self.verify_point(im, pix, p[0], p[1], False) == 1): missingconsecutive = missingconsecutive + 1 # else: # pix[p[0], p[1]] = 0 @@ -501,7 +501,7 @@ class CircleCaptcha(OCR): howmany < 80: return -1 # elif missing / howmany < 0.10: - elif missing is 0: + elif missing == 0: self.pointsofcirclefound.extend(pointsofcircle) return 1 elif (missing - missingconsecutive) / howmany < 0.20: @@ -641,7 +641,7 @@ class CircleCaptcha(OCR): x3 = math.floor(x2 - ((x2 - x1) / 2)) y3 = y1 for j in xrange(1, 50): - retval = self.find_last_pixel_y(im, pix, x3, y3, True if invert is 1 else False, -1, True) + retval = self.find_last_pixel_y(im, pix, x3, y3, True if invert == 1 else False, -1, True) # self.log_debug(x3, y3, retval[0], invert) y3 = retval[0] if y3 == -2: @@ -675,10 +675,10 @@ class CircleCaptcha(OCR): if verified == -1: verified = -1 - elif verified is 0: + elif verified == 0: found.add(((c[0], c[1], c[2]), verified)) findnewcircle = True - elif verified is 1: + elif verified == 1: found.add(((c[0], c[1], c[2]), verified)) findnewcircle = True @@ -688,11 +688,11 @@ class CircleCaptcha(OCR): # draw.ellipse((c[0]-c[2], c[1]-c[2], c[0]+c[2], c[1]+c[2]), outline=0) # _pause = "NOTDOUND" # imdebug.save("debug.png", "png") - if verified is 0: + if verified == 0: draw.ellipse((c[0]-c[2], c[1]-c[2], c[0]+c[2], c[1]+c[2]), outline=120) _pause = "OPENED" - if verified is 1: + if verified == 1: draw.ellipse((c[0]-c[2], c[1]-c[2], c[0]+c[2], c[1]+c[2]), outline=65) _pause = "CLOSED" @@ -716,7 +716,7 @@ class CircleCaptcha(OCR): #: Clean results for c in found: verify = c[1] - if verify is 0: + 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 diff --git a/module/plugins/crypter/DlProtectCom.py b/module/plugins/crypter/DlProtectCom.py index c9c28ba48..e09dc9e2e 100644 --- a/module/plugins/crypter/DlProtectCom.py +++ b/module/plugins/crypter/DlProtectCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter class DlProtectCom(SimpleCrypter): __name__ = "DlProtectCom" __type__ = "crypter" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?dl-protect\.com/((en|fr)/)?\w+' @@ -41,7 +41,7 @@ class DlProtectCom(SimpleCrypter): i = base64.b64decode(i) # Split information infos = i.split('|') - assert(len(infos) is 4) + assert(len(infos) == 4) res = infos[0] user_agent = infos[1] plugins = [x.split(';') for x in infos[2].split('&')] diff --git a/module/plugins/crypter/Go4UpCom.py b/module/plugins/crypter/Go4UpCom.py index 33bde9889..143d189af 100755 --- a/module/plugins/crypter/Go4UpCom.py +++ b/module/plugins/crypter/Go4UpCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.misc import json class Go4UpCom(SimpleCrypter): __name__ = "Go4UpCom" __type__ = "crypter" - __version__ = "0.17" + __version__ = "0.18" __status__ = "testing" __pattern__ = r'http://go4up\.com/(dl/\w{12}|rd/\w{12}/\d+)' @@ -40,7 +40,7 @@ class Go4UpCom(SimpleCrypter): if hosterslink_re: hosters = self.load(urlparse.urljoin("http://go4up.com/", hosterslink_re.group(1))) for hoster in json.loads(hosters): - if preference is not 0 and preference != int(hoster["hostId"]): + if preference != 0 and preference != int(hoster["hostId"]): continue pagelink_re = re.search(self.LINK_PATTERN, hoster["link"]) if pagelink_re: diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireComFolder.py index b0e2e5e51..ef49aa818 100644 --- a/module/plugins/crypter/MediafireComFolder.py +++ b/module/plugins/crypter/MediafireComFolder.py @@ -9,7 +9,7 @@ from module.plugins.internal.misc import json class MediafireComFolder(Crypter): __name__ = "MediafireComFolder" __type__ = "crypter" - __version__ = "0.21" + __version__ = "0.22" __status__ = "testing" __pattern__ = r'http://(?:www\.)?mediafire\.com/(folder/|\?sharekey=|\?\w{13}($|[/#]))' @@ -58,7 +58,7 @@ class MediafireComFolder(Crypter): url, result = self._get_url(pyfile.url) self.log_debug("Location (%d): %s" % (result, url)) - if result is 0: + if result == 0: #: Load and parse html html = self.load(pyfile.url) m = re.search(self.LINK_PATTERN, html) @@ -84,7 +84,7 @@ class MediafireComFolder(Crypter): else: self.fail(json_data['response']['message']) - elif result is 1: + elif result == 1: self.offline() else: diff --git a/module/plugins/hooks/AntiStandby.py b/module/plugins/hooks/AntiStandby.py index 2159e5937..05f33b397 100644 --- a/module/plugins/hooks/AntiStandby.py +++ b/module/plugins/hooks/AntiStandby.py @@ -27,7 +27,7 @@ class Kernel32(object): class AntiStandby(Addon): __name__ = "AntiStandby" __type__ = "hook" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __config__ = [("activated", "bool", "Activated" , True ), @@ -57,7 +57,7 @@ class AntiStandby(Addon): if hdd: self.periodical.start(self.config.get('interval'), threaded=True) - if os.name is "nt": + if os.name == "nt": self.win_standby(system, display) elif sys.platform == "darwin": @@ -70,7 +70,7 @@ class AntiStandby(Addon): def deactivate(self): self.remove(self.TMP_FILE, trash=False) - if os.name is "nt": + if os.name == "nt": self.win_standby(True) elif sys.platform == "darwin": diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 1a0f3f8bd..bafd3f4d3 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -16,7 +16,7 @@ from module.plugins.internal.misc import encode, exists, fsjoin class AntiVirus(Addon): __name__ = "AntiVirus" __type__ = "hook" - __version__ = "0.16" + __version__ = "0.18" __status__ = "broken" #@TODO: add trash option (use Send2Trash lib) @@ -44,7 +44,7 @@ class AntiVirus(Addon): if not os.path.isfile(avfile): self.fail(_("Antivirus executable not found")) - scanfolder = self.config.get('avtarget') is "folder" + scanfolder = self.config.get('avtarget') == "folder" if scanfolder: dl_folder = self.pyload.config.get("general", "download_folder") @@ -83,14 +83,14 @@ class AntiVirus(Addon): action = self.config.get('action') if scanfolder: - if action is "Antivirus default": + if action == "Antivirus default": self.log_warning(_("Delete/Quarantine task skipped in folder scan mode")) return pyfile.error = _("Infected file") try: - if action is "Delete": + if action == "Delete": if not self.config.get('deltotrash'): os.remove(file) @@ -111,7 +111,7 @@ class AntiVirus(Addon): else: self.log_debug("Successfully moved file to trash") - elif action is "Quarantine": + elif action == "Quarantine": pyfile.setCustomStatus(_("file moving")) shutil.move(file, self.config.get('quardir')) @@ -132,5 +132,5 @@ class AntiVirus(Addon): def download_failed(self, pyfile): #: Check if pyfile is still "failed", maybe might has been restarted in meantime - if pyfile.status is 8 and self.config.get('scanfailed'): + if pyfile.status == 8 and self.config.get('scanfailed'): return self.scan(pyfile) diff --git a/module/plugins/hooks/ClickNLoad.py b/module/plugins/hooks/ClickNLoad.py index 83d71d8e3..4ac6b507f 100644 --- a/module/plugins/hooks/ClickNLoad.py +++ b/module/plugins/hooks/ClickNLoad.py @@ -16,7 +16,7 @@ from module.plugins.internal.misc import forward, lock class ClickNLoad(Addon): __name__ = "ClickNLoad" __type__ = "hook" - __version__ = "0.52" + __version__ = "0.53" __status__ = "testing" __config__ = [("activated", "bool" , "Activated" , True ), @@ -93,7 +93,7 @@ class ClickNLoad(Addon): server_socket.connect((webip, webport)) - self.forward(client_socket, server_socket, self.config.get('dest') is "queue") + self.forward(client_socket, server_socket, self.config.get('dest') == "queue") self.forward(server_socket, client_socket) except socket.timeout: diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 28286d02c..782e917b0 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -7,7 +7,7 @@ import sys # monkey patch bug in python 2.6 and lower # http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 -if sys.version_info < (2, 7) and os.name is not "nt": +if sys.version_info < (2, 7) and os.name != "nt": import errno import subprocess @@ -98,7 +98,7 @@ class ArchiveQueue(object): class ExtractArchive(Addon): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.55" + __version__ = "1.56" __status__ = "broken" __config__ = [("activated" , "bool" , "Activated" , True ), diff --git a/module/plugins/hooks/IRC.py b/module/plugins/hooks/IRC.py index 7dec4b798..2b7bea5fd 100644 --- a/module/plugins/hooks/IRC.py +++ b/module/plugins/hooks/IRC.py @@ -219,7 +219,7 @@ class IRC(Thread, Notifier): lines = ["ID - Name - Status - Speed - ETA - Progress"] for data in downloads: - if data.status is 5: + if data.status == 5: temp_progress = data.format_wait else: temp_progress = "%d%% (%s)" % (data.percent, data.format_size) diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 5afeb4a78..4c43c9189 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -32,7 +32,7 @@ class ImageTyperzException(Exception): class ImageTyperz(Addon): __name__ = "ImageTyperz" __type__ = "hook" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , False), @@ -99,7 +99,7 @@ class ImageTyperz(Addon): raise ImageTyperzException(res) else: data = res.split('|') - if len(data) is 2: + if len(data) == 2: ticket, result = data else: raise ImageTyperzException("Unknown response: %s" % res) diff --git a/module/plugins/hooks/LogMarker.py b/module/plugins/hooks/LogMarker.py index 80f7b17fb..e73fa01e6 100644 --- a/module/plugins/hooks/LogMarker.py +++ b/module/plugins/hooks/LogMarker.py @@ -9,7 +9,7 @@ from module.plugins.internal.misc import seconds_to_nexthour class LogMarker(Addon): __name__ = "LogMarker" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __config__ = [("activated", "bool", "Activated" , False), @@ -26,7 +26,7 @@ class LogMarker(Addon): def periodical_task(self): - if self.config.get('mark_day') and datetime.datetime.today().hour is 0: + if self.config.get('mark_day') and datetime.datetime.today().hour == 0: self.log_info("------------------------------------------------") self.log_info(_("------------------- DAY MARK -------------------")) self.log_info("------------------------------------------------") diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 429737e94..c318e3247 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -72,7 +72,7 @@ class SkipRev(Addon): pyname = re.compile(r'%s\.part\d+\.rev$' % pyfile.name.rsplit('.', 2)[0].replace('.', '\.')) for fid, fdata in pyfile.package().getChildren().items(): - if fdata['status'] is 4 and pyname.match(fdata['name']): + if fdata['status'] == 4 and pyname.match(fdata['name']): pyfile_new = self._create_pyFile(fdata) if revtokeep > -1 or pyfile.name.endswith(".rev"): diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index db43bca2b..35ff91672 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -7,7 +7,7 @@ from module.plugins.internal.Addon import Addon class UnSkipOnFail(Addon): __name__ = "UnSkipOnFail" __type__ = "hook" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __config__ = [("activated", "bool", "Activated", True)] @@ -62,7 +62,7 @@ class UnSkipOnFail(Addon): pdata = self.pyload.api.getPackageData(pinfo.pid) for link in pdata.links: #: Check if link == "skipped" - if link.status is not 4: + if link.status != 4: continue #: Check if link name collides with pdata's name diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 817990b0f..28a8ece39 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -15,7 +15,7 @@ from module.plugins.internal.misc import encode, exists, fsjoin class UpdateManager(Addon): __name__ = "UpdateManager" __type__ = "hook" - __version__ = "1.06" + __version__ = "1.08" __status__ = "testing" __config__ = [("activated" , "bool", "Activated" , True ), @@ -146,7 +146,7 @@ class UpdateManager(Addon): """ Check for updates """ - if self._update() is not 2 or not self.config.get('autorestart'): + if self._update() != 2 or not self.config.get('autorestart'): return if not self.pyload.api.statusDownloads(): @@ -345,7 +345,7 @@ class UpdateManager(Addon): py_filename = fsjoin(basedir, plugin_type, plugin_name + ".py") pyc_filename = py_filename + "c" - if plugin_type is "hook": + if plugin_type == "hook": try: self.manager.deactivateHook(plugin_name) diff --git a/module/plugins/hooks/XFileSharing.py b/module/plugins/hooks/XFileSharing.py index 4af246da8..3de4d02eb 100644 --- a/module/plugins/hooks/XFileSharing.py +++ b/module/plugins/hooks/XFileSharing.py @@ -84,7 +84,7 @@ class XFileSharing(Addon): self.log_info(_("Handle %d %s%s: %s") % (len(plugin_set), type, - "" if len(plugin_set) is 1 else "s", + "" if len(plugin_set) == 1 else "s", match_list.replace('\.', '.').replace('|', ', '))) else: plugin_list = [] diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 951920444..54f413d13 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" - __version__ = "0.59" + __version__ = "0.60" __status__ = "testing" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.+?)\.html)' @@ -114,7 +114,7 @@ class BitshareCom(SimpleHoster): self.retry() #: Resolve captcha - if captcha is 1: + if captcha == 1: self.log_debug("File is captcha protected") self.captcha = ReCaptcha(self.pyfile) diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index 6c8f21766..119373b08 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -44,7 +44,7 @@ def get_info(urls): class DailymotionCom(Hoster): __name__ = "DailymotionCom" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?dailymotion\.com/.*video/(?P<ID>[\w^_]+)' @@ -112,10 +112,10 @@ class DailymotionCom(Hoster): def check_info(self, pyfile): pyfile.name, pyfile.size, pyfile.status, pyfile.url = get_info([pyfile.url])[0] - if pyfile.status is 1: + if pyfile.status == 1: self.offline() - elif pyfile.status is 6: + elif pyfile.status == 6: self.temp_offline() diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index 68aa24149..04a91fe94 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -33,7 +33,7 @@ def get_info(urls): class FilesMailRu(Hoster): __name__ = "FilesMailRu" __type__ = "hoster" - __version__ = "0.38" + __version__ = "0.39" __status__ = "testing" __pattern__ = r'http://(?:www\.)?files\.mail\.ru/.+' @@ -105,7 +105,7 @@ class FilesMailRu(Hoster): #: 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) - if self.scan_download({'html': "<meta name="}, read_size=50000) is "html": + if self.scan_download({'html': "<meta name="}, read_size=50000) == "html": self.log_info(_("There was HTML Code in the Downloaded File (%s)...redirect error? The Download will be restarted." % self.pyfile.name)) self.retry() diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index a693cb58a..cb39311bc 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -31,7 +31,7 @@ def get_info(plugin, urls): class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" - __version__ = "0.66" + __version__ = "0.67" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+)' @@ -69,7 +69,7 @@ class FileserveCom(Hoster): def process(self, pyfile): pyfile.name, pyfile.size, status, self.url = check_file(self, [self.url])[0] - if status is not 2: + if status != 2: self.offline() self.log_debug("File Name: %s Size: %d" % (pyfile.name, pyfile.size)) diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index 1cdf00842..edf0a6c0c 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -43,7 +43,7 @@ class FreeWayMe(MultiHoster): if 'location' in header: headers = self.load(header.get('location'), just_header=True) - if headers['code'] is 500: + if headers['code'] == 500: #: Error on 2nd stage self.log_error(_("Error [stage2]")) else: diff --git a/module/plugins/hoster/HighWayMe.py b/module/plugins/hoster/HighWayMe.py index a9d4db373..029cb7fdc 100644 --- a/module/plugins/hoster/HighWayMe.py +++ b/module/plugins/hoster/HighWayMe.py @@ -9,7 +9,7 @@ from module.plugins.internal.misc import seconds_to_midnight class HighWayMe(MultiHoster): __name__ = "HighWayMe" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __pattern__ = r'https?://.+high-way\.my' @@ -30,7 +30,7 @@ class HighWayMe(MultiHoster): def check_errors(self): - if self.data.get('code') is 302: #@NOTE: This is not working. It should by if 302 Moved Temporarily then... But I don't now how to implement it. + if self.data.get('code') == 302: #@NOTE: This is not working. It should by if 302 Moved Temporarily then... But I don't now how to implement it. self.account.relogin() self.retry() diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index bb823256f..ef2cdbf29 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -13,7 +13,7 @@ from module.plugins.captcha.ReCaptcha import ReCaptcha class OboomCom(Hoster): __name__ = "OboomCom" __type__ = "hoster" - __version__ = "0.42" + __version__ = "0.43" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?oboom\.com/(?:#(?:id=|/)?)?(?P<ID>\w{8})' @@ -65,7 +65,7 @@ class OboomCom(Hoster): else: apiUrl = "http://www.oboom.com/1.0/guestsession" result = self.load_url(apiUrl) - if result[0] is 200: + if result[0] == 200: self.session_token = result[1] else: self.fail(_("Could not retrieve token for guest session. Error code: %s") % result[0]) @@ -83,14 +83,14 @@ class OboomCom(Hoster): result = self.load_url(apiUrl, params) - if result[0] is 200: + if result[0] == 200: self.download_token = result[1] self.download_auth = result[2] self.captcha.correct() self.wait(30) else: - if result[0] is 403: + if result[0] == 403: if result[1] == -1: #: Another download is running self.set_wait(15 * 60) else: @@ -100,7 +100,7 @@ class OboomCom(Hoster): self.wait() self.retry(5) - elif result[0] is 400 and result[1] == "forbidden": + elif result[0] == 400 and result[1] == "forbidden": self.retry(5, 15 * 60, _("Service unavailable")) self.retry_captcha() @@ -111,7 +111,7 @@ class OboomCom(Hoster): params = {'token': token, 'items': fileId, 'http_errors': 0} result = self.load_url(apiUrl, params) - if result[0] is 200: + if result[0] == 200: item = result[1][0] if item['state'] == "online": self.file_size = item['size'] @@ -132,10 +132,10 @@ class OboomCom(Hoster): params['auth'] = self.download_auth result = self.load_url(apiUrl, params) - if result[0] is 200: + if result[0] == 200: self.download_domain = result[1] self.download_ticket = result[2] - elif result[0] is 421: + elif result[0] == 421: self.retry(wait=result[2] + 60, msg=_("Connection limit exceeded")) else: self.fail(_("Could not retrieve download ticket. Error code: %s") % result[0]) diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index 07d906b15..fad4c8b81 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -10,7 +10,7 @@ from module.plugins.internal.misc import json, parse_size class OverLoadMe(MultiHoster): __name__ = "OverLoadMe" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" __status__ = "testing" __pattern__ = r'https?://.*overload\.me/.+' @@ -40,7 +40,7 @@ class OverLoadMe(MultiHoster): self.log_debug(data) - if data['error'] is 1: + if data['error'] == 1: self.log_warning(data['msg']) self.temp_offline() else: diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py index 1f98aa0fe..2951ee49d 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -7,7 +7,7 @@ from module.plugins.internal.misc import json class PremiumizeMe(MultiHoster): __name__ = "PremiumizeMe" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __status__ = "testing" __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate @@ -48,7 +48,7 @@ class PremiumizeMe(MultiHoster): #: Check status and decide what to do status = data['status'] - if status is 200: + if status == 200: if 'filename' in data['result']: self.pyfile.name = data['result']['filename'] @@ -58,10 +58,10 @@ class PremiumizeMe(MultiHoster): self.link = data['result']['location'] return - elif status is 400: + elif status == 400: self.fail(_("Invalid url")) - elif status is 404: + elif status == 404: self.offline() elif status >= 500: diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 27fb4fda0..50bbb0414 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -15,7 +15,7 @@ from module.plugins.internal.misc import json class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.39" + __version__ = "0.40" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' @@ -82,10 +82,10 @@ class RapidgatorNet(SimpleHoster): status = e.code msg = e - if status is 200: + if status == 200: return json_data['response'] - elif status is 423: + elif status == 423: self.account.empty() self.retry() diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index 41208df89..57285560c 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.misc import json, parse_size class RealdebridCom(MultiHoster): __name__ = "RealdebridCom" __type__ = "hoster" - __version__ = "0.72" + __version__ = "0.73" __status__ = "testing" __pattern__ = r'https?://((?:www\.|s\d+\.)?real-debrid\.com/dl/|[\w^_]\.rdb\.so/d/)[\w^_]+' @@ -41,7 +41,7 @@ class RealdebridCom(MultiHoster): self.log_debug("Returned Data: %s" % data) - if data['error'] is not 0: + if data['error'] != 0: if data['message'] == "Your file is unavailable on the hoster.": self.offline() else: diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py index dc0646e4c..8ac79798b 100644 --- a/module/plugins/hoster/WrzucTo.py +++ b/module/plugins/hoster/WrzucTo.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster class WrzucTo(SimpleHoster): __name__ = "WrzucTo" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __pattern__ = r'http://(?:www\.)?wrzuc\.to/(\w+(\.wt|\.html)|(\w+/?linki/\w+))' @@ -37,7 +37,7 @@ class WrzucTo(SimpleHoster): def handle_free(self, pyfile): data = dict(re.findall(r'(md5|file): "(.*?)"', self.data)) - if len(data) is not 2: + if len(data) != 2: self.error(_("No file ID")) self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) @@ -48,7 +48,7 @@ class WrzucTo(SimpleHoster): self.data = self.load("http://www.wrzuc.to/ajax/server/download_link", post={'file': data['file']}) data.update(re.findall(r'"(download_link|server_id)":"(.*?)"', self.data)) - if len(data) is not 4: + if len(data) != 4: self.error(_("No download URL")) self.link = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link']) diff --git a/module/plugins/hoster/XDCC.py b/module/plugins/hoster/XDCC.py index 3985a050c..8fdb704d9 100644 --- a/module/plugins/hoster/XDCC.py +++ b/module/plugins/hoster/XDCC.py @@ -14,7 +14,7 @@ from module.plugins.internal.misc import fsjoin class XDCC(Hoster): __name__ = "XDCC" __type__ = "hoster" - __version__ = "0.38" + __version__ = "0.39" __status__ = "testing" __config__ = [("nick", "str", "Nickname", "pyload"), @@ -48,7 +48,7 @@ class XDCC(Hoster): else: errno = e.args[0] - if errno is 10054: + if errno == 10054: self.log_debug("Server blocked our ip, retry in 5 min") self.wait(300) continue @@ -72,9 +72,9 @@ class XDCC(Hoster): temp = server.split(':') ln = len(temp) - if ln is 2: + if ln == 2: host, port = temp - elif ln is 1: + elif ln == 1: host, port = temp[0], 6667 else: self.fail(_("Invalid hostname for IRC Server: %s") % server) @@ -139,7 +139,7 @@ class XDCC(Hoster): self.fail(_("IRC-Error: %s") % line) msg = line.split(None, 3) - if len(msg) is not 4: + if len(msg) != 4: continue msg = { diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py index b171813d8..fcb9210ce 100644 --- a/module/plugins/internal/Addon.py +++ b/module/plugins/internal/Addon.py @@ -66,7 +66,7 @@ class Addon(Plugin): #@TODO: Remove in 0.4.10 def _log(self, level, plugintype, pluginname, messages): - plugintype = "addon" if plugintype is "hook" else plugintype + plugintype = "addon" if plugintype == "hook" else plugintype return super(Addon, self)._log(level, plugintype, pluginname, messages) diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py index 9c355d5de..104b67edc 100644 --- a/module/plugins/internal/Base.py +++ b/module/plugins/internal/Base.py @@ -27,7 +27,7 @@ def parse_fileInfo(klass, url="", html=""): class Base(Plugin): __name__ = "Base" __type__ = "base" - __version__ = "0.21" + __version__ = "0.22" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -235,19 +235,19 @@ class Base(Plugin): def check_status(self): status = self.pyfile.status - if status is 1: + if status == 1: self.offline() - elif status is 4: + elif status == 4: self.skip(self.pyfile.statusname) - elif status is 6: + elif status == 6: self.temp_offline() - elif status is 8: + elif status == 8: self.fail() - elif status is 9 or self.pyfile.abort: + elif status == 9 or self.pyfile.abort: self.abort() @@ -255,10 +255,10 @@ class Base(Plugin): self.log_debug("Plugin version: " + self.__version__) self.log_debug("Plugin status: " + self.__status__) - if self.__status__ is "broken": + if self.__status__ == "broken": self.abort(_("Plugin is temporarily unavailable")) - elif self.__status__ is "testing": + elif self.__status__ == "testing": self.log_warning(_("Plugin may be unstable")) diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py index 217305459..274f14d8b 100644 --- a/module/plugins/internal/OCR.py +++ b/module/plugins/internal/OCR.py @@ -20,7 +20,7 @@ from module.plugins.internal.misc import encode, fsjoin class OCR(Plugin): __name__ = "OCR" __type__ = "ocr" - __version__ = "0.22" + __version__ = "0.25" __status__ = "stable" __description__ = """OCR base plugin""" @@ -92,7 +92,7 @@ class OCR(Plugin): self.log_debug("Saving tiff...") self.img.save(tmpTif.name, 'TIFF') - if os.name is "nt": + if os.name == "nt": command = os.path.join(pypath, "tesseract", "tesseract.exe") else: command = "tesseract" @@ -167,34 +167,34 @@ 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 try: - if pixels[x - 1, y - 1] is not 255: + if pixels[x - 1, y - 1] != 255: count += 1 - if pixels[x - 1, y] is not 255: + if pixels[x - 1, y] != 255: count += 1 - if pixels[x - 1, y + 1] is not 255: + if pixels[x - 1, y + 1] != 255: count += 1 - if pixels[x, y + 1] is not 255: + if pixels[x, y + 1] != 255: count += 1 - if pixels[x + 1, y + 1] is not 255: + if pixels[x + 1, y + 1] != 255: count += 1 - if pixels[x + 1, y] is not 255: + if pixels[x + 1, y] != 255: count += 1 - if pixels[x + 1, y - 1] is not 255: + if pixels[x + 1, y - 1] != 255: count += 1 - if pixels[x, y - 1] is not 255: + if pixels[x, y - 1] != 255: count += 1 except Exception: @@ -208,7 +208,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 @@ -223,7 +223,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 = {} @@ -239,7 +239,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 = {} @@ -247,14 +247,14 @@ 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 cnt = 0 for x in count.values(): - if x is not 0: + if x != 0: sum += x cnt += 1 @@ -280,10 +280,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 @@ -300,7 +300,7 @@ class OCR(Plugin): for x in xrange(width): black_pixel_in_col = False for y in xrange(height): - if pixels[x, y] is not 255: + if pixels[x, y] != 255: if not started: started = True firstX = x diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index f670a2324..cf03085f7 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -6,7 +6,7 @@ import inspect import os import re -if os.name is not "nt": +if os.name != "nt": import grp import pwd @@ -150,7 +150,7 @@ class Plugin(object): mode = int(permission, 8) os.chmod(path, mode) - if os.name is not "nt" and self.pyload.config.get("permission", "change_dl"): + if os.name != "nt" and self.pyload.config.get("permission", "change_dl"): uid = pwd.getpwnam(self.pyload.config.get("permission", "user"))[2] gid = grp.getgrnam(self.pyload.config.get("permission", "group"))[2] os.chown(path, uid, gid) diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index a8306f393..2ae3c197c 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -11,7 +11,7 @@ from module.plugins.internal.misc import encode, fsjoin, renice class SevenZip(UnRar): __name__ = "SevenZip" __type__ = "extractor" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __description__ = """7-Zip extractor plugin""" @@ -37,7 +37,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 d8bb7ad3c..0cd343426 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -11,7 +11,7 @@ from module.plugins.internal.misc import parse_name, replace_patterns class SimpleCrypter(Crypter): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.82" + __version__ = "0.83" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -90,12 +90,12 @@ class SimpleCrypter(Crypter): info.update(cls.api_info(url)) - if not html and info['status'] is not 2: + if not html and info['status'] != 2: if not url: 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) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index a00b6e3fb..98f040bad 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -16,7 +16,7 @@ from module.plugins.internal.misc import (encode, parse_name, parse_size, class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "2.17" + __version__ = "2.18" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -137,12 +137,12 @@ class SimpleHoster(Hoster): info = super(SimpleHoster, cls).get_info(url) info.update(cls.api_info(url)) - if not html and info['status'] is not 2: + if not html and info['status'] != 2: if not url: 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) @@ -269,7 +269,7 @@ class SimpleHoster(Hoster): self.preload() self.check_errors() - if self.info.get('status', 3) is not 2: + if self.info.get('status', 3) != 2: self.grab_info() self.check_status() self.check_duplicates() diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index b9c91bce8..d1f180546 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -12,7 +12,7 @@ from module.plugins.internal.misc import decode, encode, fsjoin, renice class UnRar(Extractor): __name__ = "UnRar" __type__ = "extractor" - __version__ = "1.30" + __version__ = "1.31" __status__ = "testing" __description__ = """RAR extractor plugin""" @@ -37,7 +37,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" @@ -49,7 +49,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" diff --git a/module/plugins/internal/misc.py b/module/plugins/internal/misc.py index 200e030c1..b5b25260a 100644 --- a/module/plugins/internal/misc.py +++ b/module/plugins/internal/misc.py @@ -33,7 +33,7 @@ except ImportError: class misc(object): __name__ = "misc" __type__ = "plugin" - __version__ = "0.17" + __version__ = "0.18" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -264,7 +264,7 @@ def compare_time(start, end): def free_space(folder): - if os.name is "nt": + if os.name == "nt": import ctypes free_bytes = ctypes.c_ulonglong(0) @@ -285,7 +285,7 @@ def fsbsize(path): """ path = encode(path) - if os.name is "nt": + if os.name == "nt": import ctypes drive = "%s\\" % os.path.splitdrive(path)[0] @@ -337,8 +337,8 @@ def isiterable(obj): def get_console_encoding(enc): - if os.name is "nt": - if enc is "cp65001": #: aka UTF-8 + if os.name == "nt": + if enc == "cp65001": #: aka UTF-8 enc = "cp850" # print "WARNING: Windows codepage 65001 (UTF-8) is not supported, used `%s` instead" % enc else: @@ -392,7 +392,7 @@ def exists(path): path = encode(path) if os.path.exists(path): - if os.name is "nt": + if os.name == "nt": dir, name = os.path.split(path.rstrip(os.sep)) return name in os.listdir(dir) else: @@ -476,7 +476,7 @@ def safepath(value): path = os.path.abspath(drive + filename) try: - if os.name is not "nt": + if os.name != "nt": return length = len(path) - 259 @@ -502,7 +502,7 @@ def safename(value): """ Remove invalid characters """ - repl = '<>:"/\\|?*' if os.name is "nt" else '\0/\\"' + repl = '<>:"/\\|?*' if os.name == "nt" else '\0/\\"' name = remove_chars(value, repl) return name @@ -527,7 +527,7 @@ def parse_size(value, unit=""): #: returns bytes size = float(m.group(1).replace(',', '.')) unit = (unit.strip().lower() or m.group(2) or "byte")[0] - if unit is "b": + if unit == "b": return int(size) sizeunits = ['b', 'k', 'm', 'g', 't', 'p', 'e'] @@ -693,7 +693,7 @@ def set_cookies(cj, cookies): if not isinstance(cookie, tuple): continue - if len(cookie) is not 3: + if len(cookie) != 3: continue set_cookie(cj, *cookie) @@ -768,7 +768,7 @@ def chunks(iterable, size): def renice(pid, value): - if not value or os.name is "nt": + if not value or os.name == "nt": return try: |