From f162ae0de0f71391c56957389cc3c8babc8022e1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Apr 2015 16:37:00 +0200 Subject: Use with statement --- pyload/cli/Cli.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'pyload/cli/Cli.py') diff --git a/pyload/cli/Cli.py b/pyload/cli/Cli.py index 84725b625..a1f192bb3 100644 --- a/pyload/cli/Cli.py +++ b/pyload/cli/Cli.py @@ -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) -- cgit v1.2.3 From e1c22fad3fffb485da400e4b34c094f201a2c72e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Apr 2015 18:03:46 +0200 Subject: range -> xrange --- pyload/cli/Cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pyload/cli/Cli.py') diff --git a/pyload/cli/Cli.py b/pyload/cli/Cli.py index a1f192bb3..cd3252220 100644 --- a/pyload/cli/Cli.py +++ b/pyload/cli/Cli.py @@ -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 -- cgit v1.2.3 From 892b7cbd4981b764bed30b2ccc5ca73d791c39f2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 20 Apr 2015 22:56:34 +0200 Subject: Spare code cosmetics (9) --- pyload/cli/Cli.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pyload/cli/Cli.py') diff --git a/pyload/cli/Cli.py b/pyload/cli/Cli.py index cd3252220..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 @@ -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), -- cgit v1.2.3