Commit 723d9cb6 authored by Raul Tambre's avatar Raul Tambre Committed by Commit Bot

tools/: Convert uses of has_key

Conversion performed automatically using '2to3 -w -f has_key .'.
This is backwards compatible with Python 2.

Bug: 941669
Change-Id: I296c93d354cc4b49c5bcdc416cd495b352aa0617
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817601
Auto-Submit: Raul Tambre <raul@tambre.ee>
Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
Cr-Commit-Position: refs/heads/master@{#699388}
parent 75bbdfb2
......@@ -169,7 +169,7 @@ def build_graphs_in_dir(dirname):
def build_graph(filename):
for decl in parse_file(filename):
if decl.has_key('name'):
if 'name' in decl:
# Add/update a node entry
name = decl['name']
node = get_node(name)
......
......@@ -191,7 +191,7 @@ def UpdateHistogramDefinitions(histogram_enum_name, source_enum_values,
for child in enum_node.childNodes:
if child.nodeName == 'int':
value = int(child.attributes['value'].value)
if not source_enum_values.has_key(value):
if value not in source_enum_values:
new_item_nodes[value] = child
# Preserve existing non-generated comments.
elif (child.nodeType == minidom.Node.COMMENT_NODE and
......
......@@ -195,7 +195,7 @@ def main():
# Extract the required fields
for field in ["origin", "feature", "expiry"]:
if not token_data.has_key(field):
if field not in token_data:
print "Token is missing required field: %s" % field
sys.exit(1)
......
......@@ -17,7 +17,7 @@ def parseEvents(z):
e['eventtype'] == 'EVENT_TYPE_TRYENTER_CS' or
e['eventtype'] == 'EVENT_TYPE_LEAVE_CS'):
cs = e['critical_section']
if not crits.has_key(cs):
if cs not in crits:
crits[cs] = [ ]
crits[cs].append(e)
......
......@@ -17,7 +17,7 @@ import re
def parseEvents(z):
print 'parseEvents(['
for e in z:
if e.has_key('ms') and e.has_key('done'):
if 'ms' in e and 'done' in e:
dur = e['done'] - e['ms']
if dur < 0.2:
continue
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment