Use the print function everywhere

python modernize.py --no-six -f libmodernize.fixes.fix_print -w

With manual fixes as the import was put always on top.
This commit is contained in:
Laurent Bachelier 2014-10-06 14:23:20 +02:00
commit 74a4ef6723
73 changed files with 499 additions and 442 deletions

View file

@ -17,6 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from datetime import timedelta
from email import message_from_string, message_from_file
@ -156,7 +157,7 @@ class BoobTracker(ReplApplication):
elif len(path) > 0:
query.project = path[0]
else:
print >>self.stderr, 'Please enter a project name'
print('Please enter a project name', file=self.stderr)
return 1
query.author = self.options.author
@ -183,12 +184,12 @@ class BoobTracker(ReplApplication):
Get an issue and display it.
"""
if not line:
print >>self.stderr, 'This command takes an argument: %s' % self.get_command_help('get', short=True)
print('This command takes an argument: %s' % self.get_command_help('get', short=True), file=self.stderr)
return 2
issue = self.get_object(line, 'get_issue')
if not issue:
print >>self.stderr, 'Issue not found: %s' % line
print('Issue not found: %s' % line, file=self.stderr)
return 3
self.format(issue)
@ -226,7 +227,7 @@ class BoobTracker(ReplApplication):
try:
hours = float(hours)
except ValueError:
print >>self.stderr, 'Error: HOURS parameter may be a float'
print('Error: HOURS parameter may be a float', file=self.stderr)
return 1
id, backend_name = self.parse_id(id, unique_backend=True)
@ -398,8 +399,8 @@ class BoobTracker(ReplApplication):
try:
issue = backend.post_issue(issue)
print 'Issue %s %s' % (self.formatter.colored(issue.fullid, 'red', 'bold'),
'updated' if edit else 'created')
print('Issue %s %s' % (self.formatter.colored(issue.fullid, 'red', 'bold'),
'updated' if edit else 'created'))
if edit:
self.format(issue)
elif email_to:
@ -447,7 +448,7 @@ Weboob Team
--status STATUS
"""
if not line.strip():
print 'Please give the project name'
print('Please give the project name')
return 1
project, backend_name = self.parse_id(line, unique_backend=True)
@ -481,7 +482,7 @@ Weboob Team
_id, key, value = self.parse_command_args(line, 3, 1)
issue = self.get_object(_id, 'get_issue')
if not issue:
print >>self.stderr, 'Issue not found: %s' % _id
print('Issue not found: %s' % _id, file=self.stderr)
return 3
return self.edit_issue(issue, edit=True)
@ -499,4 +500,4 @@ Weboob Team
Attach a file to an issue (Not implemented yet).
"""
print >>self.stderr, 'Not implemented yet.'
print('Not implemented yet.', file=self.stderr)