diff options
Diffstat (limited to 'pyload/cli')
-rw-r--r-- | pyload/cli/Cli.py | 15 | ||||
-rw-r--r-- | pyload/cli/Handler.py | 1 | ||||
-rw-r--r-- | pyload/cli/ManageFiles.py | 12 |
3 files changed, 13 insertions, 15 deletions
diff --git a/pyload/cli/Cli.py b/pyload/cli/Cli.py index 84725b625..fc5236ff9 100644 --- a/pyload/cli/Cli.py +++ b/pyload/cli/Cli.py @@ -55,8 +55,8 @@ class Cli(object): self.lock = Lock() # processor funcions, these will be changed dynamically depending on control flow - self.headerHandler = self # the download status - self.bodyHandler = self # the menu section + self.headerHandler = self #: the download status + self.bodyHandler = self #: the menu section self.inputHandler = self os.system("clear") @@ -158,7 +158,7 @@ class Cli(object): line += 1 for download in data: - if download.status == 12: # downloading + if download.status == 12: #: downloading percent = download.percent z = percent / 4 speed += download.speed @@ -214,7 +214,7 @@ class Cli(object): # clear old output if line < self.lastLowestLine: - for i in range(line + 1, self.lastLowestLine + 1): + for i in xrange(line + 1, self.lastLowestLine + 1): println(i, "") self.lastLowestLine = line @@ -265,7 +265,7 @@ class Cli(object): print "No downloads running." for download in files: - if download.status == 12: # downloading + if download.status == 12: #: downloading print print_status(download) print "\tDownloading: %s @ %s/s\t %s (%s%%)" % ( download.format_eta, formatSize(download.speed), formatSize(download.size - download.bleft), @@ -321,9 +321,8 @@ class Cli(object): print _("File does not exists.") return - f = open(join(owd, path), "rb") - content = f.read() - f.close() + with open(join(owd, path), "rb") as f: + content = f.read() rid = self.client.checkOnlineStatusContainer([], basename(f.name), content).rid self.printOnlineCheck(self.client, rid) diff --git a/pyload/cli/Handler.py b/pyload/cli/Handler.py index 444d7f6d0..33e5dd8e6 100644 --- a/pyload/cli/Handler.py +++ b/pyload/cli/Handler.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- # @author: RaNaN - class Handler(object): def __init__(self, cli): diff --git a/pyload/cli/ManageFiles.py b/pyload/cli/ManageFiles.py index c010895c5..3833b2c48 100644 --- a/pyload/cli/ManageFiles.py +++ b/pyload/cli/ManageFiles.py @@ -15,9 +15,9 @@ class ManageFiles(Handler): def init(self): self.target = Destination.Queue - self.pos = 0 # position in queue - self.package = -1 # choosen package - self.mode = "" # move/delete/restart + self.pos = 0 #: position in queue + self.package = -1 #: choosen package + self.mode = "" #: move/delete/restart self.cache = None self.links = None @@ -113,7 +113,7 @@ class ManageFiles(Handler): i += 1 except Exception: pass - for _i in range(5 - i): + for _i in xrange(5 - i): println(line, "") line += 1 else: @@ -128,7 +128,7 @@ class ManageFiles(Handler): i += 1 except Exception, e: pass - for _i in range(5 - i): + for _i in xrange(5 - i): println(line, "") line += 1 @@ -168,7 +168,7 @@ class ManageFiles(Handler): inp = inp.strip() if "-" in inp: l, _, h = inp.partition("-") - r = range(int(l), int(h) + 1) + r = xrange(int(l), int(h) + 1) if package: return [p.pid for p in self.cache if p.pid in r] |