[llvm] r350314 - Python compat - has_key vs. in operator
Serge Guelton via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 3 06:12:38 PST 2019
Author: serge_sans_paille
Date: Thu Jan 3 06:12:37 2019
New Revision: 350314
URL: http://llvm.org/viewvc/llvm-project?rev=350314&view=rev
Log:
Python compat - has_key vs. in operator
Use portable `in` operator instead of `has_key(...)` method.
Differential Revision: https://reviews.llvm.org/D56260
Modified:
llvm/trunk/utils/release/findRegressions-nightly.py
llvm/trunk/utils/release/findRegressions-simple.py
Modified: llvm/trunk/utils/release/findRegressions-nightly.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/release/findRegressions-nightly.py?rev=350314&r1=350313&r2=350314&view=diff
==============================================================================
--- llvm/trunk/utils/release/findRegressions-nightly.py (original)
+++ llvm/trunk/utils/release/findRegressions-nightly.py Thu Jan 3 06:12:37 2019
@@ -36,7 +36,7 @@ def parse(file):
else:
fname = tmp[0].strip('\r\n')
- if not test.has_key(fname) :
+ if fname not in test :
test[fname] = {}
for k in test:
@@ -77,12 +77,12 @@ def diffResults(d_old, d_new):
if DEBUG:
print(t)
- if d_new.has_key(t) :
+ if t in d_new :
# Check if the test passed or failed.
for x in test:
- if d_old[t].has_key(x):
- if d_new[t].has_key(x):
+ if x in d_old[t]:
+ if x in d_new[t]:
if d_old[t][x] == 'PASS':
if d_new[t][x] != 'PASS':
print(t + " *** REGRESSION (" + x + ")\n")
@@ -95,22 +95,22 @@ def diffResults(d_old, d_new):
# For execution time, if there is no result, its a fail.
for x in exectime:
- if d_old[t].has_key(tp + x):
- if not d_new[t].has_key(tp + x):
+ if tp + x in d_old[t]:
+ if tp + x not in d_new[t]:
print(t + " *** REGRESSION (" + tp + x + ")\n")
else :
- if d_new[t].has_key(tp + x):
+ if tp + x in d_new[t]:
print(t + " * NEW PASS (" + tp + x + ")\n")
for x in comptime:
- if d_old[t].has_key(exp + x):
- if not d_new[t].has_key(exp + x):
+ if exp + x in d_old[t]:
+ if exp + x not in d_new[t]:
print(t + " *** REGRESSION (" + exp + x + ")\n")
else :
- if d_new[t].has_key(exp + x):
+ if exp + x in d_new[t]:
print(t + " * NEW PASS (" + exp + x + ")\n")
else :
Modified: llvm/trunk/utils/release/findRegressions-simple.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/release/findRegressions-simple.py?rev=350314&r1=350313&r2=350314&view=diff
==============================================================================
--- llvm/trunk/utils/release/findRegressions-simple.py (original)
+++ llvm/trunk/utils/release/findRegressions-simple.py Thu Jan 3 06:12:37 2019
@@ -33,7 +33,7 @@ def parse(file):
else:
fname = tmp[0].strip('\r\n')
- if not test.has_key(fname):
+ if fname not in test:
test[fname] = {}
test[fname][t[1] + ' state'] = t[0]
@@ -73,16 +73,16 @@ def diffResults(d_old, d_new):
passes[x] = ''
for t in sorted(d_old.keys()) :
- if d_new.has_key(t):
+ if t in d_new:
# Check if the test passed or failed.
for x in ['compile state', 'compile time', 'exec state', 'exec time']:
- if not d_old[t].has_key(x) and not d_new[t].has_key(x):
+ if x not in d_old[t] and x not in d_new[t]:
continue
- if d_old[t].has_key(x):
- if d_new[t].has_key(x):
+ if x in d_old[t]:
+ if x in d_new[t]:
if d_old[t][x] == 'PASS':
if d_new[t][x] != 'PASS':
@@ -98,11 +98,11 @@ def diffResults(d_old, d_new):
continue
# For execution time, if there is no result it's a fail.
- if not d_old[t].has_key(x) and not d_new[t].has_key(x):
+ if x not in d_old[t] and x not in d_new[t]:
continue
- elif not d_new[t].has_key(x):
+ elif x not in d_new[t]:
regressions[x] += t + "\n"
- elif not d_old[t].has_key(x):
+ elif x not in d_old[t]:
passes[x] += t + "\n"
if math.isnan(d_old[t][x]) and math.isnan(d_new[t][x]):
More information about the llvm-commits
mailing list