summaryrefslogtreecommitdiffstats
path: root/pyload/network
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-18 00:29:55 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-18 00:29:55 +0200
commitbb5a115533711fd8bb87f53cb32ff7342137208d (patch)
tree476600f9896fae029880e4049eb4c5e6021b202d /pyload/network
parentPEP-8, Python Zen, refactor and reduce code (part 6 in master module/common) (diff)
downloadpyload-bb5a115533711fd8bb87f53cb32ff7342137208d.tar.xz
Spare code cosmetics (5)
Diffstat (limited to 'pyload/network')
-rw-r--r--pyload/network/Browser.py3
-rw-r--r--pyload/network/HTTPChunk.py3
-rw-r--r--pyload/network/HTTPDownload.py9
-rw-r--r--pyload/network/RequestFactory.py1
-rw-r--r--pyload/network/XDCCRequest.py3
5 files changed, 13 insertions, 6 deletions
diff --git a/pyload/network/Browser.py b/pyload/network/Browser.py
index 59cc9dcb0..d8617fabc 100644
--- a/pyload/network/Browser.py
+++ b/pyload/network/Browser.py
@@ -68,7 +68,8 @@ class Browser(object):
@property
def percent(self):
- if not self.size: return 0
+ if not self.size:
+ return 0
return (self.arrived * 100) / self.size
diff --git a/pyload/network/HTTPChunk.py b/pyload/network/HTTPChunk.py
index 8a9c4803f..784b64349 100644
--- a/pyload/network/HTTPChunk.py
+++ b/pyload/network/HTTPChunk.py
@@ -177,7 +177,8 @@ class HTTPChunk(HTTPRequest):
if self.range:
# do nothing if chunk already finished
- if self.arrived + self.range[0] >= self.range[1]: return None
+ if self.arrived + self.range[0] >= self.range[1]:
+ return None
if self.id == len(self.p.info.chunks) - 1: #: as last chunk dont set end range, so we get everything
range = "%i-" % (self.arrived + self.range[0])
diff --git a/pyload/network/HTTPDownload.py b/pyload/network/HTTPDownload.py
index 32c165f82..13666195a 100644
--- a/pyload/network/HTTPDownload.py
+++ b/pyload/network/HTTPDownload.py
@@ -72,7 +72,8 @@ class HTTPDownload(object):
@property
def percent(self):
- if not self.size: return 0
+ if not self.size:
+ return 0
return (self.arrived * 100) / self.size
@@ -134,7 +135,8 @@ class HTTPDownload(object):
finally:
self.close()
- if self.nameDisposition and self.disposition: return self.nameDisposition
+ if self.nameDisposition and self.disposition:
+ return self.nameDisposition
return None
@@ -295,7 +297,8 @@ class HTTPDownload(object):
def findChunk(self, handle):
""" linear search to find a chunk (should be ok since chunk size is usually low) """
for chunk in self.chunks:
- if chunk.c == handle: return chunk
+ if chunk.c == handle:
+ return chunk
def closeChunk(self, chunk):
diff --git a/pyload/network/RequestFactory.py b/pyload/network/RequestFactory.py
index 49cfedce6..0591c5162 100644
--- a/pyload/network/RequestFactory.py
+++ b/pyload/network/RequestFactory.py
@@ -122,6 +122,7 @@ class RequestFactory(object):
else:
self.bucket.setRate(self.core.config.get("download", "max_speed") * 1024)
+
# needs pyreq in global namespace
def getURL(*args, **kwargs):
return pyreq.getURL(*args, **kwargs)
diff --git a/pyload/network/XDCCRequest.py b/pyload/network/XDCCRequest.py
index ccaeebe5f..dff500749 100644
--- a/pyload/network/XDCCRequest.py
+++ b/pyload/network/XDCCRequest.py
@@ -145,7 +145,8 @@ class XDCCRequest(object):
@property
def percent(self):
- if not self.filesize: return 0
+ if not self.filesize:
+ return 0
return (self.recv * 100) / self.filesize