summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge Guelton <sguelton@quarkslab.com>2018-12-18 08:22:47 +0000
committerSerge Guelton <sguelton@quarkslab.com>2018-12-18 08:22:47 +0000
commit08e6d377b981edb4779bd3b24fc75335ba42a308 (patch)
tree481ca6d0a7215a07cbface19179f041fbe2969c8
parent053bd3c0257702859088b3ad059f8bbfe3ab043c (diff)
Portable Python script across Python version
dict no longer have the `has_key` method in Python3. Instead, one can use the `in` keyword which already works in Python2. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349447 91177308-0d34-0410-b5e6-96231b3b80d8
-rwxr-xr-xdocs/tools/dump_format_style.py4
-rw-r--r--tools/scan-view/share/startfile.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/docs/tools/dump_format_style.py b/docs/tools/dump_format_style.py
index 2e1e8c1229..f2682edc77 100755
--- a/docs/tools/dump_format_style.py
+++ b/docs/tools/dump_format_style.py
@@ -180,9 +180,9 @@ def read_options(header):
'std::vector<std::string>',
'std::vector<IncludeCategory>',
'std::vector<RawStringFormat>']:
- if enums.has_key(option.type):
+ if option.type in enums:
option.enum = enums[option.type]
- elif nested_structs.has_key(option.type):
+ elif option.type in nested_structs:
option.nested_struct = nested_structs[option.type]
else:
raise Exception('Unknown type: %s' % option.type)
diff --git a/tools/scan-view/share/startfile.py b/tools/scan-view/share/startfile.py
index f58dbeeaf8..58023d0271 100644
--- a/tools/scan-view/share/startfile.py
+++ b/tools/scan-view/share/startfile.py
@@ -189,7 +189,7 @@ else:
return _controllers[controller_name].open
except KeyError:
- if _controllers.has_key('xdg-open'):
+ if 'xdg-open' in _controllers:
return _controllers['xdg-open'].open
else:
return webbrowser.open