summaryrefslogtreecommitdiffstats
path: root/pyload/manager/thread
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/manager/thread')
-rw-r--r--pyload/manager/thread/Addon.py2
-rw-r--r--pyload/manager/thread/Download.py2
-rw-r--r--pyload/manager/thread/Info.py14
-rw-r--r--pyload/manager/thread/Plugin.py9
-rw-r--r--pyload/manager/thread/Server.py9
5 files changed, 20 insertions, 16 deletions
diff --git a/pyload/manager/thread/Addon.py b/pyload/manager/thread/Addon.py
index 1da164543..b176e4e0c 100644
--- a/pyload/manager/thread/Addon.py
+++ b/pyload/manager/thread/Addon.py
@@ -58,7 +58,7 @@ class AddonThread(PluginThread):
self.kwargs['thread'] = self
self.f(*self.args, **self.kwargs)
except TypeError, e:
- #dirty method to filter out exceptions
+ # dirty method to filter out exceptions
if "unexpected keyword argument 'thread'" not in e.args[0]:
raise
diff --git a/pyload/manager/thread/Download.py b/pyload/manager/thread/Download.py
index 21db61ca4..293014a2e 100644
--- a/pyload/manager/thread/Download.py
+++ b/pyload/manager/thread/Download.py
@@ -39,7 +39,7 @@ class DownloadThread(PluginThread):
while True:
del pyfile
- self.active = False # sets the thread inactive when it is ready to get next job
+ self.active = False #: sets the thread inactive when it is ready to get next job
self.active = self.queue.get()
pyfile = self.active
diff --git a/pyload/manager/thread/Info.py b/pyload/manager/thread/Info.py
index 28a2e8e91..9d8a3ef5b 100644
--- a/pyload/manager/thread/Info.py
+++ b/pyload/manager/thread/Info.py
@@ -26,13 +26,13 @@ class InfoThread(PluginThread):
PluginThread.__init__(self, manager)
self.data = data
- self.pid = pid # package id
+ self.pid = pid #: package id
# [ .. (name, plugin) .. ]
- self.rid = rid # result id
- self.add = add # add packages instead of return result
+ self.rid = rid #: result id
+ self.add = add #: add packages instead of return result
- self.cache = [] # accumulated data
+ self.cache = [] #: accumulated data
self.start()
@@ -83,7 +83,7 @@ class InfoThread(PluginThread):
# empty cache
del self.cache[:]
- else: # post the results
+ else: #: post the results
for name, url in container:
# attach container content
@@ -154,8 +154,8 @@ class InfoThread(PluginThread):
def fetchForPlugin(self, pluginname, plugin, urls, cb, err=None):
try:
- result = [] # result loaded from cache
- process = [] # urls to process
+ result = [] #: result loaded from cache
+ process = [] #: urls to process
for url in urls:
if url in self.m.infoCache:
result.append(self.m.infoCache[url])
diff --git a/pyload/manager/thread/Plugin.py b/pyload/manager/thread/Plugin.py
index 08a2664da..d8319a2ce 100644
--- a/pyload/manager/thread/Plugin.py
+++ b/pyload/manager/thread/Plugin.py
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
# @author: RaNaN
+from __future__ import with_statement
+
from Queue import Queue
from threading import Thread
from os import listdir, stat
@@ -64,9 +66,8 @@ class PluginThread(Thread):
self.m.log.debug("Error creating zip file: %s" % e)
dump_name = dump_name.replace(".zip", ".txt")
- f = open(dump_name, "wb")
- f.write(dump)
- f.close()
+ with open(dump_name, "wb") as f:
+ f.write(dump)
self.m.core.log.info("Debug Report written to %s" % dump_name)
@@ -128,5 +129,5 @@ class PluginThread(Thread):
def clean(self, pyfile):
""" set thread unactive and release pyfile """
- self.active = True #release pyfile but lets the thread active
+ self.active = True #: release pyfile but lets the thread active
pyfile.release()
diff --git a/pyload/manager/thread/Server.py b/pyload/manager/thread/Server.py
index 83e886253..97590013e 100644
--- a/pyload/manager/thread/Server.py
+++ b/pyload/manager/thread/Server.py
@@ -89,11 +89,13 @@ class WebServer(threading.Thread):
def start_threaded(self):
if self.https:
- self.core.log.info(_("Starting threaded SSL webserver: %(host)s:%(port)d") % {"host": self.host, "port": self.port})
+ self.core.log.info(
+ _("Starting threaded SSL webserver: %(host)s:%(port)d") % {"host": self.host, "port": self.port})
else:
self.cert = ""
self.key = ""
- self.core.log.info(_("Starting threaded webserver: %(host)s:%(port)d") % {"host": self.host, "port": self.port})
+ self.core.log.info(
+ _("Starting threaded webserver: %(host)s:%(port)d") % {"host": self.host, "port": self.port})
webinterface.run_threaded(host=self.host, port=self.port, cert=self.cert, key=self.key)
@@ -111,7 +113,8 @@ class WebServer(threading.Thread):
if self.https:
log.warning(_("This server offers no SSL, please consider using threaded instead"))
- self.core.log.info(_("Starting lightweight webserver (bjoern): %(host)s:%(port)d") % {"host": self.host, "port": self.port})
+ self.core.log.info(
+ _("Starting lightweight webserver (bjoern): %(host)s:%(port)d") % {"host": self.host, "port": self.port})
webinterface.run_lightweight(host=self.host, port=self.port)