r349447 - Portable Python script across Python version
Serge Guelton via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 18 00:22:47 PST 2018
Author: serge_sans_paille
Date: Tue Dec 18 00:22:47 2018
New Revision: 349447
URL: http://llvm.org/viewvc/llvm-project?rev=349447&view=rev
Log:
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.
Modified:
cfe/trunk/docs/tools/dump_format_style.py
cfe/trunk/tools/scan-view/share/startfile.py
Modified: cfe/trunk/docs/tools/dump_format_style.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/tools/dump_format_style.py?rev=349447&r1=349446&r2=349447&view=diff
==============================================================================
--- cfe/trunk/docs/tools/dump_format_style.py (original)
+++ cfe/trunk/docs/tools/dump_format_style.py Tue Dec 18 00:22:47 2018
@@ -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)
Modified: cfe/trunk/tools/scan-view/share/startfile.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/share/startfile.py?rev=349447&r1=349446&r2=349447&view=diff
==============================================================================
--- cfe/trunk/tools/scan-view/share/startfile.py (original)
+++ cfe/trunk/tools/scan-view/share/startfile.py Tue Dec 18 00:22:47 2018
@@ -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
More information about the cfe-commits
mailing list