summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-06-17 18:59:20 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-06-24 22:42:40 +0200
commit20b6a2ec022202b0efb6cb69415239fb8f4d1445 (patch)
treefdbb3ad42854144b1cace0221145a472b36ef84d /module/plugins/internal
parentSpare code cosmetics (diff)
downloadpyload-20b6a2ec022202b0efb6cb69415239fb8f4d1445.tar.xz
Spare code cosmetics (2)
Diffstat (limited to 'module/plugins/internal')
-rw-r--r--module/plugins/internal/Account.py4
-rw-r--r--module/plugins/internal/AdYouLike.py22
-rw-r--r--module/plugins/internal/Crypter.py2
-rw-r--r--module/plugins/internal/Hook.py4
-rw-r--r--module/plugins/internal/Hoster.py6
-rw-r--r--module/plugins/internal/MultiHook.py6
-rw-r--r--module/plugins/internal/OCR.py14
-rw-r--r--module/plugins/internal/Plugin.py6
-rw-r--r--module/plugins/internal/SevenZip.py6
-rw-r--r--module/plugins/internal/UnRar.py28
10 files changed, 49 insertions, 49 deletions
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index 0595da20b..d2efe7996 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -57,7 +57,7 @@ class Account(Plugin):
@lock
def _login(self, user, data):
- # set timestamp for login
+ #: set timestamp for login
self.timestamps[user] = time.time()
req = self.getAccountRequest(user)
@@ -192,7 +192,7 @@ class Account(Plugin):
"""
return {"validuntil" : None, #: -1 for unlimited
"login" : name,
- # "password" : self.accounts[name]['password'], #: commented due security reason
+ #: "password" : self.accounts[name]['password'], #: commented due security reason
"options" : self.accounts[name]['options'],
"valid" : self.accounts[name]['valid'],
"trafficleft": None, #: in bytes, -1 for unlimited
diff --git a/module/plugins/internal/AdYouLike.py b/module/plugins/internal/AdYouLike.py
index b7324ef8e..f623ed268 100644
--- a/module/plugins/internal/AdYouLike.py
+++ b/module/plugins/internal/AdYouLike.py
@@ -37,8 +37,8 @@ class AdYouLike(Captcha):
def challenge(self, key=None, html=None):
ayl, callback = key or self.retrieve_key(html)
- # {"adyoulike":{"key":"P~zQ~O0zV0WTiAzC-iw0navWQpCLoYEP"},
- # "all":{"element_id":"ayl_private_cap_92300","lang":"fr","env":"prod"}}
+ #: {"adyoulike":{"key":"P~zQ~O0zV0WTiAzC-iw0navWQpCLoYEP"},
+ #: "all":{"element_id":"ayl_private_cap_92300","lang":"fr","env":"prod"}}
ayl = json_loads(ayl)
html = self.plugin.load("http://api-ayl.appspot.com/challenge",
@@ -57,15 +57,15 @@ class AdYouLike(Captcha):
def result(self, server, challenge):
- # Adyoulike.g._jsonp_5579316662423138
- # ({"translations":{"fr":{"instructions_visual":"Recopiez « Soonnight » ci-dessous :"}},
- # "site_under":true,"clickable":true,"pixels":{"VIDEO_050":[],"DISPLAY":[],"VIDEO_000":[],"VIDEO_100":[],
- # "VIDEO_025":[],"VIDEO_075":[]},"medium_type":"image/adyoulike",
- # "iframes":{"big":"<iframe src=\"http://www.soonnight.com/campagn.html\" scrolling=\"no\"
- # height=\"250\" width=\"300\" frameborder=\"0\"></iframe>"},"shares":{},"id":256,
- # "token":"e6QuI4aRSnbIZJg02IsV6cp4JQ9~MjA1","formats":{"small":{"y":300,"x":0,"w":300,"h":60},
- # "big":{"y":0,"x":0,"w":300,"h":250},"hover":{"y":440,"x":0,"w":300,"h":60}},
- # "tid":"SqwuAdxT1EZoi4B5q0T63LN2AkiCJBg5"})
+ #: Adyoulike.g._jsonp_5579316662423138
+ #: ({"translations":{"fr":{"instructions_visual":"Recopiez « Soonnight » ci-dessous :"}},
+ #: "site_under":true,"clickable":true,"pixels":{"VIDEO_050":[],"DISPLAY":[],"VIDEO_000":[],"VIDEO_100":[],
+ #: "VIDEO_025":[],"VIDEO_075":[]},"medium_type":"image/adyoulike",
+ #: "iframes":{"big":"<iframe src=\"http://www.soonnight.com/campagn.html\" scrolling=\"no\"
+ #: height=\"250\" width=\"300\" frameborder=\"0\"></iframe>"},"shares":{},"id":256,
+ #: "token":"e6QuI4aRSnbIZJg02IsV6cp4JQ9~MjA1","formats":{"small":{"y":300,"x":0,"w":300,"h":60},
+ #: "big":{"y":0,"x":0,"w":300,"h":250},"hover":{"y":440,"x":0,"w":300,"h":60}},
+ #: "tid":"SqwuAdxT1EZoi4B5q0T63LN2AkiCJBg5"})
if isinstance(server, basestring):
server = json_loads(server)
diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py
index e97f22316..d8cda17d4 100644
--- a/module/plugins/internal/Crypter.py
+++ b/module/plugins/internal/Crypter.py
@@ -82,7 +82,7 @@ class Crypter(Hoster):
if package_password:
self.core.api.setPackageData(pid, {"password": package_password})
- # Workaround to do not break API addPackage method
+ #: Workaround to do not break API addPackage method
setFolder = lambda x: self.core.api.setPackageData(pid, {"folder": x or ""})
if use_subfolder:
diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py
index 3a0431feb..5959089b5 100644
--- a/module/plugins/internal/Hook.py
+++ b/module/plugins/internal/Hook.py
@@ -46,7 +46,7 @@ class Hook(Plugin):
#: automatically register event listeners for functions, attribute will be deleted dont use it yourself
self.event_map = {}
- # Deprecated alternative to event_map
+ #: Deprecated alternative to event_map
#: List of events the plugin can handle, name the functions exactly like eventname.
self.event_list = [] #@NOTE: dont make duplicate entries in event_map
@@ -68,7 +68,7 @@ class Hook(Plugin):
else:
self.manager.addEvent(event, getattr(self, funcs))
- # delete for various reasons
+ #: delete for various reasons
self.event_map = None
if self.event_list:
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index 32c3312d0..e1a13af01 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -435,7 +435,7 @@ class Hoster(Plugin):
except Exception, e:
self.fail(e)
- # convert back to unicode
+ #: convert back to unicode
location = fs_decode(location)
name = safe_filename(self.pyfile.name)
@@ -519,8 +519,8 @@ class Hoster(Plugin):
with open(lastDownload, "rb") as f:
content = f.read(read_size)
- # produces encoding errors, better log to other file in the future?
- # self.logDebug("Content: %s" % content)
+ #: produces encoding errors, better log to other file in the future?
+ #: self.logDebug("Content: %s" % content)
for name, rule in rules.iteritems():
if isinstance(rule, basestring):
if rule in content:
diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py
index 739b225b4..22b0fd7c6 100644
--- a/module/plugins/internal/MultiHook.py
+++ b/module/plugins/internal/MultiHook.py
@@ -207,7 +207,7 @@ class MultiHook(Hook):
self.logError(_("No %s loaded") % self.plugintype)
return
- # inject plugin plugin
+ #: inject plugin plugin
self.logDebug("Overwritten %ss: %s" % (self.plugintype, ", ".join(sorted(self.supported))))
for plugin in self.supported:
@@ -223,7 +223,7 @@ class MultiHook(Hook):
self.logDebug("New %ss: %s" % (self.plugintype, ", ".join(plugins)))
- # create new regexp
+ #: create new regexp
regexp = r'.*(?P<DOMAIN>%s).*' % "|".join(x.replace('.', '\.') for x in plugins)
if hasattr(self.pluginclass, "__pattern__") and isinstance(self.pluginclass.__pattern__, basestring) and "://" in self.pluginclass.__pattern__:
regexp = r'%s|%s' % (self.pluginclass.__pattern__, regexp)
@@ -252,7 +252,7 @@ class MultiHook(Hook):
for plugin in self.supported:
self.unloadPlugin(plugin)
- # reset pattern
+ #: reset pattern
hdict = self.core.pluginManager.plugins[self.plugintype][self.pluginname]
hdict['pattern'] = getattr(self.pluginclass, "__pattern__", r'^unmatchable$')
diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py
index 5fe6f2532..0191a4938 100644
--- a/module/plugins/internal/OCR.py
+++ b/module/plugins/internal/OCR.py
@@ -61,12 +61,12 @@ class OCR(Plugin):
def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True, pagesegmode=None):
- # tmpTif = tempfile.NamedTemporaryFile(suffix=".tif")
+ #: tmpTif = tempfile.NamedTemporaryFile(suffix=".tif")
try:
tmpTif = open(fs_join("tmp", "tmpTif_%s.tif" % self.__name__), "wb")
tmpTif.close()
- # tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt")
+ #: tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt")
tmpTxt = open(fs_join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb")
tmpTxt.close()
@@ -88,7 +88,7 @@ class OCR(Plugin):
tessparams.extend(["-psm", str(pagesegmode)])
if subset and (digits or lowercase or uppercase):
- # tmpSub = tempfile.NamedTemporaryFile(suffix=".subset")
+ #: tmpSub = tempfile.NamedTemporaryFile(suffix=".subset")
with open(fs_join("tmp", "tmpSub_%s.subset" % self.__name__), "wb") as tmpSub:
tmpSub.write("tessedit_char_whitelist ")
@@ -154,7 +154,7 @@ class OCR(Plugin):
for y in xrange(h):
if pixels[x, y] == 255:
continue
- # No point in processing white pixels since we only want to remove black pixel
+ #: No point in processing white pixels since we only want to remove black pixel
count = 0
try:
@@ -177,12 +177,12 @@ class OCR(Plugin):
except Exception:
pass
- # not enough neighbors are dark pixels so mark this pixel
- # to be changed to white
+ #: not enough neighbors are dark pixels so mark this pixel
+ #: to be changed to white
if count < allowed:
pixels[x, y] = 1
- # second pass: this time set all 1's to 255 (white)
+ #: 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] == 1:
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 68169e077..1f86214c4 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -45,7 +45,7 @@ def parseHtmlForm(attr_str, html, input_names={}):
inputs[name] = value
if input_names:
- # check input attributes
+ #: check input attributes
for key, val in input_names.iteritems():
if key in inputs:
if isinstance(val, basestring) and inputs[key] == val:
@@ -60,7 +60,7 @@ def parseHtmlForm(attr_str, html, input_names={}):
else:
return action, inputs #: passed attribute check
else:
- # no attribute check
+ #: no attribute check
return action, inputs
return {}, None #: no matching form found
@@ -281,7 +281,7 @@ class Plugin(object):
self.logError(e)
if just_header:
- # parse header
+ #: parse header
header = {"code": req.code}
for line in res.splitlines():
line = line.strip()
diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py
index cad4cfa1c..7a79c278c 100644
--- a/module/plugins/internal/SevenZip.py
+++ b/module/plugins/internal/SevenZip.py
@@ -53,7 +53,7 @@ class SevenZip(UnRar):
def verify(self, password):
- # 7z can't distinguish crc and pw error in test
+ #: 7z can't distinguish crc and pw error in test
p = self.call_cmd("l", "-slt", fs_encode(self.filename))
out, err = p.communicate()
@@ -72,7 +72,7 @@ class SevenZip(UnRar):
p = self.call_cmd("l", "-slt", fs_encode(self.filename))
out, err = p.communicate()
- # check if output or error macthes the 'wrong password'-Regexp
+ #: check if output or error macthes the 'wrong password'-Regexp
if self.re_wrongpwd.search(out):
raise PasswordError
@@ -91,7 +91,7 @@ class SevenZip(UnRar):
renice(p.pid, self.renice)
- # communicate and retrieve stderr
+ #: communicate and retrieve stderr
self._progress(p)
err = p.stderr.read().strip()
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index 85e939b6a..25a8a52de 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -105,7 +105,7 @@ class UnRar(Extractor):
if self.re_wrongcrc.search(err):
raise CRCError(err)
- # output only used to check if passworded files are present
+ #: output only used to check if passworded files are present
for attr in self.re_filelist.findall(out):
if attr[0].startswith("*"):
raise PasswordError
@@ -114,7 +114,7 @@ class UnRar(Extractor):
def repair(self):
p = self.call_cmd("rc", fs_encode(self.filename))
- # communicate and retrieve stderr
+ #: communicate and retrieve stderr
self._progress(p)
err = p.stderr.read().strip()
if err or p.returncode:
@@ -126,17 +126,17 @@ class UnRar(Extractor):
s = ""
while True:
c = process.stdout.read(1)
- # quit loop on eof
+ #: quit loop on eof
if not c:
break
- # reading a percentage sign -> set progress and restart
+ #: reading a percentage sign -> set progress and restart
if c == '%':
self.notifyProgress(int(s))
s = ""
- # not reading a digit -> therefore restart
+ #: not reading a digit -> therefore restart
elif c not in digits:
s = ""
- # add digit to progressstring
+ #: add digit to progressstring
else:
s += c
@@ -148,7 +148,7 @@ class UnRar(Extractor):
renice(p.pid, self.renice)
- # communicate and retrieve stderr
+ #: communicate and retrieve stderr
self._progress(p)
err = p.stderr.read().strip()
@@ -171,10 +171,10 @@ class UnRar(Extractor):
def getDeleteFiles(self):
dir, name = os.path.split(self.filename)
- # actually extracted file
+ #: actually extracted file
files = [self.filename]
- # eventually Multipart Files
+ #: eventually Multipart Files
files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.isMultipart, os.listdir(dir))
if re.sub(self.re_multipart,".rar",name) == re.sub(self.re_multipart,".rar",file))
@@ -195,7 +195,7 @@ class UnRar(Extractor):
result = set()
if not self.fullpath and self.VERSION.startswith('5'):
- # NOTE: Unrar 5 always list full path
+ #@NOTE: Unrar 5 always list full path
for f in fs_decode(out).splitlines():
f = fs_join(self.out, os.path.basename(f.strip()))
if os.path.isfile(f):
@@ -211,7 +211,7 @@ class UnRar(Extractor):
def call_cmd(self, command, *xargs, **kwargs):
args = []
- # overwrite flag
+ #: overwrite flag
if self.overwrite:
args.append("-o+")
else:
@@ -222,10 +222,10 @@ class UnRar(Extractor):
for word in self.excludefiles:
args.append("-x'%s'" % word.strip())
- # assume yes on all queries
+ #: assume yes on all queries
args.append("-y")
- # set a password
+ #: set a password
if "password" in kwargs and kwargs['password']:
args.append("-p%s" % kwargs['password'])
else:
@@ -234,7 +234,7 @@ class UnRar(Extractor):
if self.keepbroken:
args.append("-kb")
- # NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue
+ #@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue
call = [self.CMD, command] + args + list(xargs)
self.manager.logDebug(" ".join(call))