From 5828463612a61e6c7cbc7cb333e213a3bc784156 Mon Sep 17 00:00:00 2001 From: zhangyangyang Date: Sat, 1 Sep 2018 16:34:13 +0800 Subject: [PATCH] Python 3 compatibility: fix has_key For Python 3.0, has_key() isn't supported already, it can be replaced with in. Story: 2003433 Task: 25737 Change-Id: I841718a820094b62df6cd3fc0e236e072d9f9f61 Signed-off-by: zhangyangyang --- compute-huge/compute-huge/topology.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compute-huge/compute-huge/topology.py b/compute-huge/compute-huge/topology.py index 46ea5d53df..f84c0c1869 100755 --- a/compute-huge/compute-huge/topology.py +++ b/compute-huge/compute-huge/topology.py @@ -81,17 +81,17 @@ class Topology(object): if match: core_id = int(match.group(1)) - if not Thread_cnt.has_key(socket_id): + if socket_id not in Thread_cnt: Thread_cnt[socket_id] = {} - if not Thread_cnt[socket_id].has_key(core_id): + if core_id not in Thread_cnt[socket_id]: Thread_cnt[socket_id][core_id] = 0 else: Thread_cnt[socket_id][core_id] += 1 thread_id = Thread_cnt[socket_id][core_id] - if not self.topology.has_key(socket_id): + if socket_id not in self.topology: self.topology[socket_id] = {} - if not self.topology[socket_id].has_key(core_id): + if core_id not in self.topology[socket_id]: self.topology[socket_id][core_id] = {} self.topology[socket_id][core_id][thread_id] = cpu