aboutsummaryrefslogtreecommitdiffstats
path: root/src/mapi/glapi/gen/glX_proto_size.py
diff options
context:
space:
mode:
authorMathieu Bridon <[email protected]>2018-07-05 15:17:35 +0200
committerDylan Baker <[email protected]>2018-07-24 11:07:04 -0700
commit1d209275c29886bac218d77135f61ae52464a1be (patch)
tree4c6799c2e035b47743303eed6b4e8b75e737b18a /src/mapi/glapi/gen/glX_proto_size.py
parent9b3474249513267bb4e50d450c70e688bffbc082 (diff)
python: Better check for keys in dicts
Python 3 lost the dict.has_key() method. Instead it requires using the "in" operator. This is also compatible with Python 2. Signed-off-by: Mathieu Bridon <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mapi/glapi/gen/glX_proto_size.py')
-rw-r--r--src/mapi/glapi/gen/glX_proto_size.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mapi/glapi/gen/glX_proto_size.py b/src/mapi/glapi/gen/glX_proto_size.py
index 284ee70e618..18a6f2e5024 100644
--- a/src/mapi/glapi/gen/glX_proto_size.py
+++ b/src/mapi/glapi/gen/glX_proto_size.py
@@ -71,7 +71,7 @@ class glx_enum_function(object):
for enum_name in enum_dict:
e = enum_dict[ enum_name ]
- if e.functions.has_key( match_name ):
+ if match_name in e.functions:
[count, mode] = e.functions[ match_name ]
if mode_set and mode != self.mode:
@@ -79,11 +79,11 @@ class glx_enum_function(object):
self.mode = mode
- if self.enums.has_key( e.value ):
+ if e.value in self.enums:
if e.name not in self.enums[ e.value ]:
self.enums[ e.value ].append( e )
else:
- if not self.count.has_key( count ):
+ if count not in self.count:
self.count[ count ] = []
self.enums[ e.value ] = [ e ]
@@ -131,7 +131,7 @@ class glx_enum_function(object):
for a in self.enums:
count += 1
- if self.count.has_key(-1):
+ if -1 in self.count:
return 0
# Determine if there is some mask M, such that M = (2^N) - 1,
@@ -356,7 +356,7 @@ class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common):
if (ef.is_set() and self.emit_set) or (not ef.is_set() and self.emit_get):
sig = ef.signature()
- if enum_sigs.has_key( sig ):
+ if sig in enum_sigs:
aliases.append( [func.name, enum_sigs[ sig ]] )
else:
enum_sigs[ sig ] = func.name
@@ -477,10 +477,10 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
sig = ef.signature()
- if not enum_functions.has_key(func.name):
+ if func.name not in enum_functions:
enum_functions[ func.name ] = sig
- if not enum_sigs.has_key( sig ):
+ if sig not in enum_sigs:
enum_sigs[ sig ] = ef
@@ -496,7 +496,7 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
if func.server_handcode: continue
if not func.has_variable_size_request(): continue
- if enum_functions.has_key(func.name):
+ if func.name in enum_functions:
sig = enum_functions[func.name]
ef = enum_sigs[ sig ]
@@ -621,7 +621,7 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
# already be emitted, don't emit this function. Instead, add
# it to the list of function aliases.
- if self.counter_sigs.has_key(sig):
+ if sig in self.counter_sigs:
n = self.counter_sigs[sig];
alias = [f.name, n]
else: