Skip to content

Commit

Permalink
gpu/vulkan/generate_bindings.py: Convert uses of has_key
Browse files Browse the repository at this point in the history
Conversion performed automatically using '2to3 -w -f has_key .'.
This is backwards compatible with Python 2.

Bug: 941669
Change-Id: I05c814fa07bbf1bb5d74d60989d6f292a54f2eda
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817879
Auto-Submit: Raul Tambre <raul@tambre.ee>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698886}
  • Loading branch information
tambry authored and Commit Bot committed Sep 23, 2019
1 parent 8f9ba20 commit 3fd9ad8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gpu/vulkan/generate_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@

def WriteFunctions(file, functions, template, check_extension=False):
for group in functions:
if group.has_key('ifdef'):
if 'ifdef' in group:
file.write('#if %s\n' % group['ifdef'])

extension = group['extension'] if group.has_key('extension') else ''
extension = group['extension'] if 'extension' in group else ''
min_api_version = \
group['min_api_version'] if group.has_key('min_api_version') else ''
group['min_api_version'] if 'min_api_version' in group else ''

if not check_extension:
for func in group['functions']:
Expand All @@ -255,15 +255,15 @@ def WriteFunctions(file, functions, template, check_extension=False):
extension)

extension_suffix = \
group['extension_suffix'] if group.has_key('extension_suffix') \
group['extension_suffix'] if 'extension_suffix' in group \
else ''
for func in group['functions']:
file.write(template.substitute(
{'name': func, 'extension_suffix': extension_suffix}))

file.write('}\n')

if group.has_key('ifdef'):
if 'ifdef' in group:
file.write('#endif // %s\n' % group['ifdef'])

file.write('\n')
Expand Down Expand Up @@ -365,7 +365,7 @@ def GenerateHeaderFile(file):
// Unassociated functions
""")

WriteMacros(file, [{'functions':[ 'vkGetInstanceProcAddr' ]}])
WriteMacros(file, [{'functions': [ 'vkGetInstanceProcAddr' ]}])
WriteMacros(file, VULKAN_UNASSOCIATED_FUNCTIONS)

file.write("""\
Expand Down

0 comments on commit 3fd9ad8

Please sign in to comment.