From f242f79868dbd80ea319e2ae97bb44ba11270400 Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Tue, 16 Feb 2016 09:41:47 +0100 Subject: Core/utils: autopep8 --- miasm2/core/utils.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'miasm2/core/utils.py') diff --git a/miasm2/core/utils.py b/miasm2/core/utils.py index 0512f4aa..35ddbb82 100644 --- a/miasm2/core/utils.py +++ b/miasm2/core/utils.py @@ -13,10 +13,12 @@ pck32 = lambda x: struct.pack('I', x) pck64 = lambda x: struct.pack('Q', x) -pck = {8:pck8, - 16:pck16, - 32:pck32, - 64:pck64} +pck = {8: pck8, + 16: pck16, + 32: pck32, + 64: pck64} + + def get_caller_name(caller_num=0): """Get the nth caller's name @caller_num: 0 = the caller of get_caller_name, 1 = next parent, ...""" @@ -63,6 +65,7 @@ class keydefaultdict(collections.defaultdict): class BoundedDict(UserDict.DictMixin): + """Limited in size dictionary. To reduce combinatory cost, once an upper limit @max_size is reached, @@ -104,7 +107,7 @@ class BoundedDict(UserDict.DictMixin): self._delete_cb(key) # Keep only the most @_min_size used - self._data = {key:self._data[key] + self._data = {key: self._data[key] for key, _ in most_common[:self._min_size - 1]} self._size = self._min_size -- cgit 1.4.1