fix: use print() function in both Python 2 and Python 3 (#18395)
Legacy print statements are syntax errors in Python 3 but print() function works as expected in both Python 2 and Python 3. Old style exceptions are syntax errors in Python 3 but new style exceptions work as expected in both Python 2 and Python 3.
This commit is contained in:
parent
7d0a93858d
commit
1d6e5e6e70
18 changed files with 62 additions and 894 deletions
|
@ -11,6 +11,11 @@ PYYAML_LIB_DIR = os.path.join(VENDOR_DIR, 'pyyaml', 'lib')
|
|||
sys.path.append(PYYAML_LIB_DIR)
|
||||
import yaml #pylint: disable=wrong-import-position,wrong-import-order
|
||||
|
||||
try:
|
||||
basestring # Python 2
|
||||
except NameError: # Python 3
|
||||
basestring = str # pylint: disable=redefined-builtin
|
||||
|
||||
|
||||
class Verbosity:
|
||||
CHATTY = 'chatty' # stdout and stderr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue