diff options
| author | xmo-odoo <xmo@odoo.com> | 2017-04-25 13:27:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-25 13:27:54 +0200 |
| commit | 6b9268bd15f8db22855d91849749b879f2d553a1 (patch) | |
| tree | a14ed2a0ff1b4eafb0f94b0dfafcea34187499bf /odoo/cli | |
| parent | 3cbca4b7348b60eb6cfe3f423983d53dada67862 (diff) | |
[FIX] print statement -> function
In Python 3, ``print`` becomes a builtin function. This is available
in Python 2 by importing the ``print_function`` feature from
``__future__``, the feature is conveniently still available in Python
3 (it just does nothing).
Fixers:
libfuturize.fixes.fix_print_with_import
#8530
Diffstat (limited to 'odoo/cli')
| -rw-r--r-- | odoo/cli/command.py | 7 | ||||
| -rw-r--r-- | odoo/cli/deploy.py | 1 | ||||
| -rw-r--r-- | odoo/cli/scaffold.py | 5 | ||||
| -rw-r--r-- | odoo/cli/shell.py | 7 | ||||
| -rw-r--r-- | odoo/cli/start.py | 3 |
5 files changed, 14 insertions, 9 deletions
diff --git a/odoo/cli/command.py b/odoo/cli/command.py index 75aa392fdfb..2ab042f58e8 100644 --- a/odoo/cli/command.py +++ b/odoo/cli/command.py @@ -1,3 +1,4 @@ +from __future__ import print_function import logging import sys import os @@ -26,14 +27,14 @@ class Command(object): class Help(Command): """Display the list of available commands""" def run(self, args): - print "Available commands:\n" + print("Available commands:\n") names = commands.keys() padding = max([len(k) for k in names]) + 2 for k in sorted(names): name = k.ljust(padding, ' ') doc = (commands[k].__doc__ or '').strip() - print " %s%s" % (name, doc) - print "\nUse '%s <command> --help' for individual command help." % sys.argv[0].split(os.path.sep)[-1] + print(" %s%s" % (name, doc)) + print("\nUse '%s <command> --help' for individual command help." % sys.argv[0].split(os.path.sep)[-1]) def main(): args = sys.argv[1:] diff --git a/odoo/cli/deploy.py b/odoo/cli/deploy.py index 2547ebdcd78..6e76cea7d45 100644 --- a/odoo/cli/deploy.py +++ b/odoo/cli/deploy.py @@ -1,5 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from __future__ import print_function import argparse import os import requests diff --git a/odoo/cli/scaffold.py b/odoo/cli/scaffold.py index 83c2befe96c..53d3b8df85a 100644 --- a/odoo/cli/scaffold.py +++ b/odoo/cli/scaffold.py @@ -1,5 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from __future__ import print_function import argparse import os import re @@ -128,9 +129,9 @@ class template(object): .dump(f, encoding='utf-8') def die(message, code=1): - print >>sys.stderr, message + print(message, file=sys.stderr) sys.exit(code) def warn(message): # ASK: shall we use logger ? - print "WARNING: " + message + print("WARNING:", message) diff --git a/odoo/cli/shell.py b/odoo/cli/shell.py index 1e847800956..320cf5aa3d4 100644 --- a/odoo/cli/shell.py +++ b/odoo/cli/shell.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from __future__ import print_function import code import logging import os @@ -44,7 +45,7 @@ class Console(code.InteractiveConsole): import readline import rlcompleter except ImportError: - print 'readline or rlcompleter not available, autocomplete disabled.' + print('readline or rlcompleter not available, autocomplete disabled.') else: readline.set_completer(rlcompleter.Completer(locals).complete) readline.parse_and_bind("tab: complete") @@ -65,9 +66,9 @@ class Shell(Command): exec sys.stdin in local_vars else: if 'env' not in local_vars: - print 'No environment set, use `%s shell -d dbname` to get one.' % sys.argv[0] + print('No environment set, use `%s shell -d dbname` to get one.' % sys.argv[0]) for i in sorted(local_vars): - print '%s: %s' % (i, local_vars[i]) + print('%s: %s' % (i, local_vars[i])) preferred_interface = config.options.get('shell_interface') if preferred_interface: diff --git a/odoo/cli/start.py b/odoo/cli/start.py index 88df395eab5..c42494b60b1 100644 --- a/odoo/cli/start.py +++ b/odoo/cli/start.py @@ -1,5 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from __future__ import print_function import argparse import glob import itertools @@ -77,5 +78,5 @@ class Start(Command): main(cmdargs) def die(message, code=1): - print >>sys.stderr, message + print(message, file=sys.stderr) sys.exit(code) |
