diff options
author | elie <elie> | 2016-02-20 22:18:08 +0000 |
---|---|---|
committer | elie <elie> | 2016-02-20 22:18:08 +0000 |
commit | 9be716faeeb821bfda48ad3344ec3cbe70cb14cf (patch) | |
tree | 143d121d2eeccacdd25183ac113e03c32b91cd10 | |
parent | 6513c0df2540ade8dca7513581133ee7f3ad9c2b (diff) | |
download | pysnmp-git-9be716faeeb821bfda48ad3344ec3cbe70cb14cf.tar.gz |
bumped to 4.3.3 and minor fixes
-rw-r--r-- | pysnmp/__init__.py | 2 | ||||
-rw-r--r-- | pysnmp/cache.py | 9 |
2 files changed, 5 insertions, 6 deletions
diff --git a/pysnmp/__init__.py b/pysnmp/__init__.py index ae57b26a..d56ec74b 100644 --- a/pysnmp/__init__.py +++ b/pysnmp/__init__.py @@ -1,5 +1,5 @@ # http://www.python.org/dev/peps/pep-0396/ -__version__ = '4.3.2' +__version__ = '4.3.3' # backward compatibility version = tuple([int(x) for x in __version__.split('.')]) majorVersionId = version[0] diff --git a/pysnmp/cache.py b/pysnmp/cache.py index ad989ed3..41a1a2cb 100644 --- a/pysnmp/cache.py +++ b/pysnmp/cache.py @@ -27,12 +27,11 @@ class Cache: def __setitem__(self, k, v): if self.__size >= self.__maxSize: - keys = list(self.__usage.keys()) - keys.sort(key=lambda x, d=self.__usage: d[x]) - for _k in keys[:self.__chopSize]: + usageKeys = sorted(self.__usage, key=lambda x, d=self.__usage: d[x]) + for _k in usageKeys[:self.__chopSize]: del self.__cache[_k] del self.__usage[_k] - self.__size = self.__size - self.__chopSize + self.__size -= self.__chopSize if k not in self.__cache: self.__size += 1 self.__usage[k] = 0 @@ -41,4 +40,4 @@ class Cache: def __delitem__(self, k): del self.__cache[k] del self.__usage[k] - self.__size = self.__size - 1 + self.__size -= 1 |