diff options
author | Mathieu Bridon <[email protected]> | 2018-07-05 15:17:35 +0200 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2018-07-24 11:07:04 -0700 |
commit | 1d209275c29886bac218d77135f61ae52464a1be (patch) | |
tree | 4c6799c2e035b47743303eed6b4e8b75e737b18a /src/mapi/glapi/gen/gl_XML.py | |
parent | 9b3474249513267bb4e50d450c70e688bffbc082 (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/gl_XML.py')
-rw-r--r-- | src/mapi/glapi/gen/gl_XML.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py index bfeacf13863..bea6801db3c 100644 --- a/src/mapi/glapi/gen/gl_XML.py +++ b/src/mapi/glapi/gen/gl_XML.py @@ -943,7 +943,7 @@ class gl_api(object): temp_name = child.get( "name" ) self.category_dict[ temp_name ] = [cat_name, cat_number] - if self.functions_by_name.has_key( func_name ): + if func_name in self.functions_by_name: func = self.functions_by_name[ func_name ] func.process_element( child ) else: @@ -980,7 +980,7 @@ class gl_api(object): if (cat == None) or (cat == cat_name): [func_cat_type, key] = classify_category(cat_name, cat_number) - if not lists[func_cat_type].has_key(key): + if key not in lists[func_cat_type]: lists[func_cat_type][key] = {} lists[func_cat_type][key][func.name] = func @@ -1057,7 +1057,7 @@ class gl_api(object): def get_category_for_name( self, name ): - if self.category_dict.has_key(name): + if name in self.category_dict: return self.category_dict[name] else: return ["<unknown category>", None] |