summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-24 16:11:58 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-24 16:11:58 +0200
commit761ca5c66e07559925ebbdbc6531f9ca658b12ce (patch)
treebbdf0f330be882877a28366a852c90711c709338 /module/plugins/internal
parentHotfixes (2) (diff)
downloadpyload-761ca5c66e07559925ebbdbc6531f9ca658b12ce.tar.xz
Code cosmetics
Diffstat (limited to 'module/plugins/internal')
-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
11 files changed, 34 insertions, 34 deletions
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: