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 <zhangyangyang@unionpay.com>
This commit is contained in:
parent
f19dd0498f
commit
5828463612
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue