From 9bf17b34d16d13f5686d4c2ed4b244040f2d0b70 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Sun, 15 Jan 2017 11:40:31 +0100 Subject: [PATCH] Remove obsolete imports and code - landscape.io pointed out obsolete imports - there is also an obsolete variable and lock in throttle.py - add Exception type to BMConfigParser().save --- src/configparser.py | 2 +- src/shared.py | 2 -- src/throttle.py | 4 ---- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/configparser.py b/src/configparser.py index 4d49e6f4..72fb5f20 100644 --- a/src/configparser.py +++ b/src/configparser.py @@ -56,7 +56,7 @@ class BMConfigParser(ConfigParser.SafeConfigParser): shutil.copyfile(fileName, fileNameBak) # The backup succeeded. fileNameExisted = True - except: + except IOError, Error: # The backup failed. This can happen if the file didn't exist before. fileNameExisted = False # write the file diff --git a/src/shared.py b/src/shared.py index 57ff7908..f4956add 100644 --- a/src/shared.py +++ b/src/shared.py @@ -16,8 +16,6 @@ import sys import stat import threading import time -import shutil # used for moving the data folder and copying keys.dat -import datetime import traceback from binascii import hexlify diff --git a/src/throttle.py b/src/throttle.py index 5b503e1e..e58ca11a 100644 --- a/src/throttle.py +++ b/src/throttle.py @@ -26,8 +26,6 @@ class Throttle(object): self.txLen = 0 def wait(self, dataLen): - with self.lock: - self.waiting = True with self.lock: self.txLen += dataLen self.total += dataLen @@ -38,8 +36,6 @@ class Throttle(object): if self.txLen < self.limit: break self.timer.wait(0.2) - with self.lock: - self.waiting = False def getSpeed(self): self.recalculate()